Thursday, November 5, 2015

Modifying the default JSESSIONID cookie name

In Servlet 3.0 API

Modify the web.xml


<session-config>
    <cookie-config>
        <name>MY_JSESSIONID_YAHOOOOOO</name>
    </cookie-config>
</session-config>



Modify default JBOSS JSESSIONID cookie


There will be cases we need to modify the default JSESSIONID for all the applications deployed on the server.
In that case add below java startup argument.

-Dorg.apache.catalina.JSESSIONID=PSESSIONID



Modify JSESSIONID in WebLogic 


In Weblogic we can either modify a particular war at <war>/WEB-INF/weblogic.xml or or entire ear at <ear>/META-INF/weblogic-application.xml

Below is sample weblogic-application.xml

<?xml version="1.0" encoding="UTF-8"?><wls:weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-application.xsd"> <wls:session-descriptor>  
         <wls:cookie-name>PSESSIONID</wls:cookie-name>
</wls:session-descriptor></wls:weblogic-application>

No comments:

Post a Comment