Java Code Examples for org.eclipse.jetty.server.bio.SocketConnector#setHost()

The following examples show how to use org.eclipse.jetty.server.bio.SocketConnector#setHost() . 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();
}