Class ClientInvocation

java.lang.Object
org.jboss.resteasy.client.jaxrs.internal.ClientInvocation
All Implemented Interfaces:
Invocation

public class ClientInvocation extends Object implements Invocation
Version:
$Revision: 1 $
Author:
Bill Burke
  • Field Details

  • Constructor Details

  • 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 type
      response - response entity
      annotations - array of annotations
      Returns:
      extracted result of type T
    • handleErrorStatus

      public static <T> T handleErrorStatus(Response response)
      Throw an exception. Expecting a status of 400 or greater.
      Type Parameters:
      T - type
      Parameters:
      response - response entity
      Returns:
      unreachable
    • getClientConfiguration

      public ClientConfiguration getClientConfiguration()
    • getClient

      public ResteasyClient getClient()
    • getDelegatingOutputStream

      public DelegatingOutputStream getDelegatingOutputStream()
    • setDelegatingOutputStream

      public void setDelegatingOutputStream(DelegatingOutputStream delegatingOutputStream)
    • getEntityStream

      public OutputStream getEntityStream()
    • setEntityStream

      public void setEntityStream(OutputStream entityStream)
    • getUri

      public URI getUri()
    • setUri

      public void setUri(URI uri)
    • getEntityAnnotations

      public Annotation[] getEntityAnnotations()
    • setEntityAnnotations

      public void setEntityAnnotations(Annotation[] entityAnnotations)
    • getMethod

      public String getMethod()
    • setMethod

      public void setMethod(String method)
    • setHeaders

      public void setHeaders(ClientRequestHeaders headers)
    • getMutableProperties

      public Map<String,Object> getMutableProperties()
    • getEntity

      public Object getEntity()
    • getEntityGenericType

      public Type getEntityGenericType()
    • getEntityClass

      public Class<?> getEntityClass()
    • getHeaders

      public ClientRequestHeaders getHeaders()
    • setEntity

      public void setEntity(Entity<?> entity)
    • setEntityObject

      public void setEntityObject(Object ent)
    • writeRequestBody

      public void writeRequestBody(OutputStream outputStream) throws IOException
      Throws:
      IOException
    • getWriterInterceptors

      public WriterInterceptor[] getWriterInterceptors()
    • getRequestFilters

      public ClientRequestFilter[] getRequestFilters()
    • getResponseFilters

      public ClientResponseFilter[] getResponseFilters()
    • getConfiguration

      public Configuration getConfiguration()
    • isChunked

      public boolean isChunked()
    • setChunked

      public void setChunked(boolean chunked)
    • invoke

      public ClientResponse invoke()
      Description copied from interface: Invocation
      Synchronously invoke the request and receive a response back.
      Specified by:
      invoke in interface Invocation
      Returns:
      response object as a result of the request invocation.
    • invoke

      public <T> T invoke(Class<T> responseType)
      Description copied from interface: Invocation
      Synchronously invoke the request and receive a response of the specified type back.
      Specified by:
      invoke in interface Invocation
      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

      public <T> T invoke(GenericType<T> responseType)
      Description copied from interface: Invocation
      Synchronously invoke the request and receive a response of the specified generic type back.
      Specified by:
      invoke in interface Invocation
      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

      public Future<Response> submit()
      Description copied from interface: Invocation
      Submit the request for an asynchronous invocation and receive a future response back.

      Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps a ProcessingException thrown in case of an invocation processing failure. In case a processing of a properly received response fails, the wrapped processing exception will be of ResponseProcessingException type and will contain the Response instance whose processing has failed.

      Specified by:
      submit in interface Invocation
      Returns:
      future response object as a result of the request invocation.
    • submit

      public <T> Future<T> submit(Class<T> responseType)
      Description copied from interface: Invocation
      Submit 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 returned Future instance may throw an ExecutionException that wraps either a ProcessingException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the specified response type is not Response. In case a processing of a properly received response fails, the wrapped processing exception will be of ResponseProcessingException type and will contain the Response instance whose processing has failed.

      Specified by:
      submit in interface Invocation
      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

      public <T> Future<T> submit(GenericType<T> responseType)
      Description copied from interface: Invocation
      Submit 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 returned Future instance may throw an ExecutionException that wraps either a ProcessingException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the specified response type is not Response. In case a processing of a properly received response fails, the wrapped processing exception will be of ResponseProcessingException type and will contain the Response instance whose processing has failed.

      Specified by:
      submit in interface Invocation
      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

      public <T> Future<T> submit(InvocationCallback<T> callback)
      Description copied from interface: Invocation
      Submit the request for an asynchronous invocation and register an InvocationCallback to process the future result of the invocation.

      Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps either a ProcessingException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the generic type of the supplied response callback is not Response. In case a processing of a properly received response fails, the wrapped processing exception will be of ResponseProcessingException type and will contain the Response instance whose processing has failed.

      Specified by:
      submit in interface Invocation
      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

      public ExecutorService asyncInvocationExecutor()
    • getGenericTypeExtractor

      protected static <T> AsyncClientHttpEngine.ResultExtractor<T> getGenericTypeExtractor(GenericType<T> responseType)
    • getResponseTypeExtractor

      protected static <T> AsyncClientHttpEngine.ResultExtractor<T> getResponseTypeExtractor(Class<T> responseType)
    • submitCF

      public CompletableFuture<Response> submitCF()
    • submitCF

      public <T> CompletableFuture<T> submitCF(Class<T> responseType)
    • submitCF

      public <T> CompletableFuture<T> submitCF(GenericType<T> responseType)
    • reactive

      public Optional<org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.ReactiveInvocation> reactive()
      If the client's HTTP engine implements ReactiveClientHttpEngine then you can access the latter's Publisher via this method.
    • property

      public Invocation property(String name, Object value)
      Description copied from interface: Invocation
      Set 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) or InterceptorContext.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 a null value into a property effectively removes the property from the request property bag.

      Specified by:
      property in interface Invocation
      Parameters:
      name - property name.
      value - (new) property value. null value removes the property with the given name.
      Returns:
      the updated invocation.
      See Also:
    • getClientInvoker

      public ClientInvoker getClientInvoker()
    • setClientInvoker

      public void setClientInvoker(ClientInvoker clientInvoker)
    • filterRequest

      protected ClientResponse filterRequest(ClientRequestContextImpl requestContext)
    • filterResponse

      protected ClientResponse filterResponse(ClientRequestContextImpl requestContext, ClientResponse response)
    • getTracingLogger

      public RESTEasyTracingLogger getTracingLogger()
    • setActualTarget

      public void setActualTarget(WebTarget target)
    • getActualTarget

      public WebTarget getActualTarget()