• Post Reply Bookmark Topic Watch Topic
  • New Topic

URL rewriting  RSS feed

Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use the following jsp to test url rewriting. I set my ie browser privacy to block all cookies and open a new browser. After I run this jsp, I get "from cookie" on the page. Why I can't get "from url"? I can't see session id after url. I need help. Thanks.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page
contentType="text/html; charset=ISO-8859-1"
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<%session = request.getSession(true);
if (request.isRequestedSessionIdFromCookie()) {
out.println("from Cookies ");
} else if (request.isRequestedSessionIdFromURL()) {
out.println("from url");
if (session.isNew()) {
session.setAttribute("COUNTER_KEY", new int[] { 0 });
int[] count = (int[]) session.getAttribute("COUNTER_KEY");
//putting the count back into session
out.println("<h2>URL ReWriting</h2>");
out.println("Your Session Id is <b>" + session.getId() + "</b><br>");
"You have hit this page <b>"
+ count[0]
+ " </b>times during this browser session<br>");
String url = request.getRequestURI();
out.println("<form method=post action=\"" + response.encodeURL(url) + "\">");
out.println("<br><input type=submit name=submit value=Hit>");
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!