@Test public void aliasMiss() throws Exception { AliasHandler handler = new AliasHandler(commandProcessor, true, pathAliases); Continuation continuation = mock(Continuation.class); when(request.getAttribute(Continuation.ATTRIBUTE)).thenReturn(continuation); handler.handle("/missPath", baseRequest, request, response); verify(commandProcessor, times(1)).process(any(HttpCommand.class)); }
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (pathAliases.containsKey(target)) { String newTarget = pathAliases.get(target); ServletContext context = request.getServletContext().getContext(newTarget); String newPath = newTarget.substring(context.getContextPath().length()); context.getRequestDispatcher(newPath).forward(request, response); return; } super.handle(target, baseRequest, request, response); }
AliasHandler extends JettyHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (pathAliases.containsKey(target)) { String newTarget = pathAliases.get(target); ServletContext context = request.getServletContext().getContext(newTarget); String newPath = newTarget.substring(context.getContextPath().length()); context.getRequestDispatcher(newPath).forward(request, response); return; } super.handle(target, baseRequest, request, response); } }
AliasHandler extends JettyHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (pathAliases.containsKey(target)) { String newTarget = pathAliases.get(target); ServletContext context = request.getServletContext().getContext(newTarget); String newPath = newTarget.substring(context.getContextPath().length()); context.getRequestDispatcher(newPath).forward(request, response); return; } super.handle(target, baseRequest, request, response); } AliasHandler(TransportCommandProcessor<HttpCommand> commandProcessor, boolean suppressCommasInAccessLog, Map<String, String> pathAliases); }
AliasHandler extends JettyHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (pathAliases.containsKey(target)) { String newTarget = pathAliases.get(target); ServletContext context = request.getServletContext().getContext(newTarget); String newPath = newTarget.substring(context.getContextPath().length()); context.getRequestDispatcher(newPath).forward(request, response); return; } super.handle(target, baseRequest, request, response); } AliasHandler(TransportCommandProcessor<HttpCommand> commandProcessor, boolean suppressCommasInAccessLog, Map<String, String> pathAliases); @Override void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response); }
AliasHandler extends JettyHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (pathAliases.containsKey(target)) { String newTarget = pathAliases.get(target); ServletContext context = request.getServletContext().getContext(newTarget); String newPath = newTarget.substring(context.getContextPath().length()); context.getRequestDispatcher(newPath).forward(request, response); return; } super.handle(target, baseRequest, request, response); } AliasHandler(TransportCommandProcessor<HttpCommand> commandProcessor, boolean suppressCommasInAccessLog, Map<String, String> pathAliases); @Override void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response);  }