Class ArmeriaResteasyClientBuilder

java.lang.Object
javax.ws.rs.client.ClientBuilder
org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
com.linecorp.armeria.client.resteasy.ArmeriaResteasyClientBuilder
All Implemented Interfaces:
javax.ws.rs.core.Configurable<javax.ws.rs.client.ClientBuilder>

public final class ArmeriaResteasyClientBuilder
extends org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
An optional helper class to build ResteasyClient using ResteasyClientBuilder interface as below.

     final WebClientBuilder webClientBuilder = WebClient.builder(); // supply no server URI to the builder
     // ... configure webClientBuilder ...
     final ResteasyClientBuilder reasteasyClientBuilder =
             ArmeriaResteasyClientBuilder.newBuilder(webClientBuilder);
     // ... configure restClientBuilder ...
     // construct JAX-RS client
     final Client jaxrsClient = reasteasyClientBuilder.build();
     // construct JAX-RS web target
     final WebTarget webTarget = jaxrsClient.target(restServerUri); // supply server URI here
     // make JAX-RS request
     final Response restResponse = webTarget.path(servicePath).request().get();
 

ResteasyClient could still be constructed using ArmeriaJaxrsClientEngine directly by setting it to ResteasyClientBuilder via ResteasyClientBuilder.httpEngine(ClientHttpEngine) method as below.


     final Client jaxrsClient = ((ResteasyClientBuilder) ClientBuilder.newBuilder())
             .httpEngine(new ArmeriaJaxrsClientEngine(armeriaWebClient))
             .build();
 
  • Method Details

    • newBuilder

      public static org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder newBuilder​(WebClientBuilder webClientBuilder, ClientFactoryBuilder clientFactoryBuilder)
      Creates new ResteasyClientBuilder based on WebClientBuilder and ClientFactoryBuilder.
    • newBuilder

      public static org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder newBuilder​(WebClientBuilder webClientBuilder)
      Creates new ResteasyClientBuilder based on WebClientBuilder.
    • newClient

      public static org.jboss.resteasy.client.jaxrs.ResteasyClient newClient​(WebClient webClient)
      Creates new ResteasyClient based on WebClient.
    • newClient

      public static org.jboss.resteasy.client.jaxrs.ResteasyClient newClient​(javax.ws.rs.core.Configuration configuration)
      Creates new ResteasyClient based on Configuration.
    • newClient

      public static org.jboss.resteasy.client.jaxrs.ResteasyClient newClient()
      Creates new ResteasyClient using default settings.
    • build

      public org.jboss.resteasy.client.jaxrs.ResteasyClient build()
      Specified by:
      build in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • httpEngine

      public ArmeriaResteasyClientBuilder httpEngine​(org.jboss.resteasy.client.jaxrs.ClientHttpEngine httpEngine)
      ArmeriaJaxrsClientEngine will always be set as an ClientHttpEngine.
      Specified by:
      httpEngine in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Throws:
      UnsupportedOperationException - always
    • getHttpEngine

      public org.jboss.resteasy.client.jaxrs.ClientHttpEngine getHttpEngine()
      Specified by:
      getHttpEngine in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • useAsyncHttpEngine

      public ArmeriaResteasyClientBuilder useAsyncHttpEngine()
      Specified by:
      useAsyncHttpEngine in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isUseAsyncHttpEngine

      public boolean isUseAsyncHttpEngine()
      Specified by:
      isUseAsyncHttpEngine in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • providerFactory

      public ArmeriaResteasyClientBuilder providerFactory​(org.jboss.resteasy.spi.ResteasyProviderFactory providerFactory)
      Specified by:
      providerFactory in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getProviderFactory

      public org.jboss.resteasy.spi.ResteasyProviderFactory getProviderFactory()
      Specified by:
      getProviderFactory in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • connectionTTL

      public ArmeriaResteasyClientBuilder connectionTTL​(long ttl, TimeUnit unit)
      Specified by:
      connectionTTL in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConnectionTTL

      public long getConnectionTTL​(TimeUnit unit)
      Specified by:
      getConnectionTTL in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • maxPooledPerRoute

      public ArmeriaResteasyClientBuilder maxPooledPerRoute​(int maxPooledPerRoute)
      Specified by:
      maxPooledPerRoute in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getMaxPooledPerRoute

      public int getMaxPooledPerRoute()
      Specified by:
      getMaxPooledPerRoute in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • connectionCheckoutTimeout

      public ArmeriaResteasyClientBuilder connectionCheckoutTimeout​(long timeout, TimeUnit unit)
      Specified by:
      connectionCheckoutTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConnectionCheckoutTimeout

      public long getConnectionCheckoutTimeout​(TimeUnit unit)
      Specified by:
      getConnectionCheckoutTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • connectionPoolSize

      public ArmeriaResteasyClientBuilder connectionPoolSize​(int connectionPoolSize)
      Specified by:
      connectionPoolSize in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConnectionPoolSize

      public int getConnectionPoolSize()
      Specified by:
      getConnectionPoolSize in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • responseBufferSize

      public ArmeriaResteasyClientBuilder responseBufferSize​(int size)
      Specified by:
      responseBufferSize in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getResponseBufferSize

      public int getResponseBufferSize()
      Specified by:
      getResponseBufferSize in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • disableTrustManager

      public ArmeriaResteasyClientBuilder disableTrustManager()
      Specified by:
      disableTrustManager in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isTrustManagerDisabled

      public boolean isTrustManagerDisabled()
      Specified by:
      isTrustManagerDisabled in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • setIsTrustSelfSignedCertificates

      public void setIsTrustSelfSignedCertificates​(boolean b)
      Specified by:
      setIsTrustSelfSignedCertificates in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isTrustSelfSignedCertificates

      public boolean isTrustSelfSignedCertificates()
      Specified by:
      isTrustSelfSignedCertificates in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • hostnameVerification

      public ArmeriaResteasyClientBuilder hostnameVerification​(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.HostnameVerificationPolicy policy)
      Specified by:
      hostnameVerification in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getHostnameVerification

      public org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.HostnameVerificationPolicy getHostnameVerification()
      Specified by:
      getHostnameVerification in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • sniHostNames

      public ArmeriaResteasyClientBuilder sniHostNames​(String... sniHostNames)
      Specified by:
      sniHostNames in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getSniHostNames

      public List<String> getSniHostNames()
      Specified by:
      getSniHostNames in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getDefaultProxyHostname

      public String getDefaultProxyHostname()
      Specified by:
      getDefaultProxyHostname in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getDefaultProxyPort

      public int getDefaultProxyPort()
      Specified by:
      getDefaultProxyPort in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getDefaultProxyScheme

      public String getDefaultProxyScheme()
      Specified by:
      getDefaultProxyScheme in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • defaultProxy

      public ArmeriaResteasyClientBuilder defaultProxy​(String hostname)
      Specified by:
      defaultProxy in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • defaultProxy

      public ArmeriaResteasyClientBuilder defaultProxy​(String hostname, int port)
      Specified by:
      defaultProxy in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • defaultProxy

      public ArmeriaResteasyClientBuilder defaultProxy​(String hostname, int port, String scheme)
      Specified by:
      defaultProxy in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • enableCookieManagement

      public ArmeriaResteasyClientBuilder enableCookieManagement()
      Specified by:
      enableCookieManagement in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isCookieManagementEnabled

      public boolean isCookieManagementEnabled()
      Specified by:
      isCookieManagementEnabled in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getSSLContext

      public SSLContext getSSLContext()
      Specified by:
      getSSLContext in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getKeyStore

      public KeyStore getKeyStore()
      Specified by:
      getKeyStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getKeyStorePassword

      public String getKeyStorePassword()
      Specified by:
      getKeyStorePassword in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getTrustStore

      public KeyStore getTrustStore()
      Specified by:
      getTrustStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getHostnameVerifier

      public HostnameVerifier getHostnameVerifier()
      Specified by:
      getHostnameVerifier in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getReadTimeout

      public long getReadTimeout​(TimeUnit unit)
      Specified by:
      getReadTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConnectionTimeout

      public long getConnectionTimeout​(TimeUnit unit)
      Specified by:
      getConnectionTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • disableAutomaticRetries

      public ArmeriaResteasyClientBuilder disableAutomaticRetries()
      Specified by:
      disableAutomaticRetries in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isDisableAutomaticRetries

      public boolean isDisableAutomaticRetries()
      Specified by:
      isDisableAutomaticRetries in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • withConfig

      public ArmeriaResteasyClientBuilder withConfig​(javax.ws.rs.core.Configuration config)
      Specified by:
      withConfig in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • sslContext

      public ArmeriaResteasyClientBuilder sslContext​(SSLContext sslContext)
      Armeria does not allow to access the ssl-context from WebClient API. This functionality must be achieved by configuring WebClientBuilder.
      Specified by:
      sslContext in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Throws:
      UnsupportedOperationException - always
    • keyStore

      public ArmeriaResteasyClientBuilder keyStore​(KeyStore keyStore, char[] password)
      Specified by:
      keyStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • keyStore

      public ArmeriaResteasyClientBuilder keyStore​(KeyStore keyStore, String password)
      Specified by:
      keyStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • trustStore

      public ArmeriaResteasyClientBuilder trustStore​(KeyStore trustStore)
      Specified by:
      trustStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • hostnameVerifier

      public ArmeriaResteasyClientBuilder hostnameVerifier​(HostnameVerifier verifier)
      Armeria does not allow to access the HostnameVerifier from WebClient API. This functionality must be achieved by configuring WebClientBuilder.
      Specified by:
      hostnameVerifier in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Throws:
      UnsupportedOperationException - always
    • executorService

      public ArmeriaResteasyClientBuilder executorService​(ExecutorService executorService)
      Specified by:
      executorService in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • executorService

      public ArmeriaResteasyClientBuilder executorService​(ExecutorService executorService, boolean cleanupExecutor)
      Specified by:
      executorService in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • scheduledExecutorService

      public ArmeriaResteasyClientBuilder scheduledExecutorService​(ScheduledExecutorService scheduledExecutorService)
      Specified by:
      scheduledExecutorService in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • connectTimeout

      public ArmeriaResteasyClientBuilder connectTimeout​(long timeout, TimeUnit unit)
      Specified by:
      connectTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • readTimeout

      public ArmeriaResteasyClientBuilder readTimeout​(long timeout, TimeUnit unit)
      Specified by:
      readTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • setFollowRedirects

      public ArmeriaResteasyClientBuilder setFollowRedirects​(boolean followRedirects)
      Specified by:
      setFollowRedirects in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isFollowRedirects

      public boolean isFollowRedirects()
      Specified by:
      isFollowRedirects in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConfiguration

      public javax.ws.rs.core.Configuration getConfiguration()
    • property

      public ArmeriaResteasyClientBuilder property​(String name, Object value)
    • register

      public ArmeriaResteasyClientBuilder register​(Class<?> componentClass)
    • register

      public ArmeriaResteasyClientBuilder register​(Class<?> componentClass, int priority)
    • register

      public ArmeriaResteasyClientBuilder register​(Class<?> componentClass, Class<?>... contracts)
    • register

      public ArmeriaResteasyClientBuilder register​(Class<?> componentClass, Map<Class<?>,​Integer> contracts)
    • register

      public ArmeriaResteasyClientBuilder register​(Object component)
    • register

      public ArmeriaResteasyClientBuilder register​(Object component, int priority)
    • register

      public ArmeriaResteasyClientBuilder register​(Object component, Class<?>... contracts)
    • register

      public ArmeriaResteasyClientBuilder register​(Object component, Map<Class<?>,​Integer> contracts)