@Test public void shouldAddDefaultHeadersForRootContext() throws Exception { jetty9Server.configure(); jetty9Server.startHandlers(); HttpServletResponse response = mock(HttpServletResponse.class); when(response.getWriter()).thenReturn(mock(PrintWriter.class)); HttpServletRequest request = mock(HttpServletRequest.class); Request baseRequest = mock(Request.class); when(baseRequest.getDispatcherType()).thenReturn(DispatcherType.REQUEST); when(baseRequest.getHttpFields()).thenReturn(mock(HttpFields.class)); ContextHandler rootPathHandler = getLoadedHandlers().get(GoServerLoadingIndicationHandler.class); rootPathHandler.setServer(server); rootPathHandler.start(); rootPathHandler.handle("/something", baseRequest, request, response); verify(response).setHeader("X-XSS-Protection", "1; mode=block"); verify(response).setHeader("X-Content-Type-Options", "nosniff"); verify(response).setHeader("X-Frame-Options", "SAMEORIGIN"); verify(response).setHeader("X-UA-Compatible", "chrome=1"); }
public void processBinding(Node node, App app) throws Exception { ContextHandler handler = app.getContextHandler(); if (!handler.isStarted()) { handler.start(); } } }
public void processBinding(Node node, App app) throws Exception { ContextHandler handler = app.getContextHandler(); if (!handler.isStarted()) { handler.start(); } } }
public void processBinding(Node node, App app) throws Exception { ContextHandler handler = app.getContextHandler(); if (!handler.isStarted()) { handler.start(); } } }
@SuppressWarnings("unchecked") public void deploy(String filename) throws Exception { ContextHandler context = createContext(filename); Log.info("Deploy " + filename + " -> " + context); _contexts.addHandler(context); _currentDeployments.put(filename, context); if (_contexts.isStarted()) { context.start(); } }
ch.setContextPath(uri.getPath()); collhandler.addHandler(ch); ch.start(); // must be started explicitly :-(((
private void deploy(String filename) throws Exception { ContextHandler context=createContext(filename); LOG.info("Deploy "+filename+" -> "+ context); _contexts.addHandler(context); _currentDeployments.put(filename,context); if (_contexts.isStarted()) context.start(); }
public void addHandler(final Domain domain) { ContextHandler handler = domainHandlerFactory.create(domain); try { parent.addHandler(handler); // Do not remove next line, handler should be managed to join group lifecycle when server // is already in STARTED state parent.manage(handler); handler.start(); logger.info("Security domain {} has been been published on path {}", domain.getName(), handler.getContextPath()); } catch (Exception ex) { logger.error("Unable to add a new handler", ex); } }
public void addHandler(final Domain domain) { ContextHandler handler = domainHandlerFactory.create(domain); try { parent.addHandler(handler); // Do not remove next line, handler should be managed to join group lifecycle when server // is already in STARTED state parent.manage(handler); handler.start(); logger.info("Security domain {} has been been published on path {}", domain.getName(), handler.getContextPath()); } catch (Exception ex) { logger.error("Unable to add a new handler", ex); } }
public void addHandler(final Domain domain) { ContextHandler handler = domainHandlerFactory.create(domain); try { parent.addHandler(handler); // Do not remove next line, handler should be managed to join group lifecycle when server // is already in STARTED state parent.manage(handler); handler.start(); logger.info("Security domain {} has been been published on path {}", domain.getName(), handler.getContextPath()); } catch (Exception ex) { logger.error("Unable to add a new handler", ex); } }
collhandler.addHandler(ch); unpublishinfos.put(serviceid, new Tuple2<Server,ContextHandler>(server, ch)); ch.start(); // must be started explicitly :-(((
contextHandler2.start();
@Override public void processBinding(Node node, App app) throws Exception { ContextHandlerCollection contexts = app.getDeploymentManager().getContexts(); ContextHandler handler = app.getContextHandler(); if (contexts.isStarted() && handler.isStopped()) { // start the handler manually handler.start(); // After starting let the context manage state contexts.manage(handler); } } }
context.start(); } catch (Exception ex) { LOG.log(Level.WARNING, "ADD_HANDLER_FAILED_MSG", new Object[] {ex.getMessage()});
context.start(); } catch (Exception ex) { LOG.log(Level.WARNING, "ADD_HANDLER_FAILED_MSG", new Object[] {ex.getMessage()});
context.start(); } catch (Exception ex) { LOG.log(Level.WARNING, "ADD_HANDLER_FAILED_MSG", new Object[] {ex.getMessage()});