tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Williams" <ccwillia...@ntlworld.com>
Subject Re: The function for response.encodeURL....me still not sure
Date Wed, 10 Sep 2003 07:55:05 GMT
As I said, the URL-rewriting is done by the container to allow you to use
HTTP sessions when the user of your site has disabled cookies and it does
this by appending ";jessionid=blah-blah-blah" to end of your URLs prior to
the query string ("?blah=stuff&jabber=yakka-yakka...").  This is all in the
servlet spec.  However, you need to give the container the opportunity to do
so and for this you need to use the encodeURL methods of
HttpServletResponse.

Think about your JSPs.  Currently (presumably) you have links like the
following:
    <a href="some_link.jsp">Some link</a>

To enable session tracking without cookies, all you need to do is:
    <a href="<%= response.encodeURL("some_link.jsp") %>">Some link</a>

Likewise, whenever the logic of your page indicates that a redirect is
required, instead of calling:
    response.sendRedirect("some_link.jsp");
you call
    response.sendRedirect(response.encodeRedirectURL("some_link.jsp"));

Check out the J2EE tutorial for examples:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets11.html#63281

Chris.

----- Original Message ----- 
From: "Anson Zeall" <zeallous@bigpond.net.au>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Wednesday, September 10, 2003 2:56 AM
Subject: The function for response.encodeURL....me still not sure


> Hi guys,
>
>     I was asking about the login stuff before from previous emails and
> trying to avoid the use of cookies. Someone in the group asked me to try
and
> use sessions ...using response.encodeURL and stuff. Can someone explain a
> bit more what that does, or is there a site that can explain to me about
> that?
>
>
>
> Thanks,
>
> Anson
>
>


----------------------------------------------------------------------------
----


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



Mime
View raw message