Class ClientInvocation
- All Implemented Interfaces:
Invocation
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.ws.rs.client.Invocation
Invocation.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WebTargetprotected booleanprotected ResteasyClientprotected ClientInvokerprotected ClientConfigurationprotected DelegatingOutputStreamprotected Objectprotected Annotation[]protected Class<?>protected Typeprotected OutputStreamprotected ClientRequestHeadersprotected Stringprotected RESTEasyTracingLoggerprotected URI -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClientInvocation(ClientInvocation clientInvocation) ClientInvocation(ResteasyClient client, URI uri, ClientRequestHeaders headers, ClientConfiguration parent) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TextractResult(GenericType<T> responseType, Response response, Annotation[] annotations) Extracts result from response throwing an appropriate exception if not a successful response.protected ClientResponsefilterRequest(ClientRequestContextImpl requestContext) protected ClientResponsefilterResponse(ClientRequestContextImpl requestContext, ClientResponse response) Class<?>protected static <T> AsyncClientHttpEngine.ResultExtractor<T>getGenericTypeExtractor(GenericType<T> responseType) protected static <T> AsyncClientHttpEngine.ResultExtractor<T>getResponseTypeExtractor(Class<T> responseType) getUri()static <T> ThandleErrorStatus(Response response) Throw an exception.invoke()Synchronously invoke the request and receive a response back.<T> Tinvoke(GenericType<T> responseType) Synchronously invoke the request and receive a response of the specified generic type back.<T> TSynchronously invoke the request and receive a response of the specified type back.booleanSet a new property in the context of a request represented by this invocation.Optional<org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.ReactiveInvocation>reactive()If the client's HTTP engine implementsReactiveClientHttpEnginethen you can access the latter'sPublishervia this method.voidsetActualTarget(WebTarget target) voidsetChunked(boolean chunked) voidsetClientInvoker(ClientInvoker clientInvoker) voidsetDelegatingOutputStream(DelegatingOutputStream delegatingOutputStream) voidvoidsetEntityAnnotations(Annotation[] entityAnnotations) voidsetEntityObject(Object ent) voidsetEntityStream(OutputStream entityStream) voidsetHeaders(ClientRequestHeaders headers) voidvoidsubmit()Submit the request for an asynchronous invocation and receive a future response back.<T> Future<T>submit(InvocationCallback<T> callback) Submit the request for an asynchronous invocation and register anInvocationCallbackto process the future result of the invocation.<T> Future<T>submit(GenericType<T> responseType) Submit the request for an asynchronous invocation and receive a future response of the specified generic type back.<T> Future<T>Submit the request for an asynchronous invocation and receive a future response of the specified type back.submitCF()<T> CompletableFuture<T>submitCF(GenericType<T> responseType) <T> CompletableFuture<T>voidwriteRequestBody(OutputStream outputStream)
-
Field Details
-
tracingLogger
-
client
-
headers
-
method
-
entity
-
entityGenericType
-
entityClass
-
entityAnnotations
-
configuration
-
uri
-
chunked
protected boolean chunked -
clientInvoker
-
actualTarget
-
delegatingOutputStream
-
entityStream
-
-
Constructor Details
-
ClientInvocation
public ClientInvocation(ResteasyClient client, URI uri, ClientRequestHeaders headers, ClientConfiguration parent) -
ClientInvocation
-
-
Method Details
-
extractResult
public static <T> T extractResult(GenericType<T> responseType, Response response, Annotation[] annotations) Extracts result from response throwing an appropriate exception if not a successful response.- Type Parameters:
T- type- Parameters:
responseType- generic typeresponse- response entityannotations- array of annotations- Returns:
- extracted result of type T
-
handleErrorStatus
Throw an exception. Expecting a status of 400 or greater.- Type Parameters:
T- type- Parameters:
response- response entity- Returns:
- unreachable
-
getClientConfiguration
-
getClient
-
getDelegatingOutputStream
-
setDelegatingOutputStream
-
getEntityStream
-
setEntityStream
-
getUri
-
setUri
-
getEntityAnnotations
-
setEntityAnnotations
-
getMethod
-
setMethod
-
setHeaders
-
getMutableProperties
-
getEntity
-
getEntityGenericType
-
getEntityClass
-
getHeaders
-
setEntity
-
setEntityObject
-
writeRequestBody
- Throws:
IOException
-
getWriterInterceptors
-
getRequestFilters
-
getResponseFilters
-
getConfiguration
-
isChunked
public boolean isChunked() -
setChunked
public void setChunked(boolean chunked) -
invoke
Description copied from interface:InvocationSynchronously invoke the request and receive a response back.- Specified by:
invokein interfaceInvocation- Returns:
responseobject as a result of the request invocation.
-
invoke
Description copied from interface:InvocationSynchronously invoke the request and receive a response of the specified type back.- Specified by:
invokein interfaceInvocation- Type Parameters:
T- response type- Parameters:
responseType- Java type the response should be converted into.- Returns:
- response object of the specified type as a result of the request invocation.
-
invoke
Description copied from interface:InvocationSynchronously invoke the request and receive a response of the specified generic type back.- Specified by:
invokein interfaceInvocation- Type Parameters:
T- generic response type- Parameters:
responseType- type literal representing a generic Java type the response should be converted into.- Returns:
- response object of the specified generic type as a result of the request invocation.
-
submit
Description copied from interface:InvocationSubmit the request for an asynchronous invocation and receive a future response back.Note that calling the
Future.get()method on the returnedFutureinstance may throw anExecutionExceptionthat wraps aProcessingExceptionthrown in case of an invocation processing failure. In case a processing of a properly received response fails, the wrapped processing exception will be ofResponseProcessingExceptiontype and will contain theResponseinstance whose processing has failed.- Specified by:
submitin interfaceInvocation- Returns:
- future
responseobject as a result of the request invocation.
-
submit
Description copied from interface:InvocationSubmit the request for an asynchronous invocation and receive a future response of the specified type back.Note that calling the
Future.get()method on the returnedFutureinstance may throw anExecutionExceptionthat wraps either aProcessingExceptionthrown in case of an invocation processing failure or aWebApplicationExceptionor one of its subclasses thrown in case the received response status code is notsuccessfuland the specified response type is notResponse. In case a processing of a properly received response fails, the wrapped processing exception will be ofResponseProcessingExceptiontype and will contain theResponseinstance whose processing has failed.- Specified by:
submitin interfaceInvocation- Type Parameters:
T- response type- Parameters:
responseType- Java type the response should be converted into.- Returns:
- future response object of the specified type as a result of the request invocation.
-
submit
Description copied from interface:InvocationSubmit the request for an asynchronous invocation and receive a future response of the specified generic type back.Note that calling the
Future.get()method on the returnedFutureinstance may throw anExecutionExceptionthat wraps either aProcessingExceptionthrown in case of an invocation processing failure or aWebApplicationExceptionor one of its subclasses thrown in case the received response status code is notsuccessfuland the specified response type is notResponse. In case a processing of a properly received response fails, the wrapped processing exception will be ofResponseProcessingExceptiontype and will contain theResponseinstance whose processing has failed.- Specified by:
submitin interfaceInvocation- Type Parameters:
T- generic response type- Parameters:
responseType- type literal representing a generic Java type the response should be converted into.- Returns:
- future response object of the specified generic type as a result of the request invocation.
-
submit
Description copied from interface:InvocationSubmit the request for an asynchronous invocation and register anInvocationCallbackto process the future result of the invocation.Note that calling the
Future.get()method on the returnedFutureinstance may throw anExecutionExceptionthat wraps either aProcessingExceptionthrown in case of an invocation processing failure or aWebApplicationExceptionor one of its subclasses thrown in case the received response status code is notsuccessfuland the generic type of the supplied response callback is notResponse. In case a processing of a properly received response fails, the wrapped processing exception will be ofResponseProcessingExceptiontype and will contain theResponseinstance whose processing has failed.- Specified by:
submitin interfaceInvocation- Type Parameters:
T- response type- Parameters:
callback- invocation callback for asynchronous processing of the request invocation result.- Returns:
- future response object of the specified type as a result of the request invocation.
-
asyncInvocationExecutor
-
getGenericTypeExtractor
protected static <T> AsyncClientHttpEngine.ResultExtractor<T> getGenericTypeExtractor(GenericType<T> responseType) -
getResponseTypeExtractor
protected static <T> AsyncClientHttpEngine.ResultExtractor<T> getResponseTypeExtractor(Class<T> responseType) -
submitCF
-
submitCF
-
submitCF
-
reactive
public Optional<org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.ReactiveInvocation> reactive()If the client's HTTP engine implementsReactiveClientHttpEnginethen you can access the latter'sPublishervia this method. -
property
Description copied from interface:InvocationSet a new property in the context of a request represented by this invocation.The property is available for a later retrieval via
ClientRequestContext.getProperty(String)orInterceptorContext.getProperty(String). If a property with a given name is already set in the request context, the existing value of the property will be updated. Setting anullvalue into a property effectively removes the property from the request property bag.- Specified by:
propertyin interfaceInvocation- Parameters:
name- property name.value- (new) property value.nullvalue removes the property with the given name.- Returns:
- the updated invocation.
- See Also:
-
getClientInvoker
-
setClientInvoker
-
filterRequest
-
filterResponse
protected ClientResponse filterResponse(ClientRequestContextImpl requestContext, ClientResponse response) -
getTracingLogger
-
setActualTarget
-
getActualTarget
-