## com.sun.jersey.api.container.httpserver
Class HttpServerFactory

    java.lang.Object
      com.sun.jersey.api.container.httpserver.HttpServerFactory

    public final class HttpServerFactory

extends java.lang.Object

Factory for creating `HttpServer` instances.

The `HttpServer` executor will be configued with instance returned from `Executors.newCachedThreadPool()`. This behaviour may be overridden before `HttpServer.start()` is called.

Author:
  Paul.Sandoz@Sun.Com

Method Summary
`static com.sun.net.httpserver.HttpServer` | `create(java.lang.String u)` Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource classes found by searching the classes referenced in the java classpath.
`static com.sun.net.httpserver.HttpServer` | `create(java.lang.String u, com.sun.net.httpserver.HttpHandler handler)` Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource classes found by searching the classes referenced in the java classath.
`static com.sun.net.httpserver.HttpServer` | `create(java.lang.String u, ResourceConfig rc)` Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource and provder classes declared by the resource configuration.
`static com.sun.net.httpserver.HttpServer` | `create(java.lang.String u, ResourceConfig rc, IoCComponentProviderFactory factory)` Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource and provder classes declared by the resource configuration.
`static com.sun.net.httpserver.HttpServer` | `create(java.net.URI u)` Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource classes found by searching the classes referenced in the java classath.
`static com.sun.net.httpserver.HttpServer` | `create(java.net.URI u, com.sun.net.httpserver.HttpHandler handler)` Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource classes found by searching the classes referenced in the java classath.
`static com.sun.net.httpserver.HttpServer` | `create(java.net.URI u, ResourceConfig rc)` Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource and provder classes declared by the resource configuration.
`static com.sun.net.httpserver.HttpServer` | `create(java.net.URI u, ResourceConfig rc, IoCComponentProviderFactory factory)` Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource and provder classes declared by the resource configuration.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### create

    public static com.sun.net.httpserver.HttpServer create(java.lang.String u)
                                                    throws java.io.IOException,
                                                           java.lang.IllegalArgumentException

  Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource classes found by searching the classes referenced in the java classpath.

  This implementation defers to the `ContainerFactory.createContainer(Class)` method for creating an HttpHandler that manages the root resources.

  Parameters:
    `u` - the URI to create the http server. The URI scheme must be equal to "http" or "https". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path must not be null or an empty string, and must not absolute (start with a '/' character). The URI path is used as the context of the HTTP handler (and corresponds to the base path). The URI query and fragment components are ignored.
  Returns:
    the http server
  Throws:
    `java.io.IOException` - if an error occurs creating the container.
    `java.lang.IllegalArgumentException` - if `u` is null

### create

    public static com.sun.net.httpserver.HttpServer create(java.net.URI u)
                                                    throws java.io.IOException,
                                                           java.lang.IllegalArgumentException

  Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource classes found by searching the classes referenced in the java classath.

  This implementation defers to the `ContainerFactory.createContainer(Class)` method for creating an HttpHandler that manages the root resources.

  Parameters:
    `u` - the URI to create the http server. The URI scheme must be equal to "http" or "https". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path must not be null or an empty string, and must not absolute (start with a '/' character). The URI path is used as the context of the HTTP handler (and corresponds to the base path). The URI query and fragment components are ignored.
  Returns:
    the http server
  Throws:
    `java.io.IOException` - if an error occurs creating the container.
    `java.lang.IllegalArgumentException` - if `u` is null

### create

    public static com.sun.net.httpserver.HttpServer create(java.lang.String u,
                                                           ResourceConfig rc)
                                                    throws java.io.IOException,
                                                           java.lang.IllegalArgumentException

  Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource and provder classes declared by the resource configuration.

  This implementation defers to the `ContainerFactory.createContainer(Class, ResourceConfig)` method for creating an HttpHandler that manages the root resources.

  Parameters:
    `u` - the URI to create the http server. The URI scheme must be equal to "http" or "https". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path must not be null or an empty string, and must not absolute (start with a '/' character). The URI path is used as the context of the HTTP handler (and corresponds to the base path). The URI query and fragment components are ignored.
    `rc` - the resource configuration.
  Returns:
    the http server
  Throws:
    `java.io.IOException` - if an error occurs creating the container.
    `java.lang.IllegalArgumentException` - if `u` is null

### create

    public static com.sun.net.httpserver.HttpServer create(java.net.URI u,
                                                           ResourceConfig rc)
                                                    throws java.io.IOException,
                                                           java.lang.IllegalArgumentException

  Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource and provder classes declared by the resource configuration.

  This implementation defers to the `ContainerFactory.createContainer(Class, ResourceConfig)` method for creating an HttpHandler that manages the root resources.

  Parameters:
    `u` - the URI to create the http server. The URI scheme must be equal to "http" or "https". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path must not be null or an empty string, and must not absolute (start with a '/' character). The URI path is used as the context of the HTTP handler (and corresponds to the base path). The URI query and fragment components are ignored.
    `rc` - the resource configuration.
  Returns:
    the http server
  Throws:
    `java.io.IOException` - if an error occurs creating the container.
    `java.lang.IllegalArgumentException` - if `u` is null

### create

    public static com.sun.net.httpserver.HttpServer create(java.lang.String u,
                                                           ResourceConfig rc,
                                                           IoCComponentProviderFactory factory)
                                                    throws java.io.IOException,
                                                           java.lang.IllegalArgumentException

  Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource and provder classes declared by the resource configuration.

  This implementation defers to the `ContainerFactory.createContainer(Class, ResourceConfig)` method for creating an HttpHandler that manages the root resources.

  Parameters:
    `u` - the URI to create the http server. The URI scheme must be equal to "http" or "https". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path must not be null or an empty string, and must not absolute (start with a '/' character). The URI path is used as the context of the HTTP handler (and corresponds to the base path). The URI query and fragment components are ignored.
    `rc` - the resource configuration.
    `factory` - the IoC component provider factory the web application delegates to for obtaining instances of resource and provider classes. May be null if the web application is responsible for instantiating resource and provider classes.
  Returns:
    the http server
  Throws:
    `java.io.IOException` - if an error occurs creating the container.
    `java.lang.IllegalArgumentException` - if `u` is null

### create

    public static com.sun.net.httpserver.HttpServer create(java.net.URI u,
                                                           ResourceConfig rc,
                                                           IoCComponentProviderFactory factory)
                                                    throws java.io.IOException,
                                                           java.lang.IllegalArgumentException

  Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource and provder classes declared by the resource configuration.

  This implementation defers to the `ContainerFactory.createContainer(Class, ResourceConfig)` method for creating an HttpHandler that manages the root resources.

  Parameters:
    `u` - the URI to create the http server. The URI scheme must be equal to "http" or "https". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path must not be null or an empty string, and must not absolute (start with a '/' character). The URI path is used as the context of the HTTP handler (and corresponds to the base path). The URI query and fragment components are ignored.
    `rc` - the resource configuration.
    `factory` - the IoC component provider factory the web application delegates to for obtaining instances of resource and provider classes. May be null if the web application is responsible for instantiating resource and provider classes.
  Returns:
    the http server
  Throws:
    `java.io.IOException` - if an error occurs creating the container.
    `java.lang.IllegalArgumentException` - if `u` is null

### create

    public static com.sun.net.httpserver.HttpServer create(java.lang.String u,
                                                           com.sun.net.httpserver.HttpHandler handler)
                                                    throws java.io.IOException,
                                                           java.lang.IllegalArgumentException

  Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource classes found by searching the classes referenced in the java classath.

  Parameters:
    `u` - the URI to create the http server. The URI scheme must be equal to "http" or "https". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path must not be null or an empty string, and must not absolute (start with a '/' character). The URI path is used as the context of the HTTP handler (and corresponds to the base path). The URI query and fragment components are ignored.
    `handler` - the HTTP handler
  Returns:
    the http server
  Throws:
    `java.io.IOException` - if an error occurs creating the container.
    `java.lang.IllegalArgumentException` - if `u` is null

### create

    public static com.sun.net.httpserver.HttpServer create(java.net.URI u,
                                                           com.sun.net.httpserver.HttpHandler handler)
                                                    throws java.io.IOException,
                                                           java.lang.IllegalArgumentException

  Create a `HttpServer` that registers a HttpHandler that in turn manages all root resource classes found by searching the classes referenced in the java classath.

  Parameters:
    `u` - the URI to create the http server. The URI scheme must be equal to "http" or "https". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path must not be null or an empty string, and must not absolute (start with a '/' character). The URI path is used as the context of the HTTP handler (and corresponds to the base path). The URI query and fragment components are ignored.
    `handler` - the HTTP handler
  Returns:
    the http server
  Throws:
    `java.io.IOException` - if an error occurs creating the container.
    `java.lang.IllegalArgumentException` - if `u` is null

Copyright © 2017 Oracle Corporation. All Rights Reserved.