@Test public void testHandle2() throws Exception { when(request.getContextPath()).thenReturn(PROTOCOL_BINDING_CONTEXT + "/someotherurl"); jettyHandler.handle(null, jettyRequest, request, response); ArgumentCaptor<HttpCommand> commandArgumentCaptor = ArgumentCaptor.forClass(HttpCommand.class); verify(commandProcessor).process(commandArgumentCaptor.capture()); HttpCommand command = commandArgumentCaptor.getValue(); assertNull("Should not have an IdentityTokenResolver set", command.getIdentityTokenResolver()); }
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setHeader("Server", VERSION_HEADER); try { IdentityTokenResolver itr = null; if (identityTokenResolverLookup != null) { itr = identityTokenResolverLookup.lookupIdentityTokenResolver(baseRequest.getRequestURI()); } JettyTransportCommand command = new JettyTransportCommand(request, response, itr); if (!command.getContinuation().isExpired()) { LOGGER.debug("Message Received at Jetty Handler for path {}", target); commandProcessor.process(command); } else { LOGGER.debug("Message Timeout at Jetty Handler for path {}", target); response.sendError(HttpServletResponse.SC_GATEWAY_TIMEOUT); } } catch (CougarException ce) { LOGGER.warn("Cougar Exception thrown processing request", ce); response.sendError(ResponseCodeMapper.getHttpResponseCode(ce.getResponseCode())); } catch (Exception e) { LOGGER.error("Unexpected Exception thrown processing request", e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { baseRequest.setHandled(true); } }
JettyHandler extends AbstractHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setHeader("Server", VERSION_HEADER); try { IdentityTokenResolver itr = null; if (identityTokenResolverLookup != null) { itr = identityTokenResolverLookup.lookupIdentityTokenResolver(baseRequest.getRequestURI()); } JettyTransportCommand command = new JettyTransportCommand(request, response, itr); if (!command.getContinuation().isExpired()) { LOGGER.debug("Message Received at Jetty Handler for path {}", target); commandProcessor.process(command); } else { LOGGER.debug("Message Timeout at Jetty Handler for path {}", target); response.sendError(HttpServletResponse.SC_GATEWAY_TIMEOUT); } } catch (CougarException ce) { LOGGER.warn("Cougar Exception thrown processing request", ce); response.sendError(ResponseCodeMapper.getHttpResponseCode(ce.getResponseCode())); } catch (Exception e) { LOGGER.error("Unexpected Exception thrown processing request", e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { baseRequest.setHandled(true); } } }
JettyHandler extends AbstractHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setHeader("Server", VERSION_HEADER); try { IdentityTokenResolver itr = null; if (identityTokenResolverLookup != null) { itr = identityTokenResolverLookup.lookupIdentityTokenResolver(baseRequest.getRequestURI()); } JettyTransportCommand command = new JettyTransportCommand(request, response, itr); if (!command.getContinuation().isExpired()) { LOGGER.debug("Message Received at Jetty Handler for path {}", target); commandProcessor.process(command); } else { LOGGER.debug("Message Timeout at Jetty Handler for path {}", target); response.sendError(HttpServletResponse.SC_GATEWAY_TIMEOUT); } } catch (CougarException ce) { LOGGER.warn("Cougar Exception thrown processing request", ce); response.sendError(ResponseCodeMapper.getHttpResponseCode(ce.getResponseCode())); } catch (Exception e) { LOGGER.error("Unexpected Exception thrown processing request", e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { baseRequest.setHandled(true); } } JettyHandler(final TransportCommandProcessor<HttpCommand> commandProcessor, boolean suppressCommasInAccessLog);  JettyHandler(final TransportCommandProcessor<HttpCommand> commandProcessor,
                        final JettyHandlerSpecification spec,
                        final IdentityTokenResolverLookup identityTokenResolverLookup,
                        boolean suppressCommasInAccessLog); }
JettyHandler extends AbstractHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setHeader("Server", VERSION_HEADER); try { IdentityTokenResolver itr = null; if (identityTokenResolverLookup != null) { itr = identityTokenResolverLookup.lookupIdentityTokenResolver(baseRequest.getRequestURI()); } JettyTransportCommand command = new JettyTransportCommand(request, response, itr); if (!command.getContinuation().isExpired()) { LOGGER.debug("Message Received at Jetty Handler for path {}", target); commandProcessor.process(command); } else { LOGGER.debug("Message Timeout at Jetty Handler for path {}", target); response.sendError(HttpServletResponse.SC_GATEWAY_TIMEOUT); } } catch (CougarException ce) { LOGGER.warn("Cougar Exception thrown processing request", ce); response.sendError(ResponseCodeMapper.getHttpResponseCode(ce.getResponseCode())); } catch (Exception e) { LOGGER.error("Unexpected Exception thrown processing request", e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { baseRequest.setHandled(true); } } JettyHandler(final TransportCommandProcessor<HttpCommand> commandProcessor, boolean suppressCommasInAccessLog);  JettyHandler(final TransportCommandProcessor<HttpCommand> commandProcessor,
                        final JettyHandlerSpecification spec,
                        final IdentityTokenResolverLookup identityTokenResolverLookup,
                        boolean suppressCommasInAccessLog); @Override void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response); void setTimeoutInSeconds(int timeoutInSeconds); }
JettyHandler extends AbstractHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setHeader("Server", VERSION_HEADER); try { IdentityTokenResolver itr = null; if (identityTokenResolverLookup != null) { itr = identityTokenResolverLookup.lookupIdentityTokenResolver(baseRequest.getRequestURI()); } JettyTransportCommand command = new JettyTransportCommand(request, response, itr); if (!command.getContinuation().isExpired()) { LOGGER.debug("Message Received at Jetty Handler for path {}", target); commandProcessor.process(command); } else { LOGGER.debug("Message Timeout at Jetty Handler for path {}", target); response.sendError(HttpServletResponse.SC_GATEWAY_TIMEOUT); } } catch (CougarException ce) { LOGGER.warn("Cougar Exception thrown processing request", ce); response.sendError(ResponseCodeMapper.getHttpResponseCode(ce.getResponseCode())); } catch (Exception e) { LOGGER.error("Unexpected Exception thrown processing request", e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { baseRequest.setHandled(true); } } JettyHandler(final TransportCommandProcessor<HttpCommand> commandProcessor, boolean suppressCommasInAccessLog);  JettyHandler(final TransportCommandProcessor<HttpCommand> commandProcessor,
                        final JettyHandlerSpecification spec,
                        final IdentityTokenResolverLookup identityTokenResolverLookup,
                        boolean suppressCommasInAccessLog); @Override void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response); void setTimeoutInSeconds(int timeoutInSeconds);  }