FileDocCategorySizeDatePackage
UrlRewrite.javaAPI DocExample1160Wed Feb 11 14:30:14 GMT 2004com.jspservletcookbook

UrlRewrite

public class UrlRewrite extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        
        response.setContentType("text/html");
        java.io.PrintWriter out = response.getWriter();
        String contextPath = request.getContextPath();
        String encodedUrl =  response.encodeURL(contextPath + "/default.jsp");
       
        out.println("<html>");
        out.println("<head>");
        out.println("<title>URL Rewriter</title>");  
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>This page will use URL rewriting if necessary</h2>");
        out.println("Go to the default.jsp page <a href=\"" + encodedUrl + 
            "\">here</a>.");
        out.println("</body>");
        out.println("</html>");
      
  
public voiddoPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

	    doGet(request,response);