Tests manipulating The Request Dispatcher.
| Method from org.apache.cactus.sample.servlet.unit.TestRequestDispatcher Detail: |
public void beginGetRequestDispatcherFromRequest2(WebRequest theRequest) {
theRequest.setURL(null, "/test", "/anything.jsp", null, null);
}
Verify that request.getRequestDispatcher() works properly with a
relative path. |
public void endGetRequestDispatcherFromNamedDispatcherOK(WebResponse theResponse) throws IOException {
String result = theResponse.getText();
assertTrue("Page not found, got [" + result + "]",
result.indexOf("Hello !") > 0);
}
Verify that getNamedDispatcher() can be used to get a dispatcher. |
public void endGetRequestDispatcherFromRequest1(WebResponse theResponse) throws IOException {
String result = theResponse.getText();
assertTrue("Page not found, got [" + result + "]",
result.indexOf("Hello !") > 0);
}
Verify that request.getRequestDispatcher() works properly with an
absolute path |
public void endGetRequestDispatcherFromRequest2(WebResponse theResponse) throws IOException {
String result = theResponse.getText();
assertTrue("Page not found, got [" + result + "]",
result.indexOf("Hello !") > 0);
}
Verify that request.getRequestDispatcher() works properly with a
relative path. |
public void testGetRequestDispatcherFromNamedDispatcherInvalid() throws IOException, ServletException {
RequestDispatcher rd = config.getServletContext().getNamedDispatcher(
"invalid name");
assertNull(rd);
}
Verify that getNamedDispatcher() returns null when passed an invalid
name. |
public void testGetRequestDispatcherFromNamedDispatcherOK() throws IOException, ServletException {
RequestDispatcher rd = config.getServletContext().getNamedDispatcher(
"TestJsp");
assertNotNull("Missing configuration for \"TestJsp\" in web.xml", rd);
rd.forward(request, response);
}
Verify that getNamedDispatcher() can be used to get a dispatcher. |
public void testGetRequestDispatcherFromRequest1() throws IOException, ServletException {
RequestDispatcher rd = request.getRequestDispatcher("/test/test.jsp");
rd.include(request, response);
}
Verify that request.getRequestDispatcher() works properly with an
absolute path |
public void testGetRequestDispatcherFromRequest2() throws IOException, ServletException {
RequestDispatcher rd = request.getRequestDispatcher("test/test.jsp");
rd.include(request, response);
}
Verify that request.getRequestDispatcher() works properly with a
relative path. |