aspose file tools*
The moose likes Servlets and the fly likes url rewriting doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "url rewriting doubt" Watch "url rewriting doubt" New topic
Author

url rewriting doubt

yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
URL-rewriting is a way of maintaining a session between an HTTP client and a servlet container which does not use cookies. Rather than exchange a session ID in a cookie, the servlet container includes it in the hyperlink URLs it generates for servlets and JSP.

my doubt is when a servlet returns with URL rewritten. where is the information stored if the cookies are disabled??

how is session tracking happening here??

please can anyone explain how is the session tracking happening??

like for cookie i know that
1> cookies are in server side which are sent to the client side when requested for the first time and is stored in the client machine
2>when the next request is made to the same web server. the stored cookie information will be used.

similarly what happens in URLREWRITING?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

The session key becomes part of the URL.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

With URL rewriting, Server uses a key for session tracking. that key is appended to the url as query string. When request is made by clicking on the URL that session key will be available.


[Servlet tutorial] [Servlet 3.0 Cook Book]
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
so you mean to say that the server will append the session key.

ok then that will be passed to the client.

but if the cookies are disabled then. with the next clent request how will the server identify that the client is same??
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707

but if the cookies are disabled then. with the next clent request how will the server identify that the client is same??[/QB]


Hi,

Session object is created on the server, the session id is appended on the url, this is the way of tracking the client. No cookie involved in that.


cmbhatt
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
thanks chandra,

so nothing is stored in the clients computer right?? in case of URLReWRITING??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

The pages, including the URLs with session key appended, could be cached by the browser.
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
ok. Thanks. for the quick reply
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
so for example if its a shopping cart example.

then url will be increasing in length as we add more items right?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

No. Why would you think that?
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
ok.

but where is the session key generated??
in the client side or the server side??
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by yuvraj kotegar:
ok.

but where is the session key generated??
in the client side or the server side??


session is create and strore in server side
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Originally posted by yuvraj kotegar:
ok.

but where is the session key generated??
in the client side or the server side??


The data for the session gets added to the server side session. The server creates a jsessionid for the user's session, and only that jsessionid is appended to the URLs when you url-rewrite. When the user makes a new request the server sees that jsessionid and looks up the proper Session to attach to the server-side request.


Steve
 
jQuery in Action, 2nd edition
 
subject: url rewriting doubt