Package org.openremote.container.web
Class WebTargetBuilder
java.lang.Object
org.openremote.container.web.WebTargetBuilder
This is a factory for creating JAX-RS
WebTarget
instances. The instances share a common
Client
that uses a connection pool and has the following
ContextResolver
s registered (additional filters etc. should be registered on the
WebTargetBuilder
instances):
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected URI
protected org.jboss.resteasy.client.jaxrs.internal.BasicAuthentication
protected org.jboss.resteasy.client.jaxrs.ResteasyClient
static final long
static final int
static final long
protected static ExecutorService
protected boolean
protected org.openremote.model.auth.OAuthGrant
-
Constructor Summary
ConstructorsConstructorDescriptionWebTargetBuilder
(org.jboss.resteasy.client.jaxrs.ResteasyClient client, URI baseUri) -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> jakarta.ws.rs.client.Invocation.Builder
addHeaders
(jakarta.ws.rs.client.Invocation.Builder requestBuilder, @NotNull Map<String, List<V>> multiivaluedMap) addPermanentFailureResponse
(jakarta.ws.rs.core.Response.Status... responseStatus) If the specified status code is returned from the server then it will be treated as a permanent failure and the web authTarget will no longer be usable (any future requests will immediately return aResponse.Status.METHOD_NOT_ALLOWED
response without hitting the server.addPermanentFailureResponse
(Integer... responseStatus) static <T extends jakarta.ws.rs.client.WebTarget,
V>
TaddQueryParams
(T webTarget, @NotNull Map<String, List<V>> multivaluedMap) org.jboss.resteasy.client.jaxrs.ResteasyWebTarget
build()
static org.jboss.resteasy.client.jaxrs.ResteasyClient
createClient
(ExecutorService executorService) static org.jboss.resteasy.client.jaxrs.ResteasyClient
createClient
(ExecutorService executorService, int connectionPoolSize, long overrideSocketTimeout, UnaryOperator<org.jboss.resteasy.client.jaxrs.internal.ResteasyClientBuilderImpl> builderConfigurator) followRedirects
(boolean followRedirects) static <K,
V, W extends V>
jakarta.ws.rs.core.MultivaluedMap<K,V> mapToMultivaluedMap
(Map<K, List<W>> map) removePermanentFailureResponse
(jakarta.ws.rs.core.Response.Status... responseStatus) removePermanentFailureResponse
(Integer... responseStatus) setBasicAuthentication
(String username, String password) Add Basic authentication to requests sent by thisWebTarget
; this should not be used in conjunction with any other authentication.setOAuthAuthentication
(org.openremote.model.auth.OAuthGrant oAuthGrant) Add OAuth authentication to requests sent by thisWebTarget
; this should not be used in conjunction with any other authentication (note if basic authentication is also set then this OAuth authentication will take precedence).setOverrideResponseHeaders
(Map<String, List<String>> overrideResponseHeaders)
-
Field Details
-
CONNECTION_POOL_SIZE
public static final int CONNECTION_POOL_SIZE- See Also:
-
CONNECTION_CHECKOUT_TIMEOUT_MILLISECONDS
public static final long CONNECTION_CHECKOUT_TIMEOUT_MILLISECONDS- See Also:
-
CONNECTION_TIMEOUT_MILLISECONDS
public static final long CONNECTION_TIMEOUT_MILLISECONDS- See Also:
-
client
protected org.jboss.resteasy.client.jaxrs.ResteasyClient client -
executorService
-
basicAuthentication
protected org.jboss.resteasy.client.jaxrs.internal.BasicAuthentication basicAuthentication -
oAuthGrant
protected org.openremote.model.auth.OAuthGrant oAuthGrant -
baseUri
-
failureResponses
-
followRedirects
protected boolean followRedirects
-
-
Constructor Details
-
WebTargetBuilder
-
-
Method Details
-
setBasicAuthentication
Add Basic authentication to requests sent by thisWebTarget
; this should not be used in conjunction with any other authentication. -
setOAuthAuthentication
Add OAuth authentication to requests sent by thisWebTarget
; this should not be used in conjunction with any other authentication (note if basic authentication is also set then this OAuth authentication will take precedence). -
setOverrideResponseHeaders
public WebTargetBuilder setOverrideResponseHeaders(Map<String, List<String>> overrideResponseHeaders) -
addPermanentFailureResponse
public WebTargetBuilder addPermanentFailureResponse(jakarta.ws.rs.core.Response.Status... responseStatus) If the specified status code is returned from the server then it will be treated as a permanent failure and the web authTarget will no longer be usable (any future requests will immediately return aResponse.Status.METHOD_NOT_ALLOWED
response without hitting the server.NOTE: Any response in 200 range will always be treated as successful.
-
addPermanentFailureResponse
-
removePermanentFailureResponse
public WebTargetBuilder removePermanentFailureResponse(jakarta.ws.rs.core.Response.Status... responseStatus) -
removePermanentFailureResponse
-
followRedirects
-
build
public org.jboss.resteasy.client.jaxrs.ResteasyWebTarget build() -
createClient
public static org.jboss.resteasy.client.jaxrs.ResteasyClient createClient(ExecutorService executorService) -
createClient
public static org.jboss.resteasy.client.jaxrs.ResteasyClient createClient(ExecutorService executorService, int connectionPoolSize, long overrideSocketTimeout, UnaryOperator<org.jboss.resteasy.client.jaxrs.internal.ResteasyClientBuilderImpl> builderConfigurator) -
mapToMultivaluedMap
-
addQueryParams
-
addHeaders
-