public String getRedirectUri() throws IOException { if ( this.port == -1 ) { this.port = getUnusedPort(); } this.server = new Server( this.port ); Connector[] arr$ = this.server.getConnectors(); int len$ = arr$.length; for ( int i$ = 0; i$ < len$; ++i$ ) { Connector c = arr$[i$]; c.setHost( this.host ); } this.server.addHandler( new CustomLocalServerReceiver.CallbackHandler() ); try { this.server.start(); } catch ( Exception var5 ) { Throwables.propagateIfPossible( var5 ); throw new IOException( var5 ); } return "http://" + this.host + ":" + this.port + "/Callback/success.html"; }
public MockRemoteEurekaServer(int port, Map<String, Application> applicationMap, Map<String, Application> applicationDeltaMap) { this.applicationMap = applicationMap; this.applicationDeltaMap = applicationDeltaMap; ServletHandler handler = new AppsResourceHandler(); EurekaServerConfig serverConfig = new DefaultEurekaServerConfig(); EurekaServerContext serverContext = mock(EurekaServerContext.class); when(serverContext.getServerConfig()).thenReturn(serverConfig); handler.addFilterWithMapping(ServerRequestAuthFilter.class, "/*", 1).setFilter(new ServerRequestAuthFilter(serverContext)); handler.addFilterWithMapping(RateLimitingFilter.class, "/*", 1).setFilter(new RateLimitingFilter(serverContext)); server = new Server(port); server.addHandler(handler); System.out.println(String.format( "Created eureka server mock with applications map %s and applications delta map %s", stringifyAppMap(applicationMap), stringifyAppMap(applicationDeltaMap))); }
@Before public void setupLocalServer() throws Exception { // Set up a local Jetty HTTP server Server server = new Server(); server.addConnector(new SocketConnector()); ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase("src/test/resources/server"); server.addHandler(resourceHandler); server.start(); // The server will have a random port assigned, so capture that localPort = server.getConnectors()[0].getLocalPort(); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) { webServer.addHandler(ctxt); addNoCacheFilter(webAppContext); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); addNoCacheFilter(webAppContext); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); addNoCacheFilter(webAppContext); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) { webServer.addHandler(ctxt); addNoCacheFilter(webAppContext); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); addNoCacheFilter(webAppContext); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) { webServer.addHandler(ctxt); addNoCacheFilter(webAppContext); defaultContexts.put(ctxt, isFiltered); }
public void addContext(Context ctxt, boolean isFiltered) throws IOException { webServer.addHandler(ctxt); addNoCacheFilter(webAppContext); defaultContexts.put(ctxt, isFiltered); }
@Override public String getRedirectUri() throws Exception { server = new Server(PORT); for (Connector c : server.getConnectors()) { c.setHost(LOCALHOST); } server.addHandler(new CallbackHandler()); server.start(); return "http://" + LOCALHOST + ":" + PORT + CALLBACK_PATH; }
public void addServletWithMapping( final String contextPath, final String servletClassName, final String servletMapping) { final ContextHandler contextHandler = new ContextHandler(); contextHandler.setContextPath(contextPath); final ServletHandler servletHandler = new ServletHandler(); servletHandler.addServletWithMapping(servletClassName, contextPath + servletMapping); contextHandler.setHandler(servletHandler); server.addHandler(servletHandler); }
public static void createWebAppContext(ActionContext actionContext){ Thing self = (Thing) actionContext.get("self"); String contextPath = (String) self.doAction("getContextPath", actionContext); String webApp = (String) self.doAction("getWebApp", actionContext); Server server = (Server) actionContext.get("server"); WebAppContext context = new WebAppContext(webApp, contextPath); server.addHandler(context); }
@Override public String getRedirectUri() throws Exception { server = new Server(PORT); for (Connector c : server.getConnectors()) { c.setHost(LOCALHOST); } server.addHandler(new CallbackHandler()); server.start(); return "http://" + LOCALHOST + ":" + PORT + CALLBACK_PATH; }
public EmbeddedServer(String host, int port, String contextPath, String warPath) { System.clearProperty("DEBUG"); jetty = new Server(); Connector conn = new BlockingChannelConnector(); conn.setHost(host); conn.setPort(port); jetty.addConnector(conn); WebAppContext webapp = new WebAppContext(); webapp.setContextPath(contextPath); webapp.setWar(warPath); jetty.addHandler(webapp); }