5 Replies Latest reply on Sep 25, 2012 6:24 AM by chrkoelle

    Disable cookies on server side in JBoss AS 7.1

    chrkoelle

      Hi

       

      We have the problem, that we want to disable cookies on the server side in the JBoss configuration. In JBoss 5 we were abel to do this by changing the context.xml of the tomcat configuration:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <Context cookies="false" ....>

         ....
      </Context>

       

      In JBoss 7.1 wen don't have this possibility.

       

      I've found the following thread: https://community.jboss.org/thread/169647 and the documentation of the JBoss Web subsystem: http://docs.jboss.org/jbossweb/7.0.x/config . But I can't find a hint in there for disabling cookies.

       

      Thanks

      Christian


        • 1. Re: Disable cookies on server side in JBoss AS 7.1
          jaikiran

          Moved to JBossWeb forum where you might get some help.

          • 2. Re: Disable cookies on server side in JBoss AS 7.1
            jfclere

            It is a servlet 3.0 spec part. you need  in web.xml of the webapp:

            <session-config>

              <tracking-mode>URL</tracking-mode>

            </session-config>

            1 of 1 people found this helpful
            • 3. Re: Disable cookies on server side in JBoss AS 7.1
              chrkoelle

              Thanks for the answer. This works of course. Unfortunately it's not a real solution for us. In our case we have one web application (.war) that should work in one environment with and in another without cookies. The web.xml is packed in the archive, so a configuration possibility outside the archive would be preferable. Otherwise we have to do some build magic to create two different web archives.

              • 4. Re: Disable cookies on server side in JBoss AS 7.1
                jaikiran

                Christian Kölle wrote:

                 

                Thanks for the answer. This works of course. Unfortunately it's not a real solution for us. In our case we have one web application (.war) that should work in one environment with and in another without cookies. The web.xml is packed in the archive, so a configuration possibility outside the archive would be preferable. Otherwise we have to do some build magic to create two different web archives.

                Are both environments running AS7? If yes, then there's a possible solution. AS 7.1 (I don't exactly remember the version) supports system property replacement in deployment descriptors. So you can have something like this in the web.xml:

                 

                <session-config>
                  <tracking-mode>${session.tracking.mode}</tracking-mode>
                </session-config>
                

                 

                Then you can pass different values for the session.tracking.mode system property (by the way, you can name that to anything) depending on the environment:

                 

                Environment 1:

                 

                ./standalone.sh -Dsession.tracking.mode=URL
                

                 

                Environment 2:

                 

                ./standalone.sh -Dsession.tracking.mode=COOKIE
                
                • 5. Re: Disable cookies on server side in JBoss AS 7.1
                  chrkoelle

                  Thanks for this really fast answer. That's exactly the solution I need.