You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sergey Sushkov <se...@arcus.lv> on 2000/04/16 11:31:01 UTC
URL encoded sessions
Hallo!
A while ago I have implemented a session trackig by using only URL
encoded sessions (That was a requirement). As long as I used
internal mini-script library for creating output - I have made Apache
rewrite rule like this:
RewriteRule ^/__([^/]+)/(.*) /servlet/Handler?JServSessionId=$1 [PT,QSA]
what gaved me an ability to specify session ID directly in request URI:
http://localhost/__389739394537/start.abc
The main advantage of this technique is that I need session ID only once:
when creating a session, every next request is mage with relative URL,
and there is no need to encode EVERY link URL.
As you can see I used JServ for that. As long as Tomcat is a successor of
JServ, and above all it gives connectors to Netscape and IIS, I would like
to implement URL-only session tracking (similar to above) with Tomcat.
To stay independent from WEB server I cannot use Apache mod_rewrite
anymore. The idea to write own session tracking is a bit odd.
To be more detailed:
Servlet 'Handler' handles file types '*.abc'
I have possibility to encode url and session id like this:
/index.abc;jsessionid=SESSION_ID
Is it possible to come from URI like this;
/__SESSIONID/index.abc
to the one Tomcat supports?
Maybe I am totally wrong with an approach, but it seems to be the only
way not to encode every link URL.
Any ideas?
__
sooh
Re: URL encoded sessions
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Sergey Sushkov wrote:
> Hallo!
>
> A while ago I have implemented a session trackig by using only URL
> encoded sessions (That was a requirement). As long as I used
> internal mini-script library for creating output - I have made Apache
> rewrite rule like this:
>
> RewriteRule ^/__([^/]+)/(.*) /servlet/Handler?JServSessionId=$1 [PT,QSA]
>
> what gaved me an ability to specify session ID directly in request URI:
>
> http://localhost/__389739394537/start.abc
>
That's a pretty cute trick. For Tomcat (or any other servlet container that
conforms to the 2.2 spec), the URL you want to transform this into is:
http://localhost/start.abc;jsessionid=389739394537
so I'm sure you could set up a rewrite rule to create it. If you have any
query parameters, they go *after* the session id.
Craig McClanahan
Re: URL encoded sessions
Posted by Duane Fields <du...@deepmagic.com>.
One other possibility is to create a custom JSP tag that generates your
link, adding the session ID information as necessary. Of course then every
page must be a JSP...
--
Duane Fields
duane@deepmagic.com
Learn Web Development with JSP!
http://www.taglib.com