It think that when your webapp is under webapps/cocoon, the cookie-Path is
alway /cocoon.
If you don't want that, then you could run your webapp as webapps/ROOT (your
cookie-path will be /).
For me that's no enought. I modify the JSESSIONID-cookie (and the path) in
the following way:
I've the following in my WEB-INF/web.xml-File
<filter>
<filter-name>RequestWrapper</filter-name>
<filter-class>com.triplemind.asp.server.RequestWrapper</filter-class>
</filter>
<filter-mapping>
<filter-name>RequestWrapper</filter-name>
<servlet-name>Cocoon2</servlet-name>
</filter-mapping>
so that every request to cocoon goes through my RequestWrapper-Class.
In my RequestWrapper I can change the cookies.
public class RequestWrapper implements Filter {
...
public void doFilter(ServletRequest request,
ServletResponse response, FilterChain chain) {
if(request instanceof HttpServletRequest && response instanceof
HttpServletResponse) {
response = new MyHttpResponseWrapper(response);
}
chain.doFilter(request, response);
}
...
}
public class MyHttpResponseWrapper extends HttpServletResponseWrapper {
public void addCookie(Cookie cookie) {
if(cookie.getName().equals("JSESSIONID")) {
cookie.setPath("/whereever-you-want/dir/");
cookie.setDomain("mydomain.com");
// you can also set expiry, etc...
}
super.addCookie(cookie);
}
}
yours
Christoph Gaffga
[EMAIL PROTECTED]
----- Original Message -----
From: "Liam Morley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 14, 2002 4:39 PM
Subject: Re: JSESSIONID had /cocoon as path
> This is new to me. Would you by any chance mind explaining more in
> depth? I'm trying to rewrite the URL so that cocoon is not in the URL,
> but then sessions don't work..
>
> Thank you very much,
> Liam Morley
>
> Christoph Gaffga wrote:
>
> >Hi, i'm looking for a way to change the cookie path also.
> >At the Moment I'm using a filter-Class infront of
> >the cocoon-Servlet and wrap the ServletResponse, but it
> >would be nice to just edit the config file.
> >
> >Christoph Gaffga
> >[EMAIL PROTECTED]
> >
> >
> >----- Original Message -----
> >From: "Liam Morley" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Friday, June 14, 2002 4:21 PM
> >Subject: JSESSIONID had /cocoon as path
> >
> >
> >
> >
> >>Is there a way to edit the path for the JSESSIONID cookie?
> >>
> >>Thanks,
> >>Liam Morley
> >>
> >>
> >>---------------------------------------------------------------------
> >>Please check that your question has not already been answered in the
> >>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> >>
> >>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> >>For additional commands, e-mail: <[EMAIL PROTECTED]>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >Please check that your question has not already been answered in the
> >FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> >
> >To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> >For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>