Class JettyWebContainerFactory


  • public final class JettyWebContainerFactory
    extends java.lang.Object
    Factory for creating and starting Jetty Server instances for deploying a Servlet.

    The default deployed server is an instance of ServletContainer.

    If no initialization parameters are declared (or is null) then root resource and provider classes will be found by searching the classes referenced in the java classpath.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.eclipse.jetty.server.Server create​(java.lang.String u)
      Create a Server that registers the ServletContainer.
      static org.eclipse.jetty.server.Server create​(java.lang.String u, java.lang.Class<? extends javax.servlet.Servlet> c)
      Create a Server that registers the declared servlet class.
      static org.eclipse.jetty.server.Server create​(java.lang.String u, java.lang.Class<? extends javax.servlet.Servlet> c, java.util.Map<java.lang.String,​java.lang.String> initParams)
      Create a Server that registers the declared servlet class.
      static org.eclipse.jetty.server.Server create​(java.lang.String u, java.util.Map<java.lang.String,​java.lang.String> initParams)
      Create a Server that registers the ServletContainer.
      static org.eclipse.jetty.server.Server create​(java.net.URI u)
      Create a Server that registers the ServletContainer.
      static org.eclipse.jetty.server.Server create​(java.net.URI u, java.lang.Class<? extends javax.servlet.Servlet> c)
      Create a Server that registers the declared servlet class.
      static org.eclipse.jetty.server.Server create​(java.net.URI u, java.lang.Class<? extends javax.servlet.Servlet> c, java.util.Map<java.lang.String,​java.lang.String> initParams)
      Create a Server that registers the declared servlet class.
      private static org.eclipse.jetty.server.Server create​(java.net.URI u, java.lang.Class<? extends javax.servlet.Servlet> c, javax.servlet.Servlet servlet, java.util.Map<java.lang.String,​java.lang.String> initParams, java.util.Map<java.lang.String,​java.lang.String> contextInitParams)  
      static org.eclipse.jetty.server.Server create​(java.net.URI u, java.util.Map<java.lang.String,​java.lang.String> initParams)
      Create a Server that registers the ServletContainer.
      static org.eclipse.jetty.server.Server create​(java.net.URI u, javax.servlet.Servlet servlet, java.util.Map<java.lang.String,​java.lang.String> initParams, java.util.Map<java.lang.String,​java.lang.String> contextInitParams)
      Create a Server that registers the declared servlet instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JettyWebContainerFactory

        private JettyWebContainerFactory()
    • Method Detail

      • create

        public static org.eclipse.jetty.server.Server create​(java.lang.String u)
                                                      throws java.lang.Exception
        Create a Server that registers the ServletContainer.
        Parameters:
        u - the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.
      • create

        public static org.eclipse.jetty.server.Server create​(java.lang.String u,
                                                             java.util.Map<java.lang.String,​java.lang.String> initParams)
                                                      throws java.lang.Exception
        Create a Server that registers the ServletContainer.
        Parameters:
        u - the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        initParams - the servlet initialization parameters.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.
      • create

        public static org.eclipse.jetty.server.Server create​(java.net.URI u)
                                                      throws java.lang.Exception
        Create a Server that registers the ServletContainer.
        Parameters:
        u - the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.
      • create

        public static org.eclipse.jetty.server.Server create​(java.net.URI u,
                                                             java.util.Map<java.lang.String,​java.lang.String> initParams)
                                                      throws java.lang.Exception
        Create a Server that registers the ServletContainer.
        Parameters:
        u - the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        initParams - the servlet initialization parameters.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.
      • create

        public static org.eclipse.jetty.server.Server create​(java.lang.String u,
                                                             java.lang.Class<? extends javax.servlet.Servlet> c)
                                                      throws java.lang.Exception
        Create a Server that registers the declared servlet class.
        Parameters:
        u - the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        c - the servlet class.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.
      • create

        public static org.eclipse.jetty.server.Server create​(java.lang.String u,
                                                             java.lang.Class<? extends javax.servlet.Servlet> c,
                                                             java.util.Map<java.lang.String,​java.lang.String> initParams)
                                                      throws java.lang.Exception
        Create a Server that registers the declared servlet class.
        Parameters:
        u - the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        c - the servlet class.
        initParams - the servlet initialization parameters.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.
      • create

        public static org.eclipse.jetty.server.Server create​(java.net.URI u,
                                                             java.lang.Class<? extends javax.servlet.Servlet> c)
                                                      throws java.lang.Exception
        Create a Server that registers the declared servlet class.
        Parameters:
        u - the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        c - the servlet class.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.
      • create

        public static org.eclipse.jetty.server.Server create​(java.net.URI u,
                                                             java.lang.Class<? extends javax.servlet.Servlet> c,
                                                             java.util.Map<java.lang.String,​java.lang.String> initParams)
                                                      throws java.lang.Exception
        Create a Server that registers the declared servlet class.
        Parameters:
        u - the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        c - the servlet class.
        initParams - the servlet initialization parameters.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.
      • create

        private static org.eclipse.jetty.server.Server create​(java.net.URI u,
                                                              java.lang.Class<? extends javax.servlet.Servlet> c,
                                                              javax.servlet.Servlet servlet,
                                                              java.util.Map<java.lang.String,​java.lang.String> initParams,
                                                              java.util.Map<java.lang.String,​java.lang.String> contextInitParams)
                                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • create

        public static org.eclipse.jetty.server.Server create​(java.net.URI u,
                                                             javax.servlet.Servlet servlet,
                                                             java.util.Map<java.lang.String,​java.lang.String> initParams,
                                                             java.util.Map<java.lang.String,​java.lang.String> contextInitParams)
                                                      throws java.lang.Exception
        Create a Server that registers the declared servlet instance.
        Parameters:
        u - the URI to create the HTTP server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI query and fragment components are ignored. Only first path segment will be used as context path, the rest will be ignored.
        servlet - the servlet instance.
        initParams - the servlet initialization parameters.
        contextInitParams - the servlet context initialization parameters.
        Returns:
        the http server, with the endpoint started.
        Throws:
        java.lang.Exception - if an error occurs creating the container.
        java.lang.IllegalArgumentException - if HTTP server URI is null.