You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Heiko Seeberger <he...@gmx.de> on 2000/04/10 17:57:26 UTC

Session Tracking by URL rewriting

Hi,

I wonder if it is possible do maintain sessions over serveral pages without
enabling cookies.
Does Tomcat 3.1 support sessions by URL rewriting? If so, how?

Thanks.

Heiko



Re: Session Tracking by URL rewriting

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Heiko Seeberger wrote:

> Hi,
>
> I wonder if it is possible do maintain sessions over serveral pages without
> enabling cookies.
> Does Tomcat 3.1 support sessions by URL rewriting? If so, how?
>

Yes, in the most recent releases of 3.1beta1, and it will be in the final
release.

You do this exactly as the servlet spec tells you to -- by calling
response.encodeURL() or response.encodeRedirectURL() around all the hyperlinks
you generate in your servlet or JSP page.  For example, in a servlet:

    PrintWriter writer = response.getWriter();
    ...
    writer.println("<a href=\"" + response.encodeURL("my-url") + "\">My
Link</a>");

or in a JSP page

    <a href="<%= response.encodeURL("my-url") %>">My Link</a>

>
> Thanks.
>
> Heiko
>

Craig McClanahan