Package org.restlet.util
Class Resolver<T>
- java.lang.Object
-
- org.restlet.util.Resolver<T>
-
public abstract class Resolver<T> extends java.lang.Object
Resolves a name into a value. By default, thecreateResolver(Map)
static method can adapt a Java map into a resolver. Another useful method iscreateResolver(Request, Response)
, which can expose a Restlet call into a compact data model, with the following variables:list of supported variables Model property Variable name Content type request.confidential c boolean (true|false) request.clientInfo.address cia String request.clientInfo.upstreamAddress ciua String request.clientInfo.agent cig String request.challengeResponse.identifier cri String request.challengeResponse.scheme crs String request.date d Date (HTTP format) request.entity.characterSet ecs String response.entity.characterSet ECS String request.entity.encoding ee String response.entity.encoding EE String request.entity.expirationDate eed Date (HTTP format) response.entity.expirationDate EED Date (HTTP format) request.entity.language el String response.entity.language EL String request.entity.modificationDate emd Date (HTTP format) response.entity.modificationDate EMD Date (HTTP format) request.entity.mediaType emt String response.entity.mediaType EMT String request.entity.size es Integer response.entity.size ES Integer request.entity.tag et String response.entity.tag ET String request.referrerRef f* Reference (see table below variable name sub-parts) request.hostRef h* Reference (see table below variable name sub-parts) request.method m String request.rootRef o* Reference (see table below variable name sub-parts) request.protocol p String request.resourceRef r* Reference (see table below variable name sub-parts) response.redirectRef R* Reference (see table below variable name sub-parts) response.status S Integer response.serverInfo.address SIA String response.serverInfo.agent SIG String response.serverInfo.port SIP Integer
Below is the list of name sub-parts, for Reference variables, that can replace the asterix in the variable names above:
list of name sub-parts, for Reference variables, that can replace the asterix in the variable names above Reference property Sub-part name Content type authority a String baseRef b* Reference targetRef t* Reference relativePart e String fragment f String hostIdentifier h String identifier i String path p String query q String remainingPart r String - Author:
- Jerome Louvel
-
-
Constructor Summary
Constructors Constructor Description Resolver()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Resolver<?>
createResolver(java.util.Map<java.lang.String,?> map)
Creates a resolver that is based on a given map.static Resolver<?>
createResolver(Request request, Response response)
Creates a resolver that is based on a call (request, response couple).abstract T
resolve(java.lang.String name)
Resolves a name into a value.
-
-
-
Method Detail
-
createResolver
public static Resolver<?> createResolver(java.util.Map<java.lang.String,?> map)
Creates a resolver that is based on a given map.- Parameters:
map
- Map between names and values.- Returns:
- The map resolver.
-
createResolver
public static Resolver<?> createResolver(Request request, Response response)
Creates a resolver that is based on a call (request, response couple). It first looks up the response attributes, then the request attributes and finally the variables listed in this class Javadocs above.- Parameters:
request
- The request.response
- The response.- Returns:
- The call resolver.
-
resolve
public abstract T resolve(java.lang.String name)
Resolves a name into a value.- Parameters:
name
- The name to resolve.- Returns:
- The resolved value.
-
-