Class JerseyInvocation

  • All Implemented Interfaces:
    javax.ws.rs.client.Invocation

    public class JerseyInvocation
    extends java.lang.Object
    implements javax.ws.rs.client.Invocation
    Jersey implementation of JAX-RS client-side request invocation contract.
    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • copyRequestContext

        private final boolean copyRequestContext
    • Method Detail

      • validateHttpMethodAndEntity

        private void validateHttpMethodAndEntity​(ClientRequest request)
      • invoke

        public javax.ws.rs.core.Response invoke()
                                         throws javax.ws.rs.ProcessingException,
                                                javax.ws.rs.WebApplicationException
        Specified by:
        invoke in interface javax.ws.rs.client.Invocation
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • invoke

        public <T> T invoke​(java.lang.Class<T> responseType)
                     throws javax.ws.rs.ProcessingException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        invoke in interface javax.ws.rs.client.Invocation
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • invoke

        public <T> T invoke​(javax.ws.rs.core.GenericType<T> responseType)
                     throws javax.ws.rs.ProcessingException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        invoke in interface javax.ws.rs.client.Invocation
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • submit

        public java.util.concurrent.Future<javax.ws.rs.core.Response> submit()
        Specified by:
        submit in interface javax.ws.rs.client.Invocation
      • submit

        public <T> java.util.concurrent.Future<T> submit​(java.lang.Class<T> responseType)
        Specified by:
        submit in interface javax.ws.rs.client.Invocation
      • translate

        private <T> T translate​(ClientResponse response,
                                RequestScope scope,
                                java.lang.Class<T> responseType)
                         throws javax.ws.rs.ProcessingException
        Throws:
        javax.ws.rs.ProcessingException
      • submit

        public <T> java.util.concurrent.Future<T> submit​(javax.ws.rs.core.GenericType<T> responseType)
        Specified by:
        submit in interface javax.ws.rs.client.Invocation
      • translate

        private <T> T translate​(ClientResponse response,
                                RequestScope scope,
                                javax.ws.rs.core.GenericType<T> responseType)
                         throws javax.ws.rs.ProcessingException
        Throws:
        javax.ws.rs.ProcessingException
      • submit

        public <T> java.util.concurrent.Future<T> submit​(javax.ws.rs.client.InvocationCallback<T> callback)
        Specified by:
        submit in interface javax.ws.rs.client.Invocation
      • submit

        public <T> java.util.concurrent.Future<T> submit​(javax.ws.rs.core.GenericType<T> responseType,
                                                         javax.ws.rs.client.InvocationCallback<T> callback)
        Submit the request for an asynchronous invocation and register an InvocationCallback to process the future result of the invocation.

        Response type in this case is taken from responseType param (if not null) rather than from callback. This allows to pass callbacks like new InvocationCallback&lt;&gt() {...}.

        Type Parameters:
        T - response type
        Parameters:
        responseType - response type that is used instead of obtaining types from callback.
        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.
      • property

        public JerseyInvocation property​(java.lang.String name,
                                         java.lang.Object value)
        Specified by:
        property in interface javax.ws.rs.client.Invocation
      • convertToException

        private javax.ws.rs.ProcessingException convertToException​(javax.ws.rs.core.Response response)
      • createExceptionForFamily

        private javax.ws.rs.WebApplicationException createExceptionForFamily​(javax.ws.rs.core.Response response,
                                                                             javax.ws.rs.core.Response.Status.Family statusFamily)
      • request

        ClientRequest request()
        Returns a reference to the mutable request context to be invoked.
        Returns:
        mutable request context to be invoked.