Class HTTPControllerServer

  • All Implemented Interfaces:
    URIResolver, URIResolverHandler

    public class HTTPControllerServer
    extends CommandResolver
    Wrapper for an URIResolver, which calls the controller methods on given specific URLs, and forwards all others to the wrapped handler. This allows you to access control methods by giving specific urls to this class.
    • Constructor Detail

      • HTTPControllerServer

        public HTTPControllerServer​(Controller c,
                                    URIResolver ur)
        Make a new HTTPControllerServer, which calls commands on the given controller, and forwards all other requests to the given URIResolver.
        Parameters:
        c - The controller which handles commands given in command URLs.
        ur - The URIResolver to handle all other uris.
        Throws:
        ArgumentNotValid - if either argument is null.
    • Method Detail

      • executeCommand

        protected boolean executeCommand​(Request request,
                                         Response response)
        Handles parsing of the URL and delegating to relevant methods. The commands are of the form http://<>/<>?<>=<>* Known commands are the following: start - params: returnURL - effect: start url collection return to returnURL stop - params: returnURL - effect: stop url collection return to returnURL clear - params: returnURL - effect: clear url collection return to returnURL getRecordedURIs - params: none - effect: write url collection to response changeIndex - params: jobID*, - effect: generate index for jobs, returnURL return to returnURL getStatus - params: locale - effect: write status to response.
        Specified by:
        executeCommand in class CommandResolver
        Parameters:
        request - The request to check
        response - The response to give command results to if it is a command. If the request is one of these commands, the response code is set to 303 if page is redirected to return url; 200 if command url returns data; otherwise whatever is returned by the wrapped resolver
        Returns:
        Whether this was a command URL