Class ClientRequestContextImpl
- All Implemented Interfaces:
ClientRequestContext
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAbort the filter chain with a response.Get a list of languages that are acceptable for the response.Get a list of media types that are acceptable for the response.Get the client instance associated with the request.Get the immutable configuration of the request.Get any cookies that accompanied the request.getDate()Get message date.Get the message entity Java instance.Get the annotations attached to the entity instance.Class<?>Get the raw entity type information.Get the entity output stream.Get the generic entity type information.Get the mutable request headers multivalued map.getHeaderString(String name) Get a message header as a single string value.exposes the client invocation for easier integration with other librariesGet the language of the entity.Get the media type of the entity.Get the request method.getProperty(String name) Returns the property with the given name registered in the current request/response exchange context, ornullif there is no property by that name.Returns an immutablecollectioncontaining the property names available within the context of the current request/response exchange context.Get a string view of header values associated with the message.getUri()Get the request URI.booleanCheck if there is an entity available in the request.voidremoveProperty(String name) Removes a property with the given name from the current request/response exchange context.voidSet a new message entity.voidsetEntity(Object entity, Annotation[] annotations, MediaType mediaType) Set a new message entity, including the attached annotations and the media type.voidsetEntityStream(OutputStream entityStream) Set a new entity output stream.voidSet the request method.voidsetProperty(String name, Object object) Binds an object to a given property name in the current request/response exchange context.voidSet a new request URI.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.ws.rs.client.ClientRequestContext
hasProperty
-
Field Details
-
invocation
-
abortedWithResponse
-
-
Constructor Details
-
ClientRequestContextImpl
-
-
Method Details
-
getAbortedWithResponse
-
getProperty
Description copied from interface:ClientRequestContextReturns the property with the given name registered in the current request/response exchange context, ornullif there is no property by that name.A property allows a JAX-RS filters and interceptors to exchange additional custom information not already provided by this interface.
A list of supported properties can be retrieved using
ClientRequestContext.getPropertyNames(). Custom property names should follow the same convention as package names.- Specified by:
getPropertyin interfaceClientRequestContext- Parameters:
name- aStringspecifying the name of the property.- Returns:
- an
Objectcontaining the value of the property, ornullif no property exists matching the given name. - See Also:
-
getPropertyNames
Description copied from interface:ClientRequestContextReturns an immutablecollectioncontaining the property names available within the context of the current request/response exchange context.Use the
ClientRequestContext.getProperty(java.lang.String)method with a property name to get the value of a property.- Specified by:
getPropertyNamesin interfaceClientRequestContext- Returns:
- an immutable
collectionof property names. - See Also:
-
setProperty
Description copied from interface:ClientRequestContextBinds an object to a given property name in the current request/response exchange context. If the name specified is already used for a property, this method will replace the value of the property with the new value.A property allows a JAX-RS filters and interceptors to exchange additional custom information not already provided by this interface.
A list of supported properties can be retrieved using
ClientRequestContext.getPropertyNames(). Custom property names should follow the same convention as package names.If a
nullvalue is passed, the effect is the same as calling theClientRequestContext.removeProperty(String)method.- Specified by:
setPropertyin interfaceClientRequestContext- Parameters:
name- aStringspecifying the name of the property.object- anObjectrepresenting the property to be bound.
-
removeProperty
Description copied from interface:ClientRequestContextRemoves a property with the given name from the current request/response exchange context. After removal, subsequent calls toClientRequestContext.getProperty(java.lang.String)to retrieve the property value will returnnull.- Specified by:
removePropertyin interfaceClientRequestContext- Parameters:
name- aStringspecifying the name of the property to be removed.
-
getEntityClass
Description copied from interface:ClientRequestContextGet the raw entity type information.- Specified by:
getEntityClassin interfaceClientRequestContext- Returns:
- raw entity type.
-
getEntityType
Description copied from interface:ClientRequestContextGet the generic entity type information.- Specified by:
getEntityTypein interfaceClientRequestContext- Returns:
- generic entity type.
-
setEntity
Description copied from interface:ClientRequestContextSet a new message entity. The existing entityannotationsandmedia typeare preserved.It is the callers responsibility to wrap the actual entity with
GenericEntityif preservation of its generic type is required.- Specified by:
setEntityin interfaceClientRequestContext- Parameters:
entity- entity object.- See Also:
-
setEntity
Description copied from interface:ClientRequestContextSet a new message entity, including the attached annotations and the media type.It is the callers responsibility to wrap the actual entity with
GenericEntityif preservation of its generic type is required.- Specified by:
setEntityin interfaceClientRequestContext- Parameters:
entity- entity object.annotations- annotations attached to the entity instance.mediaType- entity media type.- See Also:
-
getUri
Description copied from interface:ClientRequestContextGet the request URI.- Specified by:
getUriin interfaceClientRequestContext- Returns:
- request URI.
-
setUri
Description copied from interface:ClientRequestContextSet a new request URI.- Specified by:
setUriin interfaceClientRequestContext- Parameters:
uri- new request URI.
-
getMethod
Description copied from interface:ClientRequestContextGet the request method.- Specified by:
getMethodin interfaceClientRequestContext- Returns:
- the request method.
- See Also:
-
setMethod
Description copied from interface:ClientRequestContextSet the request method.- Specified by:
setMethodin interfaceClientRequestContext- Parameters:
method- new request method.- See Also:
-
getHeaders
Description copied from interface:ClientRequestContextGet the mutable request headers multivalued map.- Specified by:
getHeadersin interfaceClientRequestContext- Returns:
- mutable multivalued map of request headers.
- See Also:
-
getDate
Description copied from interface:ClientRequestContextGet message date.- Specified by:
getDatein interfaceClientRequestContext- Returns:
- the message date, otherwise
nullif not present.
-
getLanguage
Description copied from interface:ClientRequestContextGet the language of the entity.- Specified by:
getLanguagein interfaceClientRequestContext- Returns:
- the language of the entity or
nullif not specified
-
getMediaType
Description copied from interface:ClientRequestContextGet the media type of the entity.- Specified by:
getMediaTypein interfaceClientRequestContext- Returns:
- the media type or
nullif not specified (e.g. there's no request entity).
-
getAcceptableMediaTypes
Description copied from interface:ClientRequestContextGet a list of media types that are acceptable for the response.- Specified by:
getAcceptableMediaTypesin interfaceClientRequestContext- Returns:
- a read-only list of requested response media types sorted according to their q-value, with highest preference first.
-
getAcceptableLanguages
Description copied from interface:ClientRequestContextGet a list of languages that are acceptable for the response.- Specified by:
getAcceptableLanguagesin interfaceClientRequestContext- Returns:
- a read-only list of acceptable languages sorted according to their q-value, with highest preference first.
-
getCookies
Description copied from interface:ClientRequestContextGet any cookies that accompanied the request.- Specified by:
getCookiesin interfaceClientRequestContext- Returns:
- a read-only map of cookie name (String) to
Cookie.
-
hasEntity
public boolean hasEntity()Description copied from interface:ClientRequestContextCheck if there is an entity available in the request. The method returnstrueif the entity is present, returnsfalseotherwise.- Specified by:
hasEntityin interfaceClientRequestContext- Returns:
trueif there is an entity present in the message,falseotherwise.
-
getEntityStream
Description copied from interface:ClientRequestContextGet the entity output stream. The JAX-RS runtime is responsible for closing the output stream.- Specified by:
getEntityStreamin interfaceClientRequestContext- Returns:
- entity output stream.
-
setEntityStream
Description copied from interface:ClientRequestContextSet a new entity output stream. The JAX-RS runtime is responsible for closing the output stream.- Specified by:
setEntityStreamin interfaceClientRequestContext- Parameters:
entityStream- new entity output stream.
-
getEntity
Description copied from interface:ClientRequestContextGet the message entity Java instance. Returnsnullif the message does not contain an entity.- Specified by:
getEntityin interfaceClientRequestContext- Returns:
- the message entity or
nullif message does not contain an entity body.
-
getEntityAnnotations
Description copied from interface:ClientRequestContextGet the annotations attached to the entity instance.Note that the returned annotations array contains only those annotations explicitly attached to entity instance (such as the ones attached using
Entity(Object, jakarta.ws.rs.core.MediaType, java.lang.annotation.Annotation[])method). The entity instance annotations array does not include annotations declared on the entity implementation class or its ancestors.- Specified by:
getEntityAnnotationsin interfaceClientRequestContext- Returns:
- annotations attached to the entity instance.
-
getClient
Description copied from interface:ClientRequestContextGet the client instance associated with the request.- Specified by:
getClientin interfaceClientRequestContext- Returns:
- client instance associated with the request.
-
getConfiguration
Description copied from interface:ClientRequestContextGet the immutable configuration of the request.- Specified by:
getConfigurationin interfaceClientRequestContext- Returns:
- immutable request configuration.
-
abortWith
Description copied from interface:ClientRequestContextAbort the filter chain with a response. This method breaks the filter chain processing and returns the provided response back to the client. The provided response goes through the chain of applicable response filters.- Specified by:
abortWithin interfaceClientRequestContext- Parameters:
response- response to be sent back to the client.
-
getStringHeaders
Description copied from interface:ClientRequestContextGet a string view of header values associated with the message. Changes in the underlyingheaders mapare reflected in this view.The method converts the non-string header values to strings using a
RuntimeDelegate.HeaderDelegateif one is available viaRuntimeDelegate.createHeaderDelegate(java.lang.Class)for the class of the value or using the valuestoStringmethod if a header delegate is not available.- Specified by:
getStringHeadersin interfaceClientRequestContext- Returns:
- response headers as a string view of header values.
- See Also:
-
getHeaderString
Description copied from interface:ClientRequestContextGet a message header as a single string value. Each single header value is converted to String using aRuntimeDelegate.HeaderDelegateif one is available viaRuntimeDelegate.createHeaderDelegate(java.lang.Class)for the header value class or using itstoStringmethod if a header delegate is not available.- Specified by:
getHeaderStringin interfaceClientRequestContext- Parameters:
name- the message header.- Returns:
- the message header value. If the message header is not present then
nullis returned. If the message header is present but has no value then the empty string is returned. If the message header is present more than once then the values of joined together and separated by a ',' character. - See Also:
-
getInvocation
exposes the client invocation for easier integration with other libraries- Returns:
- the underlying client invocation
-