org.eclipse.jetty.server.bio.SocketConnector Java Examples

The following examples show how to use org.eclipse.jetty.server.bio.SocketConnector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AndroidJettyServletContainer.java    From BeyondUPnP with Apache License 2.0 6 votes vote down vote up
@Override
synchronized public int addConnector(String host, int port) throws IOException {
    SocketConnector connector = new SocketConnector();
    connector.setHost(host);
    connector.setPort(port);

    // Open immediately so we can get the assigned local port
    connector.open();

    // Only add if open() succeeded
    server.addConnector(connector);

    // stats the connector if the server is started (server starts all connectors when started)
    if (server.isStarted()) {
        try {
            connector.start();
        } catch (Exception ex) {
            log.severe("Couldn't start connector: " + connector + " " + ex);
            throw new RuntimeException(ex);
        }
    }
    return connector.getLocalPort();
}
 
Example #2
Source File: JettyServletContainer.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Override
synchronized public int addConnector(String host, int port) throws IOException {
    SocketConnector connector = new SocketConnector();
    connector.setHost(host);
    connector.setPort(port);

    // Open immediately so we can get the assigned local port
    connector.open();

    // Only add if open() succeeded
    server.addConnector(connector);

    return connector.getLocalPort();
}
 
Example #3
Source File: JettyServletContainer.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
synchronized public int addConnector(String host, int port) throws IOException {
    SocketConnector connector = new SocketConnector();
    connector.setHost(host);
    connector.setPort(port);

    // Open immediately so we can get the assigned local port
    connector.open();

    // Only add if open() succeeded
    server.addConnector(connector);

    return connector.getLocalPort();
}
 
Example #4
Source File: ExplorerServer.java    From Explorer with Apache License 2.0 5 votes vote down vote up
private static Server setupJettyServer(int port) {
    int timeout = 1000 * 30;
    final Server server = new Server();
    SocketConnector connector = new SocketConnector();

    // Set some timeout options to make debugging easier.
    connector.setMaxIdleTime(timeout);
    connector.setSoLingerTime(-1);
    connector.setPort(port);
    server.addConnector(connector);
    return server;
}
 
Example #5
Source File: ITTracingFilter.java    From brave with Apache License 2.0 5 votes vote down vote up
@Override public Server newServer(int port) {
  Server result = new Server();
  SocketConnector connector = new SocketConnector();
  connector.setMaxIdleTime(1000 * 60 * 60);
  connector.setPort(port);
  result.setConnectors(new Connector[] {connector});
  return result;
}
 
Example #6
Source File: ITSpanCustomizingHandlerInterceptor.java    From brave with Apache License 2.0 5 votes vote down vote up
@Override public Server newServer(int port) {
  Server result = new Server();
  SocketConnector connector = new SocketConnector();
  connector.setMaxIdleTime(1000 * 60 * 60);
  connector.setPort(port);
  result.setConnectors(new Connector[] {connector});
  return result;
}
 
Example #7
Source File: ITSpanCustomizingHandlerInterceptor.java    From brave with Apache License 2.0 5 votes vote down vote up
@Override public Server newServer(int port) {
  Server result = new Server();
  SocketConnector connector = new SocketConnector();
  connector.setMaxIdleTime(1000 * 60 * 60);
  connector.setPort(port);
  result.setConnectors(new Connector[] {connector});
  return result;
}