Class CustomHeadersDecorator<R extends RequestBody,P extends ResponseBody,M extends MessageParameters>
- java.lang.Object
-
- org.apache.flink.runtime.rest.messages.CustomHeadersDecorator<R,P,M>
-
- All Implemented Interfaces:
RestHandlerSpecification
,MessageHeaders<R,P,M>
,UntypedResponseMessageHeaders<R,M>
public class CustomHeadersDecorator<R extends RequestBody,P extends ResponseBody,M extends MessageParameters> extends Object implements MessageHeaders<R,P,M>
Decorator class forMessageHeaders
that adds the ability to include custom HTTP headers.
-
-
Constructor Summary
Constructors Constructor Description CustomHeadersDecorator(MessageHeaders<R,P,M> decorated)
Creates a newCustomHeadersDecorator
for a givenMessageHeaders
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCustomHeader(HttpHeader httpHeader)
Adds a custom header to the message.Collection<HttpHeader>
getCustomHeaders()
Returns the custom headers added to the message.MessageHeaders<R,P,M>
getDecorated()
String
getDescription()
Returns the description for this header.HttpMethodWrapper
getHttpMethod()
Returns theHttpMethodWrapper
to be used for the request.Class<R>
getRequestClass()
Returns the class of the request message.Class<P>
getResponseClass()
Returns the class of the response message.org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus
getResponseStatusCode()
Returns the http status code for the response.Collection<Class<?>>
getResponseTypeParameters()
Returns the collection of type parameters for the response type.Collection<? extends RestAPIVersion<?>>
getSupportedAPIVersions()
Returns the supported API versions that this request supports.String
getTargetRestEndpointURL()
Returns the generalized endpoint url that this request should be sent to, for example/job/:jobid
.M
getUnresolvedMessageParameters()
Returns a newMessageParameters
object.void
setCustomHeaders(Collection<HttpHeader> customHeaders)
Sets the custom headers for the message.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.rest.messages.MessageHeaders
operationId
-
Methods inherited from interface org.apache.flink.runtime.rest.messages.UntypedResponseMessageHeaders
acceptsFileUploads
-
-
-
-
Constructor Detail
-
CustomHeadersDecorator
public CustomHeadersDecorator(MessageHeaders<R,P,M> decorated)
Creates a newCustomHeadersDecorator
for a givenMessageHeaders
object.- Parameters:
decorated
- The MessageHeaders to decorate.
-
-
Method Detail
-
getHttpMethod
public HttpMethodWrapper getHttpMethod()
Description copied from interface:RestHandlerSpecification
Returns theHttpMethodWrapper
to be used for the request.- Specified by:
getHttpMethod
in interfaceRestHandlerSpecification
- Returns:
- http method to be used for the request
-
getTargetRestEndpointURL
public String getTargetRestEndpointURL()
Description copied from interface:RestHandlerSpecification
Returns the generalized endpoint url that this request should be sent to, for example/job/:jobid
.- Specified by:
getTargetRestEndpointURL
in interfaceRestHandlerSpecification
- Returns:
- endpoint url that this request should be sent to
-
getSupportedAPIVersions
public Collection<? extends RestAPIVersion<?>> getSupportedAPIVersions()
Description copied from interface:RestHandlerSpecification
Returns the supported API versions that this request supports.- Specified by:
getSupportedAPIVersions
in interfaceRestHandlerSpecification
- Returns:
- Collection of supported API versions
-
getResponseClass
public Class<P> getResponseClass()
Description copied from interface:MessageHeaders
Returns the class of the response message.- Specified by:
getResponseClass
in interfaceMessageHeaders<R extends RequestBody,P extends ResponseBody,M extends MessageParameters>
- Returns:
- class of the response message
-
getResponseStatusCode
public org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus getResponseStatusCode()
Description copied from interface:MessageHeaders
Returns the http status code for the response.- Specified by:
getResponseStatusCode
in interfaceMessageHeaders<R extends RequestBody,P extends ResponseBody,M extends MessageParameters>
- Returns:
- http status code of the response
-
getDescription
public String getDescription()
Description copied from interface:MessageHeaders
Returns the description for this header.- Specified by:
getDescription
in interfaceMessageHeaders<R extends RequestBody,P extends ResponseBody,M extends MessageParameters>
- Returns:
- description for the header
-
getRequestClass
public Class<R> getRequestClass()
Description copied from interface:UntypedResponseMessageHeaders
Returns the class of the request message.- Specified by:
getRequestClass
in interfaceUntypedResponseMessageHeaders<R extends RequestBody,P extends ResponseBody>
- Returns:
- class of the request message
-
getUnresolvedMessageParameters
public M getUnresolvedMessageParameters()
Description copied from interface:UntypedResponseMessageHeaders
Returns a newMessageParameters
object.- Specified by:
getUnresolvedMessageParameters
in interfaceUntypedResponseMessageHeaders<R extends RequestBody,P extends ResponseBody>
- Returns:
- new message parameters object
-
getCustomHeaders
public Collection<HttpHeader> getCustomHeaders()
Returns the custom headers added to the message.- Specified by:
getCustomHeaders
in interfaceMessageHeaders<R extends RequestBody,P extends ResponseBody,M extends MessageParameters>
- Returns:
- The custom headers as a collection of
HttpHeader
.
-
getResponseTypeParameters
public Collection<Class<?>> getResponseTypeParameters()
Description copied from interface:MessageHeaders
Returns the collection of type parameters for the response type.- Specified by:
getResponseTypeParameters
in interfaceMessageHeaders<R extends RequestBody,P extends ResponseBody,M extends MessageParameters>
- Returns:
- Collection of type parameters for the response type
-
setCustomHeaders
public void setCustomHeaders(Collection<HttpHeader> customHeaders)
Sets the custom headers for the message.- Parameters:
customHeaders
- A collection of custom headers.
-
addCustomHeader
public void addCustomHeader(HttpHeader httpHeader)
Adds a custom header to the message. Initializes the custom headers collection if it hasn't been initialized yet.- Parameters:
httpHeader
- The header to add.
-
getDecorated
public MessageHeaders<R,P,M> getDecorated()
-
-