Package dk.netarkivet.viewerproxy
Class UnknownCommandResolver
- java.lang.Object
-
- dk.netarkivet.viewerproxy.CommandResolver
-
- dk.netarkivet.viewerproxy.UnknownCommandResolver
-
- All Implemented Interfaces:
URIResolver
,URIResolverHandler
public class UnknownCommandResolver extends CommandResolver
Wrapper for an URIResolver, which gives failures on specific specific URLs, and forwards all others to the wrapped handler. This allows you to reserve a specific host for commands and get a well-defined error if giving an undefined command.
-
-
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 UnknownCommandResolver(URIResolver ur)
Make a new UnknownCommandResolver, which gives an error for any command- like URL and forwards other URLs to the given URIResolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
executeCommand(Request request, Response response)
Helper method that checks if this is a command URL and throw an error if it is.-
Methods inherited from class dk.netarkivet.viewerproxy.CommandResolver
isCommandHostRequest, lookup, setURIResolver
-
-
-
-
Constructor Detail
-
UnknownCommandResolver
public UnknownCommandResolver(URIResolver ur)
Make a new UnknownCommandResolver, which gives an error for any command- like URL and forwards other URLs to the given URIResolver.- Parameters:
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)
Helper method that checks if this is a command URL and throw an error if it is.- Specified by:
executeCommand
in classCommandResolver
- Parameters:
request
- The request to checkresponse
- The response to give command results to if it is a command- Returns:
- Whether this was a command URL
-
-