Class HTTPControllerServer
- java.lang.Object
-
- dk.netarkivet.viewerproxy.CommandResolver
-
- dk.netarkivet.viewerproxy.distribute.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.
-
-
Field Summary
-
Fields inherited from class dk.netarkivet.viewerproxy.CommandResolver
ur, VIEWERPROXY_COMMAND_NAME
-
Fields inherited from interface dk.netarkivet.viewerproxy.URIResolver
NOT_FOUND
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
executeCommand(Request request, Response response)
Handles parsing of the URL and delegating to relevant methods.-
Methods inherited from class dk.netarkivet.viewerproxy.CommandResolver
isCommandHostRequest, lookup, setURIResolver
-
-
-
-
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 classCommandResolver
- Parameters:
request
- The request to checkresponse
- 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
-
-