Refine search
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (!response.getHeaderNames().contains(SERVER_HEADER)) { response.setHeader(SERVER_HEADER, this.value); } super.handle(target, baseRequest, request, response); }
private Handler applyWrapper(Handler handler, HandlerWrapper wrapper) { wrapper.setHandler(handler); return wrapper; }
@Test public void shouldNotHandleForRails4DevelopmentMode() throws IOException, ServletException { when(systemEnvironment.useCompressedJs()).thenReturn(false); String target = "/go/assets/junk"; Request request = mock(Request.class); HttpServletResponse response = mock(HttpServletResponse.class); Request baseRequest = mock(Request.class); ResourceHandler resourceHandler = mock(ResourceHandler.class); ReflectionUtil.setField(((HandlerWrapper) handler.getHandler()).getHandler(), "resourceHandler", resourceHandler); handler.getHandler().handle(target, baseRequest, request, response); verify(resourceHandler, never()).handle(any(String.class), any(Request.class), any(HttpServletRequest.class), any(HttpServletResponse.class)); }
@Override public void destroy() { if (!isStopped()) throw new IllegalStateException("!STOPPED"); Handler child=getHandler(); if (child!=null) { setHandler(null); child.destroy(); } super.destroy(); }
@Override public void setServer(Server server) { if (server==getServer()) return; if (isStarted()) throw new IllegalStateException(STARTED); super.setServer(server); Handler h=getHandler(); if (h!=null) h.setServer(server); }
/** * @param handler Set the {@link Handler} which should be wrapped. */ public void setHandler(Handler handler) { if (isStarted()) throw new IllegalStateException(STARTED); Handler old_handler = _handler; _handler = handler; if (handler!=null) handler.setServer(getServer()); if (getServer()!=null) getServer().getContainer().update(this, old_handler, handler, "handler"); }
/** * @param handler Set the {@link Handler} which should be wrapped. */ public void setHandler(Handler handler) { if (isStarted()) throw new IllegalStateException(STARTED); if (handler!=null) handler.setServer(getServer()); updateBean(_handler,handler); _handler=handler; }
@Override /* ------------------------------------------------------------ */ protected void doStop() throws Exception { //if we discovered the services (rather than had them explicitly configured), remove them. if (!isManaged(_identityService)) { removeBean(_identityService); _identityService = null; } if (!isManaged(_loginService)) { removeBean(_loginService); _loginService=null; } super.doStop(); }
@Override protected Object expandChildren(Object list, Class byClass) { return expandHandler(_handler,list,byClass); }
private void handleDeferredInitialize(Handler... handlers) throws Exception { for (Handler handler : handlers) { if (handler instanceof JettyEmbeddedWebAppContext) { ((JettyEmbeddedWebAppContext) handler).deferredInitialize(); } else if (handler instanceof HandlerWrapper) { handleDeferredInitialize(((HandlerWrapper) handler).getHandler()); } else if (handler instanceof HandlerCollection) { handleDeferredInitialize(((HandlerCollection) handler).getHandlers()); } } }
@Override public void destroy() { if (!isStopped()) throw new IllegalStateException("!STOPPED"); Handler child=getHandler(); if (child!=null) { setHandler(null); child.destroy(); } super.destroy(); }
@Override public void setServer(Server server) { if (server==getServer()) return; if (isStarted()) throw new IllegalStateException(STARTED); super.setServer(server); Handler h=getHandler(); if (h!=null) h.setServer(server); }
@Override protected void doStart() throws Exception { if (_out==null) _out=new RolloverFileOutputStream("./logs/yyyy_mm_dd.debug.log",true); _print=new PrintStream(_out); super.doStart(); }
/** * @param handler Set the {@link Handler} which should be wrapped. */ public void setHandler(Handler handler) { if (isStarted()) throw new IllegalStateException(STARTED); Handler old_handler = _handler; _handler = handler; if (handler!=null) handler.setServer(getServer()); if (getServer()!=null) getServer().getContainer().update(this, old_handler, handler, "handler"); }
/** * @param handler Set the {@link Handler} which should be wrapped. */ public void setHandler(Handler handler) { if (isStarted()) throw new IllegalStateException(STARTED); if (handler!=null) handler.setServer(getServer()); updateBean(_handler,handler); _handler=handler; }
@Override protected void doStop() throws Exception { super.doStop(); } }
@Override protected void expandChildren(List<Handler> list, Class<?> byClass) { expandHandler(_handler,list,byClass); }