public boolean service(ServletRequest request, ServletResponse response) throws IOException, ServletException { //stop at the first matching servlet and service for (ServletDefinition servletDefinition : servletDefinitions) { if (servletDefinition.service(request, response)) { return true; } } //there was no match... return false; }
public void testServiceWithContextPath() throws IOException, ServletException { String pattern = "/*"; //some init params Map<String, String> initParams = new ImmutableMap.Builder<String, String>() .put("ahsd", "asdas24dok") .put("ahssd", "asdasd124ok") .build(); final ServletDefinition servletDefinition = new ServletDefinition( Key.get(HttpServlet.class), UriPatternType.get(UriPatternType.SERVLET, pattern), initParams, null); HttpServletResponse servletResponse = createMock(HttpServletResponse.class); HttpServletRequest servletRequest = createMock(HttpServletRequest.class); expect(servletRequest.getContextPath()).andReturn("/a_context_path"); expect(servletRequest.getRequestURI()).andReturn("/test.html"); replay(servletRequest, servletResponse); servletDefinition.service(servletRequest, servletResponse); verify(servletRequest, servletResponse); } }
public boolean service(ServletRequest request, ServletResponse response) throws IOException, ServletException { //stop at the first matching servlet and service for (ServletDefinition servletDefinition : servletDefinitions) { if (servletDefinition.service(request, response)) { return true; } } //there was no match... return false; }
public boolean service(ServletRequest request, ServletResponse response) throws IOException, ServletException { //stop at the first matching servlet and service for (ServletDefinition servletDefinition : servletDefinitions) { if (servletDefinition.service(request, response)) { return true; } } //there was no match... return false; }
public boolean service(ServletRequest request, ServletResponse response) throws IOException, ServletException { //stop at the first matching servlet and service for (ServletDefinition servletDefinition : servletDefinitions) { if (servletDefinition.service(request, response)) { return true; } } //there was no match... return false; }
public boolean service(ServletRequest request, ServletResponse response) throws IOException, ServletException { //stop at the first matching servlet and service for (ServletDefinition servletDefinition : servletDefinitions) { if (servletDefinition.service(request, response)) { return true; } } //there was no match... return false; }
@Override public boolean service(ServletRequest request, ServletResponse response) throws IOException, ServletException { for (ServletDefinition servletDefinition : servletDefinitions()) { if (servletDefinition.service(request, response)) { return true; } } return false; }
@Override public boolean service(ServletRequest request, ServletResponse response) throws IOException, ServletException { for (ServletDefinition servletDefinition : servletDefinitions()) { if (servletDefinition.service(request, response)) { return true; } } return false; }
boolean service(ServletRequest request, ServletResponse response) throws IOException, ServletException { //stop at the first matching servlet and service for (ServletDefinition servletDefinition : servletDefinitions()) { if (servletDefinition.service(request, response)) { return true; } } //there was no match... return false; }