Class JdkHttpHandlerContainer

  • All Implemented Interfaces:
    com.sun.net.httpserver.HttpHandler, Container

    public class JdkHttpHandlerContainer
    extends java.lang.Object
    implements com.sun.net.httpserver.HttpHandler, Container
    Jersey Container implementation based on Java SE HttpServer.
    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
    • Constructor Detail

      • JdkHttpHandlerContainer

        JdkHttpHandlerContainer​(javax.ws.rs.core.Application application)
        Create new lightweight Java SE HTTP server container.
        Parameters:
        application - JAX-RS / Jersey application to be deployed on the container.
      • JdkHttpHandlerContainer

        JdkHttpHandlerContainer​(javax.ws.rs.core.Application application,
                                java.lang.Object parentContext)
        Create new lightweight Java SE HTTP server container.
        Parameters:
        application - JAX-RS / Jersey application to be deployed on the container.
        parentContext - DI provider specific context with application's registered bindings.
    • Method Detail

      • handle

        public void handle​(com.sun.net.httpserver.HttpExchange exchange)
                    throws java.io.IOException
        Specified by:
        handle in interface com.sun.net.httpserver.HttpHandler
        Throws:
        java.io.IOException
      • getBaseUri

        private java.net.URI getBaseUri​(com.sun.net.httpserver.HttpExchange exchange,
                                        java.lang.String decodedBasePath,
                                        java.lang.String scheme)
      • getRequestUri

        private java.net.URI getRequestUri​(com.sun.net.httpserver.HttpExchange exchange,
                                           java.net.URI baseUri)
      • getServerAddress

        private java.lang.String getServerAddress​(java.net.URI baseUri)
                                           throws java.net.URISyntaxException
        Throws:
        java.net.URISyntaxException
      • getSecurityContext

        private javax.ws.rs.core.SecurityContext getSecurityContext​(java.security.Principal principal,
                                                                    boolean isSecure)
      • reload

        public void reload()
        Description copied from interface: Container
        Reload the hosted Jersey application using the current configuration.
        Specified by:
        reload in interface Container
      • reload

        public void reload​(ResourceConfig configuration)
        Description copied from interface: Container
        Reload the hosted Jersey application using a new configuration.
        Specified by:
        reload in interface Container
        Parameters:
        configuration - new configuration used for the reload.
      • getApplicationHandler

        public ApplicationHandler getApplicationHandler()
        Description copied from interface: Container
        Get the Jersey server-side application handler associated with the container.
        Specified by:
        getApplicationHandler in interface Container
        Returns:
        Jersey server-side application handler associated with the container.
      • onServerStart

        void onServerStart()
        Inform this container that the server has been started. This method must be implicitly called after the server containing this container is started.
      • onServerStop

        void onServerStop()
        Inform this container that the server is being stopped. This method must be implicitly called before the server containing this container is stopped.