Class Jetty6xEmbeddedLocalContainer

    • Field Detail

      • defaultRealm

        protected Object defaultRealm
        A default security realm. If ServletPropertySet.USERS has been specified, then we create a default realm containing those users and then force that realm to be associated with every webapp (see TODO comment on setSecurityRealm())
      • contextHandlers

        protected Object contextHandlers
        The ContextHandlerCollection into which deployed webapps are added.
      • handlerClass

        protected Class handlerClass
        The org.mortbay.jetty.handler.Handler class.
      • handlers

        protected Object handlers
        The org.mortbay.jetty.handler.HandlerCollection instance.
      • addHandlerMethod

        protected Method addHandlerMethod
        The method to call to add a handler for a webapp.
      • removeHandlerMethod

        protected Method removeHandlerMethod
        The method to call to undeploy a handler for a webapp.
    • Method Detail

      • getId

        public String getId()
        Returns:
        the short name of the container. Note: this is not a unique id. It is simply the name in a computer-usable format.
      • getName

        public String getName()
        Returns:
        the human readable name of the Container (ex: "Resin 3.x", "JBoss 3.0.8", etc).
      • setDefaultRealm

        public void setDefaultRealm​(Object webapp)
                             throws Exception
        If a default realm is available, set it on the given webapp.
        Parameters:
        webapp - the webapp to set the realm on
        Throws:
        Exception - on invokation error
      • addDeployables

        protected void addDeployables()
                               throws Exception
        Add the cargo deployables and the Cargo Ping Check.
        Throws:
        Exception - thrown if the deployables could not be added
      • createHandler

        public Object createHandler​(Deployable deployable)
                             throws Exception
        Create a WebAppContext for the Deployable. NB also force the defaultRealm to be set on it if one is present.
        Parameters:
        deployable - the cargo webapp to deploy
        Returns:
        a jetty webapp
        Throws:
        Exception - on invokation exception
      • createHandler

        public Object createHandler​(String contextPath,
                                    String war)
                             throws Exception
        Create a WebAppContext for the webapp given as a string. NB Also force the defaultRealm to be set if one is present.
        Parameters:
        contextPath - the context path for the webapp
        war - the webapp
        Returns:
        a jetty webapp
        Throws:
        Exception - on invokation exception
      • addHandler

        public void addHandler​(Object handler)
                        throws Exception
        Deploy the handler representing the webapp to jetty. If jetty is already started, then start the handler.
        Parameters:
        handler - the handler representing the webapp
        Throws:
        Exception - on invocation exception
      • removeHandler

        public void removeHandler​(Object handler)
                           throws Exception
        Undeploy the handler representing the webapp.
        Parameters:
        handler - the handler representing the webapp
        Throws:
        Exception - on invocation exception
      • setSecurityRealm

        protected void setSecurityRealm()
                                 throws Exception
        Defines a security realm and adds defined users to it. If a user has specified the standard ServletPropertySet.USERS property, then we try and turn these into an in-memory default realm, and then set that realm on all of the webapps. TODO: this is not ideal. We need a way to specify N named realms to the server so that individual webapps can find their appropriate realms by name.
        Throws:
        Exception - in case of error
      • startJetty

        protected void startJetty()
        Starts the Jetty server.