This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes URL rewriting ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "URL rewriting ?" Watch "URL rewriting ?" New topic
Author

URL rewriting ?

Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
What is URL rewriting ?
Suneel Setlur
Ranch Hand

Joined: Nov 26, 2000
Posts: 202
Hi
We track sessions 2 ways.
1. Cookies
2. URL Rewriting.
URL Rewriting is a method used to track sessions when the browser being used by the client does not support cookies.In this process, all links and redirections during the client session must be encoded to include session ID as part of the URL.
Hope this helps
Regards
Suneel
[This message has been edited by Suneel Setlur (edited January 27, 2001).]


Suneel
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

Suneel Setlur,
Could you give some sort of example of URL rewriting?

SCJP
Visit my download page
Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
Please do provide examples. It will be more clear
Thanks
Hari Haran
Greenhorn

Joined: Sep 21, 2000
Posts: 19
Check out this site. http://www.jguru.com/jguru/faq/view.jsp?EID=1045
There is a clear explanation and a simple example.
Hope this helps!!
Happy Coding!!
Suneel Setlur
Ranch Hand

Joined: Nov 26, 2000
Posts: 202
Hi Randall,Bharatesh
Hari has given you an example which demostrates URL rewriting.
Note that you cannot use URL Rewriting with static HTML pages as the URL must be encoded for each user to include the session Id.
The way in which it is encoded is server specific, but will be like added information or parameters.

Regards
Suneel
vani
Greenhorn

Joined: Jan 29, 2001
Posts: 5
Hi Sunnel
We track sessions in 4 ways.

1. Cookies
2. URL Rewriting.
3.Client Authentication.
4.Hidden form Fields.
Depending on the requirment,keeping in mind the security part the required one is selected.
e.g...
When u r working on a B2B portal u need to know the clients list and also vendor's list.Different screen's for different login.which can bo done by Client Authenticationi.e...by his ID & password.
Originally posted by Suneel Setlur:
Hi
We track sessions 2 ways.
1. Cookies
2. URL Rewriting.
URL Rewriting is a method used to track sessions when the browser being used by the client does not support cookies.In this process, all links and redirections during the client session must be encoded to include session ID as part of the URL.
Hope this helps
Regards
Suneel
[This message has been edited by Suneel Setlur (edited January 27, 2001).]

Hari Haran
Greenhorn

Joined: Sep 21, 2000
Posts: 19
Hi Guys,
We have to code JSP pages which will work even if cookies is disabled.I am using EncodeUrl and it is working.

Eg:
===
String EncodeUrlModify = response.encodeUrl("modify.jsp?MenuOption=2&SubMenuOption=4");
document.frm.action="<%=EncodeUrlModify%>";
<a href="<%=EncodeUrlModify%>">

But,In the places where I use sendredirect, I used
response.encodeRedirectURL()
But it doesn't seem to work properly.
Please help me out.
Regards,
Hari
Suneel Setlur
Ranch Hand

Joined: Nov 26, 2000
Posts: 202
Hi Vani
Originally posted by vani:
Hi Sunnel
We track sessions in 4 ways.

1. Cookies
2. URL Rewriting.
3.Client Authentication.
4.Hidden form Fields.
Depending on the requirment,keeping in mind the security part the required one is selected.
e.g...
When u r working on a B2B portal u need to know the clients list and also vendor's list.Different screen's for different login.which can bo done by Client Authenticationi.e...by his ID & password.

Clients are identified using session Ids. To maintain(persist) unique identities we use cookies or URL rewriting.
Please elaborate on session tracking thru hidden fields.
-----------------------------------------------------------
Hari
Import java.net.* and try using URlEncoder.encode(String).
Please get back after trying.
Regards
Suneel

[This message has been edited by Suneel Setlur (edited January 29, 2001).]
Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
Thanks all. Thanks also for a very good example urlsession.java for getting the basic understanding of url rewriting.
I have modified urlsession.java slightly for better understanding:

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: URL rewriting ?
 
Similar Threads
Session Tracking in WAP
redirecting the request to URL
URL same
JSP/form/servlet - session persistence ?
Know technique for dynamic URL change