Class HandlerRequest<R extends RequestBody>
java.lang.Object
org.apache.flink.runtime.rest.handler.HandlerRequest<R>
- Type Parameters:
R- type of the contained request body
Simple container for the request to a handler, that contains the
RequestBody and
path/query parameters.-
Method Summary
Modifier and TypeMethodDescriptionstatic <R extends RequestBody,M extends MessageParameters>
HandlerRequest<R>create(R requestBody, M messageParameters) Short-cut forcreate(RequestBody, MessageParameters, Collection)without any uploaded files.static <R extends RequestBody,M extends MessageParameters>
HandlerRequest<R>create(R requestBody, M messageParameters, Collection<File> uploadedFiles) Creates a newHandlerRequest.<X,PP extends MessagePathParameter<X>>
XgetPathParameter(Class<PP> parameterClass) Returns the value of theMessagePathParameterfor the given class.<X,QP extends MessageQueryParameter<X>>
List<X>getQueryParameter(Class<QP> parameterClass) Returns the value of theMessageQueryParameterfor the given class.Returns the request body.static <R extends RequestBody,M extends MessageParameters>
HandlerRequest<R>resolveParametersAndCreate(R requestBody, M messageParameters, Map<String, String> receivedPathParameters, Map<String, List<String>> receivedQueryParameters, Collection<File> uploadedFiles) Creates a newHandlerRequestafter resolving the givenMessageParametersagainst the given query/path parameter maps.
-
Method Details
-
getRequestBody
Returns the request body.- Returns:
- request body
-
getPathParameter
Returns the value of theMessagePathParameterfor the given class.- Type Parameters:
X- the value type that the parameter containsPP- type of the path parameter- Parameters:
parameterClass- class of the parameter- Returns:
- path parameter value for the given class
- Throws:
IllegalStateException- if no value is defined for the given parameter class
-
getQueryParameter
Returns the value of theMessageQueryParameterfor the given class.- Type Parameters:
X- the value type that the parameter containsQP- type of the query parameter- Parameters:
parameterClass- class of the parameter- Returns:
- query parameter value for the given class, or an empty list if no parameter value exists for the given class
-
getUploadedFiles
-
create
@VisibleForTesting public static <R extends RequestBody,M extends MessageParameters> HandlerRequest<R> create(R requestBody, M messageParameters) Short-cut forcreate(RequestBody, MessageParameters, Collection)without any uploaded files. -
create
@VisibleForTesting public static <R extends RequestBody,M extends MessageParameters> HandlerRequest<R> create(R requestBody, M messageParameters, Collection<File> uploadedFiles) Creates a newHandlerRequest. The givenMessageParametersare expected to be resolved. -
resolveParametersAndCreate
public static <R extends RequestBody,M extends MessageParameters> HandlerRequest<R> resolveParametersAndCreate(R requestBody, M messageParameters, Map<String, String> receivedPathParameters, Map<String, throws HandlerRequestExceptionList<String>> receivedQueryParameters, Collection<File> uploadedFiles) Creates a newHandlerRequestafter resolving the givenMessageParametersagainst the given query/path parameter maps.For tests it is recommended to resolve the parameters manually and use
create(R, M).- Throws:
HandlerRequestException
-