Package si.mazi.rescu
Class RestInvocation
java.lang.Object
si.mazi.rescu.RestInvocation
- All Implemented Interfaces:
Serializable
public class RestInvocation extends Object implements Serializable
This holds name-value mapping for various types of params used in REST (QueryParam, PathParam, FormParam, HeaderParam).
One RestInvocation instance corresponds to one method invocation.
- Author:
- Matija Mazi
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected static List<Class<? extends Annotation>>PARAM_ANNOTATION_CLASSES -
Method Summary
Modifier and Type Method Description static RestInvocationcreate(RequestWriterResolver requestWriterResolver, RestMethodMetadata methodMetadata, Object[] args, Map<Class<? extends Annotation>,Params> defaultParamsMap)static HashMap<Class<? extends Annotation>,Params>createEmptyParamsMap(Map<Class<? extends Annotation>,Params> defaultParamsMap)Map<String,String>getAllHttpHeaders()Deprecated.this method will be made package local very soon.StringgetBaseUrl()Map<String,String>getHttpHeadersFromParams()StringgetHttpMethod()StringgetInvocationUrl()RestMethodMetadatagetMethodMetadata()StringgetMethodPath()Map<Class<? extends Annotation>,Params>getParamsMap()ObjectgetParamValue(Class<? extends Annotation> paramAnnotation, String paramName)StringgetPath()StringgetQueryString()StringgetReqContentType()StringgetRequestBody()List<Object>getUnannanotatedParams()
-
Field Details
-
Method Details
-
create
public static RestInvocation create(RequestWriterResolver requestWriterResolver, RestMethodMetadata methodMetadata, Object[] args, Map<Class<? extends Annotation>,Params> defaultParamsMap) -
createEmptyParamsMap
public static HashMap<Class<? extends Annotation>,Params> createEmptyParamsMap(Map<Class<? extends Annotation>,Params> defaultParamsMap) -
getRequestBody
-
getAllHttpHeaders
Deprecated.this method will be made package local very soon. UsegetHttpHeadersFromParams()instead.- Returns:
-
getHttpHeadersFromParams
-
getReqContentType
-
getInvocationUrl
- Returns:
- The invocation url that is used in this invocation.
-
getMethodPath
- Returns:
- The part of the url path that corresponds to the method.
-
getPath
- Returns:
- The whole url path: the interface path together with the method path. This is usally the part of the url that follows the host name.
-
getBaseUrl
- Returns:
- The base of the url: this usually contains the protocol (eg. http) and the host name (eg. http://www.example.com/) but may be longer.
-
getQueryString
- Returns:
- The part of the invocation url that follows the '?' charater, ie. the &-separated name=value parameter pairs.
-
getHttpMethod
- Returns:
- The HTTP method used in this invocation e.g. GET or POST
-
getMethodMetadata
-
getParamValue
- Parameters:
paramAnnotation- One ofQueryParam.class,PathParam.class,FormParam.class,HeaderParam.classparamName- The name of the parameter, ie. the value of the value() element in the annotation.- Returns:
- The actual value that was passed as the argument in the method call; null if either no parameter with the given name exists or null was passed as argument.
-
getParamsMap
- Returns:
- the paramsMap
-
getUnannanotatedParams
- Returns:
- the unannanotatedParams
-