@Override public String connector() { return getConnector().getName(); }
private static Connector connectorMock( String name ) { Connector connector = mock( Connector.class ); when( connector.getName() ).thenReturn( name ); when( connector.getExecutor() ).thenReturn( Runnable::run ); when( connector.getServer() ).thenReturn( new Server() ); return connector; } }
@Signature public boolean unlisten(Environment env, String value) { if (server.isRunning()) { env.exception("Unable to unlisten() for running server"); } String host = "0.0.0.0"; String port = "80"; if (value.contains(":")) { String[] strings = value.split("\\:"); host = strings[0]; if (strings.length > 1) { port = strings[1]; } } for (Connector connector : server.getConnectors()) { if (connector.getName().equals(host + ":" + port)) { server.removeConnector(connector); return true; } } return false; }
@Signature public Memory connectors() { Connector[] connectors = server.getConnectors(); ArrayMemory arrayMemory = ArrayMemory.createListed(connectors.length); for (Connector connector : connectors) { arrayMemory.add(connector.getName()); } return arrayMemory.toImmutable(); }
private JettyHttpConnection createConnection( Connector connector, EndPoint endPoint ) { String connectionId = connectionTracker.newConnectionId( connector.getName() ); return new JettyHttpConnection( connectionId, getHttpConfiguration(), connector, endPoint, getHttpCompliance(), isRecordHttpComplianceViolations() ); } }
ServerConnector findConnector(String protocol) { for (Connector connector : jettyServer.getConnectors()) { if (connector.getName().startsWith(protocol)) return (ServerConnector) connector; } return null; }
@Override public String connector() { return getConnector().getName(); }
@Override @ManagedAttribute public String getName() { return server.getConnectors()[0].getName(); }
public URI bind() throws Exception { URI bind = getBindLocation(); String bindHost = bind.getHost(); bindHost = (bindHost == null || bindHost.length() == 0) ? "localhost" : bindHost; InetAddress addr = InetAddress.getByName(bindHost); host = addr.getCanonicalHostName(); if (server.getConnectors().length == 0) { LOG.info("Creating Jetty connector"); setConnectorProperty("Host", String.class, host); setConnectorProperty("Port", Integer.TYPE, bindAddress.getPort()); server.addConnector(connector); } else { LOG.info("Using Jetty configured connector"); connector = server.getConnectors()[0]; for (Connector c : server.getConnectors()) { if (c.getName() != null && c.getName().equalsIgnoreCase("activemq")) { connector = c; } } setConnectorProperty("Host", String.class, host); setConnectorProperty("Port", Integer.TYPE, bindAddress.getPort()); server.addConnector(connector); } if (addr.isAnyLocalAddress()) { host = InetAddressUtil.getLocalHostName(); } URI boundUri = new URI(bind.getScheme(), bind.getUserInfo(), host, bindAddress.getPort(), bind.getPath(), bind.getQuery(), bind.getFragment()); setConnectURI(boundUri); return boundUri; }
private void dumpUrl() { Connector[] connectors = getServer().getConnectors(); for (int i=0;i<connectors.length;i++) { String connectorName = connectors[i].getName(); String displayName = getDisplayName(); if (displayName == null) displayName = "WebApp@"+connectors.hashCode(); LOG.info(displayName + " at http://" + connectorName + getContextPath()); } }
public URI bind() throws Exception { URI bind = getBindLocation(); String bindHost = bind.getHost(); bindHost = (bindHost == null || bindHost.length() == 0) ? "localhost" : bindHost; InetAddress addr = InetAddress.getByName(bindHost); host = addr.getCanonicalHostName(); if (server.getConnectors().length == 0) { LOG.info("Creating Jetty connector"); setConnectorProperty("Host", String.class, host); setConnectorProperty("Port", Integer.TYPE, bindAddress.getPort()); server.addConnector(connector); } else { LOG.info("Using Jetty configured connector"); connector = server.getConnectors()[0]; for (Connector c : server.getConnectors()) { if (c.getName() != null && c.getName().equalsIgnoreCase("activemq")) { connector = c; } } setConnectorProperty("Host", String.class, host); setConnectorProperty("Port", Integer.TYPE, bindAddress.getPort()); server.addConnector(connector); } if (addr.isAnyLocalAddress()) { host = InetAddressUtil.getLocalHostName(); } URI boundUri = new URI(bind.getScheme(), bind.getUserInfo(), host, bindAddress.getPort(), bind.getPath(), bind.getQuery(), bind.getFragment()); setConnectURI(boundUri); return boundUri; }
public URI bind() throws Exception { URI bind = getBindLocation(); String bindHost = bind.getHost(); bindHost = (bindHost == null || bindHost.length() == 0) ? "localhost" : bindHost; InetAddress addr = InetAddress.getByName(bindHost); host = addr.getCanonicalHostName(); if (server.getConnectors().length == 0) { LOG.info("Creating Jetty connector"); setConnectorProperty("Host", String.class, host); setConnectorProperty("Port", Integer.TYPE, bindAddress.getPort()); server.addConnector(connector); } else { LOG.info("Using Jetty configured connector"); connector = server.getConnectors()[0]; for (Connector c : server.getConnectors()) { if (c.getName() != null && c.getName().equalsIgnoreCase("activemq")) { connector = c; } } setConnectorProperty("Host", String.class, host); setConnectorProperty("Port", Integer.TYPE, bindAddress.getPort()); server.addConnector(connector); } if (addr.isAnyLocalAddress()) { host = InetAddressUtil.getLocalHostName(); } URI boundUri = new URI(bind.getScheme(), bind.getUserInfo(), host, bindAddress.getPort(), bind.getPath(), bind.getQuery(), bind.getFragment()); setConnectURI(boundUri); return boundUri; }
private void dumpUrl() { Connector[] connectors = getServer().getConnectors(); for (int i=0;i<connectors.length;i++) { String connectorName = connectors[i].getName(); String displayName = getDisplayName(); if (displayName == null) displayName = "WebApp@"+connectors.hashCode(); LOG.info(displayName + " at http://" + connectorName + getContextPath()); } }
private void dumpUrl() { Connector[] connectors = getServer().getConnectors(); for (int i=0;i<connectors.length;i++) { String connectorName = connectors[i].getName(); String displayName = getDisplayName(); if (displayName == null) displayName = "WebApp@"+connectors.hashCode(); LOG.info(displayName + " at http://" + connectorName + getContextPath()); } }
for (Connector connector : _connectors) sb.append("<h3>").append(connector.getName()).append("</h3>");
for (Connector connector : _connectors) sb.append("<h3>").append(connector.getName()).append("</h3>");
@Override public void serverStarted(Server server) { // Detect the port Jetty is listening on - works with configured and random ports for (final Connector connector : server.getConnectors()) { try { if ("application".equals(connector.getName())) { final ServerSocketChannel channel = (ServerSocketChannel) connector .getTransport(); final InetSocketAddress socket = (InetSocketAddress) channel .getLocalAddress(); timbuctooConfiguration.getUriHelper().notifyOfPort(socket.getPort()); } } catch (Exception e) { LOG.error("No base url provided, and unable to get generate one myself", e); } } } }
case '@': connectorName=true; String name=baseRequest.getHttpChannel().getConnector().getName(); boolean m=name!=null && contextVhost.length()==name.length()+1 && contextVhost.endsWith(name); match = match || m;
case '@': connectorName=true; String name=baseRequest.getHttpChannel().getConnector().getName(); boolean m=name!=null && contextVhost.length()==name.length()+1 && contextVhost.endsWith(name); match = match || m;
private JettyHttpConnection createConnection( Connector connector, EndPoint endPoint ) { String connectionId = connectionTracker.newConnectionId( connector.getName() ); return new JettyHttpConnection( connectionId, getHttpConfiguration(), connector, endPoint, getHttpCompliance(), isRecordHttpComplianceViolations() ); } }