1 16 17 package org.apache.tester; 18 19 20 import java.io.*; 21 import javax.servlet.*; 22 import javax.servlet.http.*; 23 24 30 31 public class Forward00 extends HttpServlet { 32 33 34 public void doGet(HttpServletRequest request, HttpServletResponse response) 35 throws IOException, ServletException { 36 37 StringBuffer sb = new StringBuffer (); 39 response.setContentType("text/plain"); 40 PrintWriter writer = response.getWriter(); 41 42 String path = request.getParameter("path"); 44 if (path == null) 45 path = "/Forward00a"; 46 47 RequestDispatcher rd = null; 49 if (path.startsWith("!")) 50 rd = getServletContext().getNamedDispatcher(path.substring(1)); 51 else 52 rd = getServletContext().getRequestDispatcher(path); 53 if (rd == null) { 54 sb.append(" No RequestDispatcher returned/"); 55 } else { 56 if (sb.length() < 1) 57 rd.forward(request, response); 58 } 59 60 if (sb.length() >= 1) { 62 writer.print("Forward00 FAILED -"); 63 writer.println(sb.toString()); 64 while (true) { 65 String message = StaticLogger.read(); 66 if (message == null) 67 break; 68 writer.println(message); 69 } 70 } 71 StaticLogger.reset(); 72 73 } 74 75 } 76 | Popular Tags |