GeeCON Prague 2014*
The moose likes Servlets and the fly likes Servlet Context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Context" Watch "Servlet Context" New topic
Author

Servlet Context

Gregory Bonk
Greenhorn

Joined: Aug 14, 2002
Posts: 1
Why does the serlvet context appear to change when I access the same server with a different URL? If I refer to a server like http://127.0.0.1/index.jsp I will have a different servlet context from http://localhost/index.jsp when they are clearly accessing the same machine. Session attributes are different.
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
The same machine can have many application thus many ServletContext.
However I think both 127.0.0.1/index and localhost/index should belong the default application.
Can you give more details?


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Mario Rendon
Greenhorn

Joined: Jul 11, 2002
Posts: 24
Well i have had that problem before ..

the session context is based on the Server "the browser sees"
sine the session is saved on a cookie called jsessionid this cookie is set to act on the context of the Server name .

that's why the context in localhost and yourmachinename.com are different..

also if you try autentications ( that is also a cookie ) are based on the same schema

Maybe it could be possible; if needed, to pass along the session ID to have the same context.

Grettings .
 
GeeCON Prague 2014
 
subject: Servlet Context