Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

response.encodeURL() not working  RSS feed

 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given this code

Initially i requested this jsp with cookies enabled when it was working fine. Later when i disabled cookies for the host on my browser and tried accessing it, it appears that the response.encodeURL is not appending the suffix for session handling because of which the page is showing "new session" for all subsequent requests.
I am using Apache Tomcat/5.0.16 running on one machine and accessing the JSP from another machine with MS Internet Explorer 6.0.2800
What can be the problem?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using the Privacy slider to disable cookies ? Be careful that under IE6, the Privacy slider is designed to work only in the Internet zone. All cookies are automatically accepted from Web sites in both the Local Intranet and Trusted zones,
and all cookies are automatically blocked from Web sites in the Restricted zone.
 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didnt use the slider for setting the security level.
Internet Explorer 6 provides a small section named "web sites" which enables you to list sites for which the user wants to override cookie handling. I mentioned the host and put it into "always block" mode.
Cookies are getting blocked which I was able to verify by seeing the small symbol in the status bar with an eye which indicates that cookies are not being sent.
I also verified that since i am accessing the page from some other machine, the status bar shows that the page is coming from internet zone.
I cant figure out why the URL is not getting encoded with the jsessionid
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I'm not using IE, so I can't tell much about it.
Did you try under Firefox ?
 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah I tried it on firefox and it runs fine. I even tried it on another version of MS IE not sure about the version probably its 5.something coz it was a friends machine and it worked fine there too.
Its having a problem with IE only somehow.
Is it possible for tomcat to somehow save the information that cookies are not blocked from a particular client so it will ignore the encodeURL request for all requests going to that client?
I cant figure out why the session handling suffix is not coming for this client only but for all others it will come.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible for tomcat to somehow save the information that cookies are not blocked from a particular client so it will ignore the encodeURL request for all requests going to that client?

No, I think the problem is from the client. It must be something with the settings. Try to download a javascript source somewhere, which checks if cookies are enabled or not. It might help to understand whether cookies are really disabled.

http://techpatterns.com/downloads/javascript_check_cookies.php
 
mak pandian
Ranch Hand
Posts: 30
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys I have had the same problem.

I just tried the way how HFSJ explained response.encodeURL(). But It did not work for me as well. I used Tomcat 7 and Servlet 3.0.

The syntax in book that did not work is

out.println(“<a href=’” + response.encodeURL(“/BeerTest.do”)+ “‘>click me</a>”);

The only change I made is just to remove slash in the parameter of encodeURL. Here is my try

out.println(“<a href=’” + response.encodeURL(“BeerTest.do”)+ “‘>click me</a>”);

It works fine for me and I assume when we use encodeURL, we do not need to use slash in the parameter.

Thanks
Pandian
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!