Class AdminAdapter

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AdminAdapter​(Class<? extends Privacy> privacyClass)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void afterService​(org.glassfish.grizzly.http.server.Request req, org.glassfish.grizzly.http.server.Response res)
      Finish the response and recycle the request/response tokens.
      AdminAccessController.Access authenticate​(org.glassfish.grizzly.http.server.Request req)  
      String createSessionId()
      This will create a new sessionId and add the server name as a jvmroute information to it
      void event​(EventListener.Event event)
      Process a Glassfish/Payara event
      void fireAdapterEvent​(String type, Object data)
      Notify all container event listeners that a particular event has occurred for this Adapter.
      String getCookieHeader​(org.glassfish.grizzly.http.server.Request req)
      This will create a unique SessionId, Max-Age,Version,Path to be added to the Set-Cookie header
      org.glassfish.grizzly.http.server.HttpHandler getHttpService()
      Get the underlying Grizzly HttpHandler.
      String[] getJSESSIONIDHeaders​(org.glassfish.grizzly.http.server.Request req)
      This method will return the Cookie header with name JSESSIONID="..."
      InetAddress getListenAddress()  
      int getListenPort()
      Returns the listener port for this adapter
      static String[] getUserPassword​(org.glassfish.grizzly.http.server.Request req)
      A convenience method to extract user name from a request.
      List<String> getVirtualServers()
      Returns the virtual servers supported by this adapter
      boolean hasCookieHeader​(org.glassfish.grizzly.http.server.Request req)
      This method checks if the request has a Cookie header and if the instance name serving the request is the same as the jvmRoute information
      boolean isRegistered()
      Checks whether this adapter has been registered as a network endpoint.
      boolean isSingleInstanceCommand​(String commandName)
      This method checks if this command has @ExecuteOn annotation with RuntimeType.SINGle_INSTANCE
      void onMissingResource​(org.glassfish.grizzly.http.server.Request req, org.glassfish.grizzly.http.server.Response res)
      Call the service method, and notify all listeners
      void postConstruct()  
      void setRegistered​(boolean isRegistered)
      Marks this adapter as having been registered or unregistered as a network endpoint
      protected abstract boolean validatePrivacy​(AdminCommand command)  
      • Methods inherited from class org.glassfish.grizzly.http.server.StaticHttpHandler

        addDocRoot, addDocRoot, getDefaultDocRoot, getDocRoots, handle, isDirectorySlashOff, removeDocRoot, setDirectorySlashOff
      • Methods inherited from class org.glassfish.grizzly.http.server.StaticHttpHandlerBase

        addCachingHeaders, addToFileCache, getRelativeURI, isFileCacheEnabled, lookupFileCache, pickupContentType, sendFile, service, setFileCacheEnabled
      • Methods inherited from class org.glassfish.grizzly.http.server.HttpHandler

        destroy, getErrorPageGenerator, getName, getRequestExecutorProvider, getRequestURIEncoding, getSessionCookieName, getSessionManager, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setDispatcherHelper, setRequestURIEncoding, setRequestURIEncoding, start, updatePaths
    • Constructor Detail

      • AdminAdapter

        protected AdminAdapter​(Class<? extends Privacy> privacyClass)
    • Method Detail

      • getHttpService

        public final org.glassfish.grizzly.http.server.HttpHandler getHttpService()
        Description copied from interface: Adapter
        Get the underlying Grizzly HttpHandler.
        Specified by:
        getHttpService in interface Adapter
        Returns:
        the underlying Grizzly HttpHandler.
      • postConstruct

        public void postConstruct()
        Specified by:
        postConstruct in interface org.glassfish.hk2.api.PostConstruct
      • onMissingResource

        public void onMissingResource​(org.glassfish.grizzly.http.server.Request req,
                                      org.glassfish.grizzly.http.server.Response res)
        Call the service method, and notify all listeners
        Overrides:
        onMissingResource in class org.glassfish.grizzly.http.server.StaticHttpHandlerBase
        Throws:
        RuntimeException - if an error happens during handling of the request. Common errors are:
        • IOException if an input/output error occurs and we are processing an included servlet (otherwise it is swallowed and handled by the top level error handler mechanism)
        • ServletException if a servlet throws an exception and we are processing an included servlet (otherwise it is swallowed and handled by the top level error handler mechanism)
        Tomcat should be able to handle and log any other exception ( including runtime exceptions )
      • hasCookieHeader

        public boolean hasCookieHeader​(org.glassfish.grizzly.http.server.Request req)
        This method checks if the request has a Cookie header and if the instance name serving the request is the same as the jvmRoute information
        Parameters:
        req - Request to examine the Cookie header
        Returns:
        true if the Cookie header is set and the jvmRoute information is the same as the instance serving the request , false otherwise
      • getJSESSIONIDHeaders

        public String[] getJSESSIONIDHeaders​(org.glassfish.grizzly.http.server.Request req)
        This method will return the Cookie header with name JSESSIONID="..."
        Parameters:
        req - The request which may contain cookie headers
        Returns:
        cookie header
      • isSingleInstanceCommand

        public boolean isSingleInstanceCommand​(String commandName)
        This method checks if this command has @ExecuteOn annotation with RuntimeType.SINGle_INSTANCE
        Parameters:
        commandName - the command which is executed
        Returns:
        true only if @ExecuteOn has RuntimeType.SINGLE_INSTANCE false for other cases
      • getCookieHeader

        public String getCookieHeader​(org.glassfish.grizzly.http.server.Request req)
        This will create a unique SessionId, Max-Age,Version,Path to be added to the Set-Cookie header
        Returns:
        Set-Cookie2 header
      • createSessionId

        public String createSessionId()
        This will create a new sessionId and add the server name as a jvmroute information to it
        Returns:
        String to be used for the JSESSIONID Set-Cookie2 header
      • getUserPassword

        public static String[] getUserPassword​(org.glassfish.grizzly.http.server.Request req)
                                        throws IOException
        A convenience method to extract user name from a request. It assumes the HTTP Basic Auth.
        Parameters:
        req - instance of Request
        Returns:
        a two-element string array. If Auth header exists and can be correctly decoded, returns the user name and password as the two elements. If any error occurs or if the header does not exist, returns an array with two blank strings. Never returns a null.
        Throws:
        IOException - in case of error with decoding the buffer (HTTP basic auth)
      • validatePrivacy

        protected abstract boolean validatePrivacy​(AdminCommand command)
      • afterService

        public void afterService​(org.glassfish.grizzly.http.server.Request req,
                                 org.glassfish.grizzly.http.server.Response res)
                          throws Exception
        Finish the response and recycle the request/response tokens. Base on the connection header, the underlying socket transport will be closed
        Throws:
        Exception
      • fireAdapterEvent

        public void fireAdapterEvent​(String type,
                                     Object data)
        Notify all container event listeners that a particular event has occurred for this Adapter. The default implementation performs this notification synchronously using the calling thread.
        Parameters:
        type - Event type
        data - Event data
      • getListenPort

        public int getListenPort()
        Description copied from interface: Adapter
        Returns the listener port for this adapter
        Specified by:
        getListenPort in interface Adapter
        Returns:
        listener port
      • getVirtualServers

        public List<String> getVirtualServers()
        Description copied from interface: Adapter
        Returns the virtual servers supported by this adapter
        Specified by:
        getVirtualServers in interface Adapter
        Returns:
        List<String> the virtual server list supported by the adapter
      • isRegistered

        public boolean isRegistered()
        Checks whether this adapter has been registered as a network endpoint.
        Specified by:
        isRegistered in interface Adapter
      • setRegistered

        public void setRegistered​(boolean isRegistered)
        Marks this adapter as having been registered or unregistered as a network endpoint
        Specified by:
        setRegistered in interface Adapter