• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URL Rewriting

 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to test how URL Rewrite is working? How we can do this? I disabled the cookies in IE, but i don't find the jsessionid in the url... any sample examples...on how to do this?

I tried the below example:
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It can't do the URL encoding the first time it is accessed, because it doesn't yet know that the browser doesn't accept cookies. But on the second access it should add the session ID in there.

But note that your code doesn't open a session, so there's no point in adding a session ID for a non-existing session.
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where in your code are you asking the container for a session?? Add the line HttpSession session = request.getSession() and then you will find the JSessionID in your url.
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now I have included the session, but still I don't get the jsessionid in the url.. Also I prompt for the cookies in IE..if I am opening any other site. it's asking whether I allow/block the cookies and some sites don't prompt for it?


 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's strange. I tried the code with Tomcat and it created a session ID on the very first access. Does your servlet container maybe have settings for enabling/disabling cookies and/or URL rewriting?
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using WebSphere and on server side I can enable or disable URL writing. May be you can check on your server too.
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using Tomcat5.5.20..
To disable cookies in the tomcat server, I have added cookies="false" in the context.xml file in the conf folder, as mentioned by this site (which is searched in google, for diabling the cookies):
web page

And also I have blocked the cookies option in privacy tab for IE..

But still icouldn't see the jsessionid in my url.. why?

In my index.jsp, I am having the link for the above mentioned servlet and the servlet is having the link to the index.jsp page again...
My doubt is whether URL Rewriting has been used correctly by me for the above pgm.

And I have another doubt, when will the URL Rewriting wil come into the picture..only when the cookies are disabled? correct?..but I have gone to sun site to download some docs in JTA, and my browser cookies are allowed, but still the url has jsessionid like below:
https://sdlc3b.sun.com/ECom/EComActionServlet;jsessionid=3D7A3D240421BA1B8CCE9D2F82323DEF
how it is possible?

whether we can come to conclusion that if we have the url that has jsessionid then it is url rewriting and cookies is not working?
[ January 01, 2007: Message edited by: Micheal John ]
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ranchers... any suggestions... for my post
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not so much a question of cookies working or not, but a question of whether the server is configured to use them. Most servlet containers have a setting to always use URL rewriting, regardless of whether cookies would work or not.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic