@Test void testForward() throws Exception { TestWebApplicationRequest request = new TestWebApplicationRequest(); TestWebApplicationResponse response = new TestWebApplicationResponse(); DefaultWebApplication webApp = new DefaultWebApplication(); webApp.addServlet("Snoop", TestSnoopServlet.class); webApp.initialize(); webApp.start(); RequestDispatcher dispatcher = webApp.getNamedDispatcher("Snoop"); dispatcher.forward(request, response); String responseText = new String(response.getResponseBytes()); webApp.stop(); assertTrue(responseText.contains("<title>Snoop</title>")); }
@Override public void forward(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { if (servletRequest.getDispatcherType().equals(ASYNC)) { asyncForward(servletRequest, servletResponse); return; } syncForward(servletRequest, servletResponse); }
DefaultServletRequestDispatcher implements RequestDispatcher { @Override public void forward(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { if (servletRequest.getDispatcherType().equals(ASYNC)) { asyncForward(servletRequest, servletResponse); return; } syncForward(servletRequest, servletResponse); } }
DefaultServletRequestDispatcher implements RequestDispatcher { @Override public void forward(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { if (servletRequest.getDispatcherType().equals(ASYNC)) { asyncForward(servletRequest, servletResponse); return; } syncForward(servletRequest, servletResponse); } DefaultServletRequestDispatcher(DefaultServletInvocation servletInvocation, DefaultWebApplication webApplication); }
DefaultServletRequestDispatcher implements RequestDispatcher { @Override public void forward(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { if (servletRequest.getDispatcherType().equals(ASYNC)) { asyncForward(servletRequest, servletResponse); return; } syncForward(servletRequest, servletResponse); } DefaultServletRequestDispatcher(DefaultServletInvocation servletInvocation, DefaultWebApplication webApplication); void request(DefaultWebApplicationRequest webappRequest, DefaultWebApplicationResponse httpResponse); @Override void forward(ServletRequest servletRequest, ServletResponse servletResponse); @Override void include(ServletRequest servletRequest, ServletResponse servletResponse); void error(String servletName, ServletRequest servletRequest, ServletResponse servletResponse, Throwable throwable); }
DefaultServletRequestDispatcher implements RequestDispatcher { @Override public void forward(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { if (servletRequest.getDispatcherType().equals(ASYNC)) { asyncForward(servletRequest, servletResponse); return; } syncForward(servletRequest, servletResponse); } DefaultServletRequestDispatcher(DefaultServletInvocation servletInvocation, DefaultWebApplication webApplication); void request(DefaultWebApplicationRequest webappRequest, DefaultWebApplicationResponse httpResponse); @Override void forward(ServletRequest servletRequest, ServletResponse servletResponse); @Override void include(ServletRequest servletRequest, ServletResponse servletResponse); void error(String servletName, ServletRequest servletRequest, ServletResponse servletResponse, Throwable throwable);  }