Class JerseyInvocation.Builder

  • All Implemented Interfaces:
    javax.ws.rs.client.Invocation.Builder, javax.ws.rs.client.SyncInvoker
    Enclosing class:
    JerseyInvocation

    public static class JerseyInvocation.Builder
    extends java.lang.Object
    implements javax.ws.rs.client.Invocation.Builder
    Jersey-specific client invocation builder.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Builder​(java.net.URI uri, ClientConfig configuration)
      Create new Jersey-specific client invocation builder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JerseyInvocation.Builder accept​(java.lang.String... mediaTypes)  
      JerseyInvocation.Builder accept​(javax.ws.rs.core.MediaType... mediaTypes)  
      javax.ws.rs.client.Invocation.Builder acceptEncoding​(java.lang.String... encodings)  
      JerseyInvocation.Builder acceptLanguage​(java.lang.String... locales)  
      JerseyInvocation.Builder acceptLanguage​(java.util.Locale... locales)  
      javax.ws.rs.client.AsyncInvoker async()  
      JerseyInvocation build​(java.lang.String method)  
      JerseyInvocation build​(java.lang.String method, javax.ws.rs.client.Entity<?> entity)  
      JerseyInvocation buildDelete()  
      JerseyInvocation buildGet()  
      JerseyInvocation buildPost​(javax.ws.rs.client.Entity<?> entity)  
      JerseyInvocation buildPut​(javax.ws.rs.client.Entity<?> entity)  
      JerseyInvocation.Builder cacheControl​(javax.ws.rs.core.CacheControl cacheControl)  
      JerseyInvocation.Builder cookie​(java.lang.String name, java.lang.String value)  
      JerseyInvocation.Builder cookie​(javax.ws.rs.core.Cookie cookie)  
      private <T extends javax.ws.rs.client.RxInvoker>
      T
      createRxInvoker​(java.lang.Class<? extends javax.ws.rs.client.RxInvoker> clazz, java.util.concurrent.ExecutorService executorService)
      Create RxInvoker from provided RxInvoker subclass.
      javax.ws.rs.core.Response delete()  
      <T> T delete​(java.lang.Class<T> responseType)  
      <T> T delete​(javax.ws.rs.core.GenericType<T> responseType)  
      javax.ws.rs.core.Response get()  
      <T> T get​(java.lang.Class<T> responseType)  
      <T> T get​(javax.ws.rs.core.GenericType<T> responseType)  
      javax.ws.rs.core.Response head()  
      JerseyInvocation.Builder header​(java.lang.String name, java.lang.Object value)  
      JerseyInvocation.Builder headers​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> headers)  
      javax.ws.rs.core.Response method​(java.lang.String name)  
      <T> T method​(java.lang.String name, java.lang.Class<T> responseType)  
      javax.ws.rs.core.Response method​(java.lang.String name, javax.ws.rs.client.Entity<?> entity)  
      <T> T method​(java.lang.String name, javax.ws.rs.client.Entity<?> entity, java.lang.Class<T> responseType)  
      <T> T method​(java.lang.String name, javax.ws.rs.client.Entity<?> entity, javax.ws.rs.core.GenericType<T> responseType)  
      <T> T method​(java.lang.String name, javax.ws.rs.core.GenericType<T> responseType)  
      javax.ws.rs.core.Response options()  
      <T> T options​(java.lang.Class<T> responseType)  
      <T> T options​(javax.ws.rs.core.GenericType<T> responseType)  
      javax.ws.rs.core.Response post​(javax.ws.rs.client.Entity<?> entity)  
      <T> T post​(javax.ws.rs.client.Entity<?> entity, java.lang.Class<T> responseType)  
      <T> T post​(javax.ws.rs.client.Entity<?> entity, javax.ws.rs.core.GenericType<T> responseType)  
      JerseyInvocation.Builder property​(java.lang.String name, java.lang.Object value)  
      javax.ws.rs.core.Response put​(javax.ws.rs.client.Entity<?> entity)  
      <T> T put​(javax.ws.rs.client.Entity<?> entity, java.lang.Class<T> responseType)  
      <T> T put​(javax.ws.rs.client.Entity<?> entity, javax.ws.rs.core.GenericType<T> responseType)  
      (package private) ClientRequest request()
      Returns a reference to the mutable request context to be invoked.
      javax.ws.rs.client.CompletionStageRxInvoker rx()  
      <T extends javax.ws.rs.client.RxInvoker>
      T
      rx​(java.lang.Class<T> clazz)  
      private <T extends javax.ws.rs.client.RxInvoker>
      T
      rx​(java.lang.Class<T> clazz, java.util.concurrent.ExecutorService executorService)  
      private void storeEntity​(javax.ws.rs.client.Entity<?> entity)  
      javax.ws.rs.core.Response trace()  
      <T> T trace​(java.lang.Class<T> responseType)  
      <T> T trace​(javax.ws.rs.core.GenericType<T> responseType)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Builder

        protected Builder​(java.net.URI uri,
                          ClientConfig configuration)
        Create new Jersey-specific client invocation builder.
        Parameters:
        uri - invoked request URI.
        configuration - Jersey client configuration.
    • Method Detail

      • request

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

        private void storeEntity​(javax.ws.rs.client.Entity<?> entity)
      • build

        public JerseyInvocation build​(java.lang.String method)
        Specified by:
        build in interface javax.ws.rs.client.Invocation.Builder
      • build

        public JerseyInvocation build​(java.lang.String method,
                                      javax.ws.rs.client.Entity<?> entity)
        Specified by:
        build in interface javax.ws.rs.client.Invocation.Builder
      • buildGet

        public JerseyInvocation buildGet()
        Specified by:
        buildGet in interface javax.ws.rs.client.Invocation.Builder
      • buildDelete

        public JerseyInvocation buildDelete()
        Specified by:
        buildDelete in interface javax.ws.rs.client.Invocation.Builder
      • buildPost

        public JerseyInvocation buildPost​(javax.ws.rs.client.Entity<?> entity)
        Specified by:
        buildPost in interface javax.ws.rs.client.Invocation.Builder
      • buildPut

        public JerseyInvocation buildPut​(javax.ws.rs.client.Entity<?> entity)
        Specified by:
        buildPut in interface javax.ws.rs.client.Invocation.Builder
      • async

        public javax.ws.rs.client.AsyncInvoker async()
        Specified by:
        async in interface javax.ws.rs.client.Invocation.Builder
      • accept

        public JerseyInvocation.Builder accept​(java.lang.String... mediaTypes)
        Specified by:
        accept in interface javax.ws.rs.client.Invocation.Builder
      • accept

        public JerseyInvocation.Builder accept​(javax.ws.rs.core.MediaType... mediaTypes)
        Specified by:
        accept in interface javax.ws.rs.client.Invocation.Builder
      • acceptEncoding

        public javax.ws.rs.client.Invocation.Builder acceptEncoding​(java.lang.String... encodings)
        Specified by:
        acceptEncoding in interface javax.ws.rs.client.Invocation.Builder
      • acceptLanguage

        public JerseyInvocation.Builder acceptLanguage​(java.util.Locale... locales)
        Specified by:
        acceptLanguage in interface javax.ws.rs.client.Invocation.Builder
      • acceptLanguage

        public JerseyInvocation.Builder acceptLanguage​(java.lang.String... locales)
        Specified by:
        acceptLanguage in interface javax.ws.rs.client.Invocation.Builder
      • cookie

        public JerseyInvocation.Builder cookie​(javax.ws.rs.core.Cookie cookie)
        Specified by:
        cookie in interface javax.ws.rs.client.Invocation.Builder
      • cookie

        public JerseyInvocation.Builder cookie​(java.lang.String name,
                                               java.lang.String value)
        Specified by:
        cookie in interface javax.ws.rs.client.Invocation.Builder
      • cacheControl

        public JerseyInvocation.Builder cacheControl​(javax.ws.rs.core.CacheControl cacheControl)
        Specified by:
        cacheControl in interface javax.ws.rs.client.Invocation.Builder
      • header

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

        public JerseyInvocation.Builder headers​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> headers)
        Specified by:
        headers in interface javax.ws.rs.client.Invocation.Builder
      • get

        public javax.ws.rs.core.Response get()
                                      throws javax.ws.rs.ProcessingException
        Specified by:
        get in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • get

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

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

        public javax.ws.rs.core.Response put​(javax.ws.rs.client.Entity<?> entity)
                                      throws javax.ws.rs.ProcessingException
        Specified by:
        put in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • put

        public <T> T put​(javax.ws.rs.client.Entity<?> entity,
                         java.lang.Class<T> responseType)
                  throws javax.ws.rs.ProcessingException,
                         javax.ws.rs.WebApplicationException
        Specified by:
        put in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • put

        public <T> T put​(javax.ws.rs.client.Entity<?> entity,
                         javax.ws.rs.core.GenericType<T> responseType)
                  throws javax.ws.rs.ProcessingException,
                         javax.ws.rs.WebApplicationException
        Specified by:
        put in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • post

        public javax.ws.rs.core.Response post​(javax.ws.rs.client.Entity<?> entity)
                                       throws javax.ws.rs.ProcessingException
        Specified by:
        post in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • post

        public <T> T post​(javax.ws.rs.client.Entity<?> entity,
                          java.lang.Class<T> responseType)
                   throws javax.ws.rs.ProcessingException,
                          javax.ws.rs.WebApplicationException
        Specified by:
        post in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • post

        public <T> T post​(javax.ws.rs.client.Entity<?> entity,
                          javax.ws.rs.core.GenericType<T> responseType)
                   throws javax.ws.rs.ProcessingException,
                          javax.ws.rs.WebApplicationException
        Specified by:
        post in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • delete

        public javax.ws.rs.core.Response delete()
                                         throws javax.ws.rs.ProcessingException
        Specified by:
        delete in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • delete

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

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

        public javax.ws.rs.core.Response head()
                                       throws javax.ws.rs.ProcessingException
        Specified by:
        head in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • options

        public javax.ws.rs.core.Response options()
                                          throws javax.ws.rs.ProcessingException
        Specified by:
        options in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • options

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

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

        public javax.ws.rs.core.Response trace()
                                        throws javax.ws.rs.ProcessingException
        Specified by:
        trace in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • trace

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

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

        public javax.ws.rs.core.Response method​(java.lang.String name)
                                         throws javax.ws.rs.ProcessingException
        Specified by:
        method in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • method

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

        public <T> T method​(java.lang.String name,
                            javax.ws.rs.core.GenericType<T> responseType)
                     throws javax.ws.rs.ProcessingException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        method in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • method

        public javax.ws.rs.core.Response method​(java.lang.String name,
                                                javax.ws.rs.client.Entity<?> entity)
                                         throws javax.ws.rs.ProcessingException
        Specified by:
        method in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
      • method

        public <T> T method​(java.lang.String name,
                            javax.ws.rs.client.Entity<?> entity,
                            java.lang.Class<T> responseType)
                     throws javax.ws.rs.ProcessingException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        method in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • method

        public <T> T method​(java.lang.String name,
                            javax.ws.rs.client.Entity<?> entity,
                            javax.ws.rs.core.GenericType<T> responseType)
                     throws javax.ws.rs.ProcessingException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        method in interface javax.ws.rs.client.SyncInvoker
        Throws:
        javax.ws.rs.ProcessingException
        javax.ws.rs.WebApplicationException
      • property

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

        public javax.ws.rs.client.CompletionStageRxInvoker rx()
        Specified by:
        rx in interface javax.ws.rs.client.Invocation.Builder
      • rx

        public <T extends javax.ws.rs.client.RxInvoker> T rx​(java.lang.Class<T> clazz)
        Specified by:
        rx in interface javax.ws.rs.client.Invocation.Builder
      • rx

        private <T extends javax.ws.rs.client.RxInvoker> T rx​(java.lang.Class<T> clazz,
                                                              java.util.concurrent.ExecutorService executorService)
      • createRxInvoker

        private <T extends javax.ws.rs.client.RxInvoker> T createRxInvoker​(java.lang.Class<? extends javax.ws.rs.client.RxInvoker> clazz,
                                                                           java.util.concurrent.ExecutorService executorService)
        Create RxInvoker from provided RxInvoker subclass.

        The method does a lookup for RxInvokerProvider, which provides given RxInvoker subclass and if found, calls RxInvokerProvider.getRxInvoker(SyncInvoker, ExecutorService)

        Type Parameters:
        T - RxInvoker subclass to be returned.
        Parameters:
        clazz - RxInvoker subclass to be created.
        executorService - to be passed to the factory method invocation.
        Returns:
        thread safe instance of RxInvoker subclass.
        Throws:
        java.lang.IllegalStateException - when provider for given class is not registered.