1 16 package org.directwebremoting.servlet; 17 18 import java.io.IOException ; 19 import java.io.PrintWriter ; 20 21 import javax.servlet.http.HttpServletRequest ; 22 import javax.servlet.http.HttpServletResponse ; 23 24 import org.directwebremoting.extend.DebugPageGenerator; 25 import org.directwebremoting.extend.Handler; 26 import org.directwebremoting.util.LocalUtil; 27 import org.directwebremoting.util.MimeConstants; 28 29 33 public class TestHandler implements Handler 34 { 35 38 public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException 39 { 40 String scriptName = request.getPathInfo(); 41 scriptName = LocalUtil.replace(scriptName, testHandlerUrl, ""); 42 scriptName = LocalUtil.replace(scriptName, "/", ""); 43 44 String page = debugPageGenerator.generateTestPage(request.getContextPath() + request.getServletPath(), scriptName); 45 46 response.setContentType(MimeConstants.MIME_HTML); 47 PrintWriter out = response.getWriter(); 48 out.print(page); 49 } 50 51 55 public void setDebugPageGenerator(DebugPageGenerator debugPageGenerator) 56 { 57 this.debugPageGenerator = debugPageGenerator; 58 } 59 60 63 protected DebugPageGenerator debugPageGenerator = null; 64 65 69 public void setTestHandlerUrl(String testHandlerUrl) 70 { 71 this.testHandlerUrl = testHandlerUrl; 72 } 73 74 77 protected String testHandlerUrl; 78 } 79 | Popular Tags |