Package org.eclipse.jetty.server

Examples of org.eclipse.jetty.server.NetworkConnector


        int index = 0;
        for( Connector connector : connectors )
        {
            if( connector instanceof NetworkConnector )
            {
                NetworkConnector netConnector = (NetworkConnector) connector;
                String host = configuration().hostName().get();
                if( host == null )
                {
                    host = netConnector.getHost();
                    if( host == null ) // If serving all interfaces.
                    {
                        try
                        {
                            host = InetAddress.getLocalHost().getHostAddress();
                        }
                        catch( UnknownHostException e )
                        {
                            InternalError error = new InternalError( "UnknownHost for local interface." );
                            error.initCause( e );
                            throw error;
                        }
                    }
                }
                result[ index++] = new InterfaceImpl( host, netConnector.getPort(), servedProtocol() );
            }
        }
        return result;
    }
View Full Code Here


                //Get the host
                String host=null;
                int port=0;
                if (connectors!=null && (connectors[0] instanceof NetworkConnector))
                {
                    NetworkConnector connector = (NetworkConnector)connectors[0];
                    host=connector.getHost();
                    port=connector.getLocalPort();
                    if (port < 0)
                        port = connector.getPort();
                }
                if (host == null)
                    host = "0.0.0.0";
                canonicalName.append(host);
View Full Code Here

    }

    @SuppressWarnings("resource")
    private String getServerUrl()
    {
        NetworkConnector connector=null;
        for (Connector c: getServer().getConnectors())
        {
            if (c instanceof NetworkConnector)
            {
                connector=(NetworkConnector)c;
                break;
            }
        }

        if (connector==null)
            return "http://localhost";

        return "http://localhost:" + connector.getPort();
    }
View Full Code Here

        });

        Connector[] connectors = server.getConnectors();
        assertThat(connectors).isNotEmpty();
        assertThat(connectors[0]).isInstanceOf(NetworkConnector.class);
        NetworkConnector connector = (NetworkConnector) connectors[0];

        // wait for server to close the connectors
        while (true) {
            if (!connector.isOpen()) {
                shutdownInvoked.countDown();
                break;
            }
            Thread.sleep(5);
        }
View Full Code Here

      server.start();
    }

    public int getPort() {
      Connector[] connectors = server.getConnectors();
      NetworkConnector connector = (NetworkConnector) connectors[0];
      return connector.getLocalPort();
    }
View Full Code Here

      server.start();
    }

    public int getPort() {
      Connector[] connectors = server.getConnectors();
      NetworkConnector connector = (NetworkConnector) connectors[0];
      return connector.getLocalPort();
    }
View Full Code Here

    server.start();
  }

  public int getPort() {
    Connector[] connectors = server.getConnectors();
    NetworkConnector connector = (NetworkConnector) connectors[0];
    return connector.getLocalPort();
  }
View Full Code Here

                //Get the host
                String host=null;
                int port=0;
                if (connectors!=null && (connectors[0] instanceof NetworkConnector))
                {
                    NetworkConnector connector = (NetworkConnector)connectors[0];
                    host=connector.getHost();
                    port=connector.getLocalPort();
                    if (port < 0)
                        port = connector.getPort();
                }
                if (host == null)
                    host = "0.0.0.0";
                canonicalName.append(host);
View Full Code Here

        }
    }

    private String getServerUrl()
    {
        NetworkConnector connector=null;
        for (Connector c: getServer().getConnectors())
        {
            if (c instanceof NetworkConnector)
            {
                connector=(NetworkConnector)c;
                break;
            }
        }

        if (connector==null)
            return "http://localhost";

        return "http://localhost:" + connector.getPort();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.NetworkConnector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.