1 Reply Latest reply on Feb 16, 2016 5:52 AM by Jay SenSharma

    Enable cookies in EAP 6.4.0

    suparna chakraborty Newbie

      Is there a way to set the cookie name, path, max age etc. in the Jboss Admin Console for an application or is the only way to achieve that is to start the server with the -Dorg.apache.catalina.JSESSIONID=MYSESSIONID parameter? What are the max age and path values in that case?

       

      If I deploy 2 webapps on the same Jboss standalone instance, could different cookie names be associated with them?

        • 1. Re: Enable cookies in EAP 6.4.0
          Jay SenSharma Master

          Servlet Specification 3.0 and above allows you to define a lots of session related configurations at individual application level using web.xml 3.0 version something like following:

           

          <?xml version="1.0"?>
          <web-app xmlns="http://java.sun.com/xml/ns/javaee"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-app_3_0.xsd"
                version="3.0">
                <!-- Make sure that your web.xml is pointing the version="3.0" as above -->
                <session-config>
                      <cookie-config>
                          <!--   The name that will be assigned to any session tracking cookies created by this web application. The default is JSESSIONID     -->
                          <cookie-name>MYJSESSIONID</cookie-name>
                      </cookie-config>
                </session-config>
          </web-app>
          

           

          Similarly you should be able to set the "cookie-domain", "cookie-path"  ..etc for individual applications using the "WEB-INF/web.xml" file.

          Please see the following links for more details:

           

           

          [1] http://java.sun.com/xml/ns/javaee/web-common_3_0.xsd

          [2] httpOnly Cookies using web.xml servlet 3.0 in JBoss AS7

              http://middlewaremagic.com/jboss/?p=1041

            

          Regards

          Jay SenSharma