struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Rank <>
Subject Re: Non standard url parameter -- when jsessionid appended [SOLVED]
Date Mon, 05 Mar 2007 21:40:50 GMT
Solved this problem.

By setting the DefaultType directive to "text/html" in Apache's  
httpd.conf, the pages with urls containing the appended ";jsessionid"  
display as html, not plain text.

I should have thought of that before :-)



On Mar 5, 2007, at 2:32 PM, Eric Rank wrote:

> Thanks Michael,
> I was just reading up on the servlet spec and you're right, the  
> jsessionid is not a regular query parameter. Everything that's  
> happening is as according to spec.
> The redirection to the same page when the session cookie is set  
> would work, but only for those who have session cookies enabled.  
> For those who don't have cookies enabled, I suppose I'll need to  
> forward them to a page asking them to turn that feature on.
> ... If the web server would see the response output as text/html,  
> I'd be in business without any of that work. I think I might just  
> set the default type to text/html in the httpd.conf. Hmmm ... [goes  
> to try it out]
> Eric
> On Mar 5, 2007, at 2:19 PM, Michael Jouravlev wrote:
>> From servlet engine point of view, jsessionid is not a query
>> parameter, you can verify that by calling getParameter or
>> getParameterMap on request object, jsessionid is not there.
>> To my mind, the simplest thing one can do is to get rid of jsessionid
>> parameter. To do this you need to have cookies enabled in the  
>> browser.
>> When you make the first request it will be free of session id. On
>> server check for session id cookie, if it is not in the request,
>> perform a redirect to the same URL. From this point on session id  
>> will
>> be passed as a cookie.
>> Michael.
>> On 3/5/07, Eric Rank <> wrote:
>>> Happy Monday everyone. I have a question for you. Hopefully it
>>> doesn't go too far off track.
>>> When I'm using the struts url tag (struts 2) to generate a link, I
>>> get a non standard url parameter, ";jsessionid" appended on the  
>>> first
>>> visit with a new browser session. It seems that this occurs with a
>>> call to the HttpServletResponse.encodeURL method.
>>> I get a URL like this (note the semicolon):
>>> /context/namespace/page.action;jsessionid=xxxx
>>> instead of what I would hope for (question mark replaces the  
>>> semicolon):
>>> /context/namespace/page.action?jsessionid=xxxx
>>> The real problem occurs when I attempt to serve the page through
>>> Apache httpd and mod_jk (running on a httpd / mod_jk / tomcat
>>> environment). I'm guessing that Apache httpd sees the request as a
>>> type of ".action;jsessionid=xxxxxxx"  instead if a type ".action"  
>>> and
>>> serves the resulting content (rendered correctly by tomcat) as plain
>>> text. The ".action" type has been added to the httpd.conf with the
>>> addType directive. All of the session stuff is handled normally with
>>> tomcat.
>>> The question:
>>> Ultimately, how can I get Apache httpd to display the content as
>>> "text/html" when I have a "jsessionid" appended to urls?
>>> Is there something I can configure with httpd.conf?
>>> Is there something I can configure with web.xml?
>>> Is there a way to make the call to the HttpServletResponse.encodeURL
>>> use a question mark instead of a semicolon?
>>> Thanks for your help!
>>> Eric Rank
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message