.hostName(getHostnameForSpnegoPrincipal(confForInfoServer)) .addEndpoint(URI.create("http://localhost:" + proxyPort)) .setFindPort(true);
builder.setFindPort(true); builder.setFindPort(true);
@Before public void setUp() throws Exception { new File(System.getProperty("build.webapps", "build/webapps") + "/test" ).mkdirs(); server = new HttpServer2.Builder().setName("test") .addEndpoint(URI.create("http://localhost:0")) .setFindPort(true).build(); server.addServlet("delay", "/delay", DelayServlet.class); server.addServlet("jobend", "/jobend", JobEndServlet.class); server.addServlet("fail", "/fail", FailServlet.class); server.start(); int port = server.getConnectorAddress(0).getPort(); baseUrl = new URL("http://localhost:" + port + "/"); JobEndServlet.calledTimes = 0; JobEndServlet.requestUri = null; DelayServlet.calledTimes = 0; FailServlet.calledTimes = 0; }
@Override protected void serviceStart() throws Exception { try { Configuration conf = getConfig(); HttpServer2.Builder b = new HttpServer2.Builder() .setName("proxy") .addEndpoint( URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress + ":" + port)).setFindPort(port == 0).setConf(getConfig()) .setACL(acl); if (YarnConfiguration.useHttps(conf)) { WebAppUtils.loadSslConfiguration(b); } proxyServer = b.build(); proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME, ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class); proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher); proxyServer .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled); proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost); proxyServer.start(); } catch (IOException e) { LOG.error("Could not start proxy web server",e); throw e; } super.serviceStart(); }
@Override protected void serviceStart() throws Exception { try { Configuration conf = getConfig(); HttpServer2.Builder b = new HttpServer2.Builder() .setName("proxy") .addEndpoint( URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress + ":" + port)).setFindPort(port == 0).setConf(getConfig()) .setACL(acl); if (YarnConfiguration.useHttps(conf)) { WebAppUtils.loadSslConfiguration(b); } proxyServer = b.build(); proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME, ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class); proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher); proxyServer .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled); proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost); proxyServer.start(); } catch (IOException e) { LOG.error("Could not start proxy web server",e); throw e; } super.serviceStart(); }
@Override protected void serviceStart() throws Exception { try { Configuration conf = getConfig(); HttpServer2.Builder b = new HttpServer2.Builder() .setName("proxy") .addEndpoint( URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress + ":" + port)).setFindPort(port == 0).setConf(getConfig()) .setACL(acl); if (YarnConfiguration.useHttps(conf)) { WebAppUtils.loadSslConfiguration(b); } proxyServer = b.build(); proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME, ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class); proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher); proxyServer .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled); proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost); proxyServer.start(); } catch (IOException e) { LOG.error("Could not start proxy web server",e); throw e; } super.serviceStart(); }
@Override protected void serviceStart() throws Exception { try { Configuration conf = getConfig(); HttpServer2.Builder b = new HttpServer2.Builder() .setName("proxy") .addEndpoint( URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress + ":" + port)).setFindPort(port == 0).setConf(getConfig()) .setACL(acl); if (YarnConfiguration.useHttps(conf)) { WebAppUtils.loadSslConfiguration(b); } proxyServer = b.build(); proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME, ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class); proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher); proxyServer .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled); proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost); proxyServer.start(); } catch (IOException e) { LOG.error("Could not start proxy web server",e); throw e; } super.serviceStart(); }
/** * Return a HttpServer.Builder that the journalnode / namenode / secondary * namenode can use to initialize their HTTP / HTTPS server. * * @param conf configuration object * @param httpAddr HTTP address * @param httpsAddr HTTPS address * @param name Name of the server * @throws IOException from Builder * @return builder object */ public static HttpServer2.Builder httpServerTemplateForRM(Configuration conf, final InetSocketAddress httpAddr, final InetSocketAddress httpsAddr, String name) throws IOException { HttpServer2.Builder builder = new HttpServer2.Builder().setName(name) .setConf(conf).setSecurityEnabled(false); if (httpAddr.getPort() == 0) { builder.setFindPort(true); } URI uri = URI.create("http://" + NetUtils.getHostPortString(httpAddr)); builder.addEndpoint(uri); LOG.info("Starting Web-server for " + name + " at: " + uri); return builder; }
private static HttpServer2 startHttpServer() throws Exception { new File(System.getProperty( "build.webapps", "build/webapps") + "/test").mkdirs(); HttpServer2 server = new HttpServer2.Builder().setName("test") .addEndpoint(URI.create("http://localhost:0")) .setFindPort(true).build(); server.addServlet("jobend", "/jobend", JobEndServlet.class); server.start(); JobEndServlet.calledTimes = 0; JobEndServlet.requestUri = null; JobEndServlet.baseUrl = "http://localhost:" + server.getConnectorAddress(0).getPort() + "/"; JobEndServlet.foundJobState = null; return server; }
/** * Create an HttpServer instance on the given address for the given webapp * @param host to bind * @param port to bind * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String host, int port) throws IOException { prepareTestWebapp(); return new HttpServer2.Builder().setName(TEST) .addEndpoint(URI.create("http://" + host + ":" + port)) .setFindPort(true).build(); }
/** * Create an HttpServer instance on the given address for the given webapp * @param host to bind * @param port to bind * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String host, int port) throws IOException { prepareTestWebapp(); return new HttpServer2.Builder().setName(TEST) .addEndpoint(URI.create("http://" + host + ":" + port)) .setFindPort(true).build(); }
public static HttpServer2 createServer(String webapp, Configuration conf, AccessControlList adminsAcl) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).setACL(adminsAcl).build(); }
public static HttpServer2 createServer(String webapp, Configuration conf, AccessControlList adminsAcl) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).setACL(adminsAcl).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp) throws IOException { return localServerBuilder(webapp).setFindPort(true).build(); } /**
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @param conf the configuration to use for the server * @param pathSpecs the paths specifications the server will service * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp, Configuration conf, String[] pathSpecs) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).setPathSpec(pathSpecs).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @param conf the configuration to use for the server * @param pathSpecs the paths specifications the server will service * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp, Configuration conf, String[] pathSpecs) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).setPathSpec(pathSpecs).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @param conf the configuration to use for the server * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp, Configuration conf) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @param conf the configuration to use for the server * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp, Configuration conf) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp) throws IOException { return localServerBuilder(webapp).setFindPort(true).build(); } /**
private HttpServer2.Builder getCommonBuilder() throws Exception { return new HttpServer2.Builder().setName("test") .addEndpoint(new URI("http://localhost:0")) .setFindPort(true); } }