I had the same problem and sorted it thus:

1) Create a new page, say "index_entry.jsp" with the following content (it
is assumed your previous entry point was "index.jsp"):

<HTML>
<HEAD><META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.jsp"></HEAD>
<BODY></BODY>
</HTML>

(Ok, if you have a particularly complex app structure, with modules etc -
then you may need to change above path to index.jsp programmatically).

2) Change your "welcome file" in the app's web.xml to "index_entry.jsp"

...
<welcome-file-list>
  <welcome-file>index_entry.jsp</welcome-file>
</welcome-file-list>
...

3) Explanation (long):

This technique only works for me on tomcat as, tomcat does not seem to send
a session cookie (nor indeed start a session) for the initial request to the
root of the webapp, e.g. http://host.domain.tld/ - it only starts a session
on request to a resource in the webapp, e.g. page/action. This is probably
part of the spec - don't know because I haven't checked yet. NB: This was
using TC 4.0.6 (bundled with netbeans on Windows 2000 with Sun's JDK 1.4.2).

a) NO COOKIE FROM WEBAPP ROOT WITH RETURNED 302
When browsing to http://host.domain.tld/ - a cookie is not sent with the 302
(Moved Temporarily) response that re-directs to the "welcome file", e.g.
"index_entry.jsp". See the following output from nc
(http://www.atstake.com/research/tools/network_utilities/):

X:\>nc 127.0.0.1 8081
GET / HTTP/1.0

HTTP/1.1 302 Moved Temporarily
Content-Type: text/html
Connection: close
Date: Wed, 06 Aug 2003 11:58:11 GMT
Server: Apache Tomcat/4.0.6 (HTTP/1.1 Connector)
Location: http://localhost:8081/index_entry.jsp

<html><head><title>Apache Tomcat/4.0.6 - Error
report</title><STYLE><!--H1{font-
family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;}
BODY
{font-family : sans-serif,Arial,Tahoma;color : black;background-color :
white;}
B{color : white;background-color : #0086b2;} HR{color :
#0086b2;} --></STYLE> </
head><body><h1>Apache Tomcat/4.0.6 - HTTP Status 302 - Moved
Temporarily</h1><HR
 size="1" noshade><p><b>type</b> Status report</p><p><b>message</b> <u>Moved
Tem
porarily</u></p><p><b>description</b> <u>The requested resource (Moved
Temporari
ly) has moved temporarily to a new location.</u></p><HR size="1"
noshade></body>
</html>

b) BROWSER REQUESTS "WELCOME FILE", e.g. "index_entry.jsp"
This time a cookie is sent server->browser with JSESSIONID in it. The server
is not aware yet that the browser can send cookies (as one has not been sent
from browser->server yet) - so if any links in this page use URL Rewriting
then they will have the JSESSIONID appended to ensure session state is
maintained.

X:\>nc 127.0.0.1 8081
GET /index_entry.jsp HTTP/1.0

HTTP/1.1 200 OK
Content-Type: text/html;ISO-8859-1
Connection: close
Date: Wed, 06 Aug 2003 12:04:34 GMT
Server: Apache Tomcat/4.0.6 (HTTP/1.1 Connector)
Set-Cookie: JSESSIONID=5BF64BD681D362A1962D81AF7A3B4362;Path=/

<HTML>
<HEAD><META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.jsp"></HEAD>
<BODY></BODY>
</HTML>

c) BROWSER REQUESTS REAL "WELCOME FILE", e.g. "index.jsp"
This time the cookie is sent browser->server so the server is now aware that
the browser can send cookies. Any links in this page will not now use URL
Rewriting (unless of course browser has cookies disabled).

Well that works for me - hopefully it will help someone else.

Hue.

> -----Original Message-----
> From: Marcel Overdijk [mailto:[EMAIL PROTECTED]
> Sent: 04 August 2003 08:08
> To: [EMAIL PROTECTED]
> Subject: Welcome.do;jsessionid=C36048429636E35FB1ECAA5978E23132
>
>
> Hello,
>
> I never noticed it but when I start my application
> http://localhost:8080/overdijk
> <http://localhost:8080/overdijk/Welcome.do;jsessionid=C36048429636E35FB1
> ECAA5978E23132>  I will be forwarded to Welcome.
>
> Suddenly (I didn't noticed it before) I see some session information in
> my url bar:
> http://localhost:8080/overdijk/Welcome.do;jsessionid=C36048429636E35FB1E
> CAA5978E23132
>
> When I start struts-documentation I don't see this session information.
>
>
> Can anybody explain why this information is displayed ?
>
>
>
> Kind regards,
> Marcel Overdijk
>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.505 / Virus Database: 302 - Release Date: 30/07/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to