You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Julian Kerr <ju...@niseko-backpacker.com> on 2005/07/01 07:14:55 UTC

How to disable URL rewriting for session id?

Dear All,

The html:link tag automatically applies URL rewriting to maintain 
session state in the absence of cookies. Is it possible to disable this 
feature?

[I'm using Resin in a shared environment. Resin considers the sessionid 
as part of the URL address, and hence I get 404 errors.]

Also, as an aside, even if cookies are accepted by the browser, I've 
noticed that sessionid still periodically appears in the URL. Is this to 
be expected??

Cheers.

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


Re: How to disable URL rewriting for session id?

Posted by Julian Kerr <ju...@niseko-backpacker.com>.
David G. Friedman wrote:

>I just skimmed through cvs and have this idea for you:
>
>Edit a copy of the Html Taglib's helper class,
>org.apache.struts.taglibs.TagUtils, so any methods
>that would pull in the session variable to append to
>the new URL don't do that.  When it's built, put
>it under WEB-INF/classes/org/apache/struts/taglibs
>so Struts calls YOUR class, not the original.
>  
>

David,

Nice plan!

I basically did as you suggested, and automatic URL rewriting no longer 
takes place.

(Removed calls to HttpServletResponse.encodeURL within 
org.apache.struts.taglib.TagUtils and org.apache.struts.taglib.html.FormTag)

Thanks,
Julian

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


RE: How to disable URL rewriting for session id?

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Julian,

I just skimmed through cvs and have this idea for you:

Edit a copy of the Html Taglib's helper class,
org.apache.struts.taglibs.TagUtils, so any methods
that would pull in the session variable to append to
the new URL don't do that.  When it's built, put
it under WEB-INF/classes/org/apache/struts/taglibs
so Struts calls YOUR class, not the original.

I recommend reviewing the public Map computeParameters
method right after the comment:
// Add our transaction control token (if requested)

I'm sure older versions have some similar helper class
you can override with your own, for now.

FYI, to view this file on the web from the CVS/SVN repository, follow (this
will be wrapped, so you'll have to cut and paste it):
http://svn.apache.org/viewcvs.cgi/struts/taglib/trunk/src/java/org/apache/st
ruts/taglib/TagUtils.java?rev=202155&view=markup

Regards,
David

-----Original Message-----
From: Julian Kerr [mailto:julian@niseko-backpacker.com]
Sent: Monday, July 04, 2005 1:25 AM
To: Struts Users Mailing List
Subject: Re: How to disable URL rewriting for session id?


Ahh, the problem spreadeth... also need to use plain old forms, which
means no struts help there either.

Guess this boils down to either finding a way to tell struts to stop
rewriting url's, or another moving to another context...

Julian


Wendy Smoak wrote:

>From: "Julian Kerr" <ju...@niseko-backpacker.com>
>
>
>>A plain old html link would do the trick, but I'm keen to know if there
>>is a way to control the behaviour struts tags.
>>
>>
>>
>
>Just based on the docs, I'd say no... but I haven't looked any further than
>that.
>
>http://struts.apache.org/userGuide/struts-html.html#link
>     says
>" URL rewriting will be applied automatically, to maintain session state in
>the absence of cookies. "
>
>Can you do URL-rewriting-in-reverse on the front end, and strip off the
>;jsessionid on the way in, before it causes a problem?
>
>Otherwise a plain old HTML link sounds like the way to go.
>
>
>


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


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


Re: How to disable URL rewriting for session id?

Posted by Julian Kerr <ju...@niseko-backpacker.com>.
Ahh, the problem spreadeth... also need to use plain old forms, which 
means no struts help there either.

Guess this boils down to either finding a way to tell struts to stop 
rewriting url's, or another moving to another context...

Julian


Wendy Smoak wrote:

>From: "Julian Kerr" <ju...@niseko-backpacker.com>
>  
>
>>A plain old html link would do the trick, but I'm keen to know if there
>>is a way to control the behaviour struts tags.
>>
>>    
>>
>
>Just based on the docs, I'd say no... but I haven't looked any further than
>that.
>
>http://struts.apache.org/userGuide/struts-html.html#link
>     says
>" URL rewriting will be applied automatically, to maintain session state in
>the absence of cookies. "
>
>Can you do URL-rewriting-in-reverse on the front end, and strip off the
>;jsessionid on the way in, before it causes a problem?
>
>Otherwise a plain old HTML link sounds like the way to go.
>
>  
>


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


Re: How to disable URL rewriting for session id?

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Julian Kerr" <ju...@niseko-backpacker.com>
>
> A plain old html link would do the trick, but I'm keen to know if there
> is a way to control the behaviour struts tags.
>

Just based on the docs, I'd say no... but I haven't looked any further than
that.

http://struts.apache.org/userGuide/struts-html.html#link
     says
" URL rewriting will be applied automatically, to maintain session state in
the absence of cookies. "

Can you do URL-rewriting-in-reverse on the front end, and strip off the
;jsessionid on the way in, before it causes a problem?

Otherwise a plain old HTML link sounds like the way to go.

-- 
Wendy Smoak


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


Re: How to disable URL rewriting for session id?

Posted by Julian Kerr <ju...@niseko-backpacker.com>.
Michael Jouravlev wrote:

>On 6/30/05, Julian Kerr <ju...@niseko-backpacker.com> wrote:
>  
>
>>The html:link tag automatically applies URL rewriting to maintain
>>session state in the absence of cookies. Is it possible to disable this
>>feature?
>>    
>>
>
>Have you tried   <%@ page session="false" %>   ?
>
>Michael.
>  
>

I am using sessions, but track them with cookies.

I'd like to disable url rewriting because of the combination of:
1) empirical testing shows that url rewriting sometimes occurs even when 
cookies are enabled
2) my context doesn't deal with rewritten url's (as described in the 
initial post)

If I can turn url rewriting off, the application will work in the given 
context for people with cookies enabled.

A plain old html link would do the trick, but I'm keen to know if there 
is a way to control the behaviour struts tags.

-- Julian

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


Re: How to disable URL rewriting for session id?

Posted by Michael Jouravlev <jm...@gmail.com>.
On 6/30/05, Julian Kerr <ju...@niseko-backpacker.com> wrote:
> The html:link tag automatically applies URL rewriting to maintain
> session state in the absence of cookies. Is it possible to disable this
> feature?

Have you tried   <%@ page session="false" %>   ?

Michael.

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