private HttpContext createDriverContextWithSeleniumDriverResourceHandler(HttpContext context) { // Associate the SeleniumDriverResourceHandler with the /selenium-server/driver context HttpContext driverContext = new HttpContext(); driverContext.setContextPath("/selenium-server/driver"); driver = new SeleniumDriverResourceHandler(this); context.addHandler(driver); return driverContext; }
for (HttpHandler handler : context.getHandlers()) { if (servletMap.equals(handler.getName())) { try { context.removeHandler(handler); found = true;
HttpContext context = new HttpContext(); context.setContextPath(rootPath); wsLogger.info("!!!!ROOTPATH " + rootPath); context.setResourceBase(""); fHandler = new WebServiceHandler(); context.addHandler(fHandler); context.addHandler(new NotFoundHandler()); HttpContext context2 = new HttpContext(); context2.setContextPath(CoverageConstants.SERVICE_CONTEXT); context2.setResourceBase(""); fHandler2 = new MarkersServiceHandler(); context2.addHandler(fHandler2); context2.addHandler(new NotFoundHandler()); fServer.addContext(context2);
private void assembleHandlers(boolean slowResources, RemoteControlConfiguration configuration) { server.addContext(createRootContextWithProxyHandler(configuration)); HttpContext context = new HttpContext(); context.setContextPath("/selenium-server"); context.setMimeMapping("xhtml", "application/xhtml+xml"); addSecurityHandler(context); addStaticContentHandler(slowResources, configuration, context); context.addHandler(new SessionExtensionJsHandler()); context.addHandler(new SingleTestSuiteResourceHandler()); postResultsHandler = new SeleniumHTMLRunnerResultsHandler(); context.addHandler(postResultsHandler); context.addHandler(new CachedContentTestHandler()); server.addContext(context); server.addContext(createDriverContextWithSeleniumDriverResourceHandler(context)); }
private void addStaticContentHandler(boolean slowResources, RemoteControlConfiguration configuration, HttpContext context) { StaticContentHandler.setSlowResources(slowResources); staticContentHandler = new StaticContentHandler(configuration.getDebugURL(), configuration.getProxyInjectionModeArg()); String overrideJavascriptDir = System.getProperty("selenium.javascript.dir"); if (overrideJavascriptDir != null) { staticContentHandler.addStaticContent(new FsResourceLocator(new File(overrideJavascriptDir))); } staticContentHandler.addStaticContent(new ClasspathResourceLocator()); context.addHandler(staticContentHandler); }
handlerContext.setClassLoader(servletHttpTransport.getEndpointService().getGroup().getLoader()); handlerContext.addHandler(handler); HttpContext context = server.addContext("/midlets/*"); context.setResourceBase("./midlets/"); context.addHandler(resHandler);
private void addSecurityHandler(HttpContext context) { SecurityConstraint constraint = new SecurityConstraint(); constraint.setName(SecurityConstraint.__BASIC_AUTH); constraint.addRole("user"); constraint.setAuthenticate(true); context.addSecurityConstraint("/tests/html/basicAuth/*", constraint); HashUserRealm realm = new HashUserRealm("MyRealm"); realm.put("alice", "foo"); realm.addUserToRole("alice", "user"); context.setRealm(realm); SecurityHandler sh = new SecurityHandler(); context.addHandler(sh); }
context.start(); } catch (Exception e1) { handler.setName(smap); context.addHandler(handler); try { handler.start();
@Setup @SuppressWarnings("unused") private void setUp(HttpTestEnvironment env) throws Exception { server = new Server(); SocketListener listener = new SocketListener(); listener.setPort(env.getServerPort()); server.addListener(listener); context = new HttpContext(server, Channel.CONTEXT_PATH + "/*"); server.start(); }
@TearDown @SuppressWarnings("unused") private void tearDown() throws Exception { handler.stop(); server.getContext().removeHandler(handler); }
@Setup @SuppressWarnings({ "unused", "serial" }) private void setUp(JettyServer server, HttpChannel channel) throws Exception { this.server = server; final String path = "/" + channel.getServiceName(); handler = new AbstractHttpHandler() { public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException { if (pathInContext.equals(path)) { JettyEndpoint.this.handle(pathParams, request, response); request.setHandled(true); } } }; server.getContext().addHandler(handler); handler.start(); }
@Setup @SuppressWarnings("unused") private void setUp(HttpTestEnvironment env) throws Exception { server = new Server(); SocketListener listener = new SocketListener(); listener.setPort(env.getServerPort()); server.addListener(listener); context = new HttpContext(server, Channel.CONTEXT_PATH + "/*"); server.start(); }
@TearDown @SuppressWarnings("unused") private void tearDown() throws Exception { handler.stop(); server.getContext().removeHandler(handler); }
protected HttpContext createRootContextWithProxyHandler(RemoteControlConfiguration configuration) { HttpContext root; root = new HttpContext(); root.setContextPath("/"); proxyHandler = makeProxyHandler(configuration); // see docs for the lock object for information on this and why it is IMPORTANT! proxyHandler.setShutdownLock(shutdownLock); root.addHandler(proxyHandler); return root; }
@Setup @SuppressWarnings({ "unused", "serial" }) private void setUp(JettyServer server, HttpChannel channel) throws Exception { this.server = server; final String path = "/" + channel.getServiceName(); handler = new AbstractHttpHandler() { public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException { if (pathInContext.equals(path)) { JettyEndpoint.this.handle(pathParams, request, response); request.setHandled(true); } } }; server.getContext().addHandler(handler); handler.start(); }
@Setup @SuppressWarnings("unused") private void setUp(HttpTestEnvironment env) throws Exception { server = new Server(); SocketListener listener = new SocketListener(); listener.setPort(env.getServerPort()); server.addListener(listener); context = new HttpContext(server, Channel.CONTEXT_PATH + "/*"); server.start(); }
@TearDown @SuppressWarnings("unused") private void tearDown() throws Exception { handler.stop(); server.getContext().removeHandler(handler); }
public static void main(String[] args) throws Exception { Server server = new Server(); HttpContext httpContext = new HttpContext(); httpContext.setContextPath("/"); ProxyHandler proxy = new ProxyHandler(true, "", "", false, false); proxy.useCyberVillains = false; httpContext.addHandler(proxy); server.addContext(httpContext); SocketListener listener = new SocketListener(); listener.setPort(4444); server.addListener(listener); server.start(); }
@Setup @SuppressWarnings({ "unused", "serial" }) private void setUp(JettyServer server, HttpChannel channel) throws Exception { this.server = server; final String path = "/" + channel.getServiceName(); handler = new AbstractHttpHandler() { public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException { if (pathInContext.equals(path)) { JettyEndpoint.this.handle(pathParams, request, response); request.setHandled(true); } } }; server.getContext().addHandler(handler); handler.start(); }
public void start( BundleContext bundleContext ) throws Exception { m_jclLogger = LogFactory.getLog( Activator.class ); m_juliLogger = org.apache.juli.logging.LogFactory.getLog( Activator.class ); m_avalonLogger = AvalonLogFactory.getLogger( Activator.class.getName() ); m_slf4jLogger = LoggerFactory.getLogger( Activator.class ); m_jdkLogger = java.util.logging.Logger.getLogger( Activator.class.getName() ); m_jclLogger.info( "Starting Example... (jcl)" ); m_avalonLogger.info( "Starting Example... (avalon)" ); m_slf4jLogger.info( "Starting Example... (slf4j)" ); m_jdkLogger.info( "Starting Example... (jdk)" ); m_juliLogger.info( "Starting Example... (juli)" ); HttpHandler handler = new TestHandler( "test" ); InetAddrPort port = new InetAddrPort( 8080 ); HttpListener listener = new SocketListener( port ); m_server = new HttpServer(); HttpContext context = new HttpContext(); context.setContextPath( "/" ); context.addHandler( handler ); m_server.addContext( context ); m_server.addListener( listener ); m_server.start(); }