@Override public String getHost() { return this.connector.getHost(); }
@Override public String getHost() { return connector.getHost(); }
@Override public String getHost() { return this.connector.getHost(); }
@Override public String toString() { Preconditions.checkState(!listeners.isEmpty()); StringBuilder sb = new StringBuilder("HttpServer (") .append(isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE) .append("), listening at:"); for (Connector l : listeners) { sb.append(l.getHost()).append(":").append(l.getPort()).append("/,"); } return sb.toString(); }
@Override public String toString() { Preconditions.checkState(!listeners.isEmpty()); StringBuilder sb = new StringBuilder("HttpServer (") .append(isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE) .append("), listening at:"); for (Connector l : listeners) { sb.append(l.getHost()).append(":").append(l.getPort()).append("/,"); } return sb.toString(); }
@Override public String toString() { Preconditions.checkState(!listeners.isEmpty()); StringBuilder sb = new StringBuilder("HttpServer (") .append(isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE) .append("), listening at:"); for (Connector l : listeners) { sb.append(l.getHost()).append(":").append(l.getPort()).append("/,"); } return sb.toString(); }
protected void initSpnego(Configuration conf, String usernameConfKey, String keytabConfKey) throws IOException { Map<String, String> params = new HashMap<String, String>(); String principalInConf = conf.get(usernameConfKey); if (principalInConf != null && !principalInConf.isEmpty()) { params.put("kerberos.principal", SecurityUtil.getServerPrincipal(principalInConf, listener.getHost())); } String httpKeytab = conf.get(keytabConfKey); if (httpKeytab != null && !httpKeytab.isEmpty()) { params.put("kerberos.keytab", httpKeytab); } params.put(AuthenticationFilter.AUTH_TYPE, "kerberos"); defineFilter(webAppContext, SPNEGO_FILTER, AuthenticationFilter.class.getName(), params, null); }
/** * Return the bind address of the listener. * @return InetSocketAddress of the listener */ public InetSocketAddress getListenerAddress() { int port = listener.getLocalPort(); if (port == -1) { // not bound, return requested port port = listener.getPort(); } return new InetSocketAddress(listener.getHost(), port); }
protected void initSpnego(Configuration conf, String usernameConfKey, String keytabConfKey) throws IOException { Map<String, String> params = new HashMap<String, String>(); String principalInConf = conf.get(usernameConfKey); if (principalInConf != null && !principalInConf.isEmpty()) { params.put("kerberos.principal", SecurityUtil.getServerPrincipal(principalInConf, listener.getHost())); } String httpKeytab = conf.get(keytabConfKey); if (httpKeytab != null && !httpKeytab.isEmpty()) { params.put("kerberos.keytab", httpKeytab); } params.put(AuthenticationFilter.AUTH_TYPE, "kerberos"); defineFilter(webAppContext, SPNEGO_FILTER, AuthenticationFilter.class.getName(), params, null); }
/** * Return the bind address of the listener. * @return InetSocketAddress of the listener */ public InetSocketAddress getListenerAddress() { int port = listener.getLocalPort(); if (port == -1) { // not bound, return requested port port = listener.getPort(); } return new InetSocketAddress(listener.getHost(), port); }
/** * Return the bind address of the listener. * @return InetSocketAddress of the listener */ public InetSocketAddress getListenerAddress() { int port = listener.getLocalPort(); if (port == -1) { // not bound, return requested port port = listener.getPort(); } return new InetSocketAddress(listener.getHost(), port); }
/** * Return the host and port of the HttpServer, if live * @return the classname and any HTTP URL */ @Override public String toString() { return listener != null ? ("HttpServer at http://" + listener.getHost() + ":" + listener.getLocalPort() + "/" + (isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE)) : "Inactive HttpServer"; }
/** * Return the host and port of the HttpServer, if live * @return the classname and any HTTP URL */ @Override public String toString() { return listener != null ? ("HttpServer at http://" + listener.getHost() + ":" + listener.getLocalPort() + "/" + (isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE)) : "Inactive HttpServer"; }
/** * Return the host and port of the HttpServer, if live * @return the classname and any HTTP URL */ @Override public String toString() { return listener != null ? ("HttpServer at http://" + listener.getHost() + ":" + listener.getLocalPort() + "/" + (isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE)) : "Inactive HttpServer"; }
/** * Return the host and port of the HttpServer, if live * * @return the classname and any HTTP URL */ @Override public String toString() { return listener != null ? ("HttpServer at http://" + listener.getHost() + ":" + listener.getLocalPort() + "/" + (isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE)) : "Inactive HttpServer"; } }
/** * Return the host and port of the HttpServer, if live * * @return the classname and any HTTP URL */ @Override public String toString() { return listener != null ? ("HttpServer at http://" + listener.getHost() + ":" + listener.getLocalPort() + "/" + (isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE)) : "Inactive HttpServer"; } }
private String baseFor(final Server jettyServer) { final Connector connector = jettyServer.getConnectors()[0]; final String scheme = "http"; final String host = StringUtils.coalesce(connector.getHost(), "localhost"); final int port = connector.getPort(); final WebAppContext handler = (WebAppContext) jettyServer.getHandler(); final String contextPath = handler.getContextPath(); final StringBuilder buf = new StringBuilder(); final Formatter formatter = new Formatter(buf); formatter.format("%s://%s:%d/%s", scheme, host, port, contextPath); return appendSlashIfRequired(buf).toString(); }
private static URL getJettyURL(Server server) { boolean ssl = server.getConnectors()[0].getClass() == SslSelectChannelConnectorSecure.class; try { String scheme = (ssl) ? "https" : "http"; return new URL(scheme + "://" + server.getConnectors()[0].getHost() + ":" + server.getConnectors()[0].getPort()); } catch (MalformedURLException ex) { throw new RuntimeException("It should never happen, " + ex.getMessage(), ex); } }
protected String getJettyURL() { Connector c = jetty.getConnectors()[0]; return "http://" + c.getHost() + ":" + c.getPort(); }
protected String getJettyURL() { Connector c = jetty.getConnectors()[0]; return "http://" + c.getHost() + ":" + c.getPort(); }