tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarecsni János <jarecsni.ja...@mhc.hu>
Subject setting the path in the session cookie (Tomcat 402b)
Date Fri, 15 Feb 2002 13:39:45 GMT
Hi,

I've found the code segment in question:

[share]org.apache.catalina.connector.HttpResponseBase line 642 and
following:

        // Add the session ID cookie if necessary
        HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
        HttpSession session = hreq.getSession(false);

        if ((session != null) && session.isNew() && (getContext() != null)
            && getContext().getCookies()) {
            Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
                                       session.getId());
            cookie.setMaxAge(-1);
            String contextPath = null;
            if (context != null)
                contextPath = context.getPath();
            if ((contextPath != null) && (contextPath.length() > 0))
                cookie.setPath(contextPath);
            else
                cookie.setPath("/");
            if (hreq.isSecure())
                cookie.setSecure(true);
            addCookie(cookie);
        }

I'll try to patch it... :) How to do it canonically?
BTW.: I downloaded the source and tried to build it with ant (ant deploy in
the catalina dir) but build failed with some silly error message complaining
about a file. Tracking down the problem it turned out that some environment
variables are unset (required libraries, etc.).

Is there a short intro describing how to set up the development environment?

TIA!


János

--
Jarecsni, János
MORGAN HILL CONSULTING, Internet Applications Unit
mailto:Jarecsni.Janos@morganhillconsulting.hu
http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392

|-----Original Message-----
|From: Jarecsni János [mailto:jarecsni.janos@mhc.hu]
|Sent: Friday, February 15, 2002 1:57 PM
|To: Tomcat Developers List
|Subject: RE: setting the path in the session cookie (Tomcat 402b)
|
|
|Hi, Jean-Frederic,
|
|one more addition:
|
|This works fine:
|
|	RewriteRule ^/istore/something(.*) http://mydomain/istore$1 [P]
|
|Cookies work to (because the "/istore" will be present in both the
|original and the proxied url). You can then use:
|http://mydomain/istore/something/aServlet (which eventually will
|end at http://mydomain/istore/aServlet
|
|
|I want this to work:
|
|    RewriteRule !^/istore(.*) - [C]
|    RewriteRule (.*) http://mydomain/istore$1 [P]
|
|So any URL not containing the "/istore" prefix should be rewritten
|by prepending "/istore". Then you can use URLs like:
|http://mydomain/anything. This is what you normally do with
|Apache-served sites. I don't want to see no application context in
|my urls basically.
|
|Hope you get what I try to express!
|
|Cheers,
|János (=Jean in Hungarian :)
|
|--
|Jarecsni, János
|MORGAN HILL CONSULTING, Internet Applications Unit
|mailto:Jarecsni.Janos@morganhillconsulting.hu
|http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
|
||-----Original Message-----
||From: jfclere@vtxrm2.bcn.fsc.net [mailto:jfclere@vtxrm2.bcn.fsc.net]On
||Behalf Of jean-frederic clere
||Sent: Friday, February 15, 2002 12:51 PM
||To: Tomcat Developers List
||Subject: Re: setting the path in the session cookie (Tomcat 402b)
||
||
||Jarecsni János wrote:
||>
||> Hi,
||>
||> well a short explanation follows then.
||>
||> Since we want to alias our dynamic resources (which are to be served by
||> Tomcat+JBoss) in Apache we have to use mod_rewrite and mod_proxy.
||
||Why are you not using mod_jk or mod_webapp?
||
||> We need
||> the proxy because the rewritten urls don't get sent to tomcat,
||Apache treats
||> them as files. If we proxy those rewritten urls back to the same virtual
||> host, they get sent to tomcat.
||>
||> The only problem is that the webcontext is hardwired in the
||session cookie
||> by Tomcat. And since the webcontext must be rewritten for the
||whole thing to
||> work too, session cookies don't work anymore (the client doesn't
||send them
||> back because of the different path).
||>
||> The Sun RI sets the session cookie path to "/". That would work in our
||> situation too.
||>
||> Can I hope some sort of a remedy of this problem in a short
|time, what do
||> you think?
||>
||> Cheers & thanks.
||> János
||>
||> --
||> Jarecsni, János
||> MORGAN HILL CONSULTING, Internet Applications Unit
||> mailto:Jarecsni.Janos@morganhillconsulting.hu
||> http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
||>
||> |-----Original Message-----
||> |From: jfclere@vtxrm2.bcn.fsc.net [mailto:jfclere@vtxrm2.bcn.fsc.net]On
||> |Behalf Of jean-frederic clere
||> |Sent: Friday, February 15, 2002 12:16 PM
||> |To: Tomcat Developers List
||> |Subject: Re: setting the path in the session cookie (Tomcat 402b)
||> |
||> |
||> |Jarecsni János wrote:
||> |>
||> |> Hi,
||> |>
||> |> it seems that tomcat uses the "/contextname" path when creating
||> |the cookie
||> |> for the JSESSIONID. Since we use Apache in front of Tomcat and we use
||> |> mod_rewrite with mod_proxy to provide aliasing of dynamic Java
||> |resources, it
||> |> is not working for us.
||> |
||> |You should explain a little more why you have to that (like you
||> |have done it in
||> |httpd-dev list).
||> |
||> |>
||> |> We would like to be able to configure this path.
||> |>
||> |> Thanks in advance
||> |> János
||> |>
||> |> --
||> |> Jarecsni, János
||> |> MORGAN HILL CONSULTING, Internet Applications Unit
||> |> mailto:Jarecsni.Janos@morganhillconsulting.hu
||> |> http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
||> |>
||> |> --
||> |> To unsubscribe, e-mail:
||> |<mailto:tomcat-dev-|unsubscribe@jakarta.apache.org>
||> |> For
||> |additional commands, e-mail:
|<mailto:tomcat-dev-help@jakarta.apache.org>
||> |
||> |--
||> |To
|unsubscribe, e-mail:
||> |<mailto:tomcat-dev-|unsubscribe@jakarta.apache.org>
||> |For additional
||> |commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>
||> |
||> |
||>
||> --
||> To unsubscribe, e-mail:
||<mailto:tomcat-dev-|unsubscribe@jakarta.apache.org>
||> For
||additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>
||
||--
||To unsubscribe, e-mail:
||<mailto:tomcat-dev-|unsubscribe@jakarta.apache.org>
||For additional
||commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>
||
||



--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message