public class GatewayClientBuilder extends Object
Builder to create a GatewayClient
that holds a reference to a Client
object that it uses to send requests to the Intelecom SMS Gateway.
All Client
objects should be properly closed to avoid leaking resources. Calling AutoCloseable.close()
will also close the client connection
.
The builder uses the default JAX-RS builder implementation - ClientBuilder.newClient()
. It is also possible to either add a Configuration
or specify the Client
yourself.
The creation of a new Client
is a relatively expensive operation and so the GatewayClient
should be reused if possible.
Modifier and Type | Field and Description |
---|---|
static javax.ws.rs.core.MediaType |
DEFAULT_MEDIA_TYPE |
static String |
DEFAULT_TARGET_SERVER |
static String |
DEFAULT_TARGET_SERVER_PATH |
Constructor and Description |
---|
GatewayClientBuilder() |
Modifier and Type | Method and Description |
---|---|
GatewayClient |
build()
Creates the GatewayClient.
|
GatewayClientBuilder |
withClient(javax.ws.rs.client.Client client)
Specify the
Client to be used. |
GatewayClientBuilder |
withConfiguration(javax.ws.rs.core.Configuration configuration)
Provide a custom configuration for the
Client . |
GatewayClientBuilder |
withMediaType(javax.ws.rs.core.MediaType mediaType)
Override the default media type .
|
GatewayClientBuilder |
withTargetServer(String targetServer)
Override the default target server (https://smsgw.intele.com).
|
public static final String DEFAULT_TARGET_SERVER
public static final String DEFAULT_TARGET_SERVER_PATH
public static final javax.ws.rs.core.MediaType DEFAULT_MEDIA_TYPE
public GatewayClientBuilder withClient(javax.ws.rs.client.Client client)
Specify the Client
to be used.
client
- public GatewayClientBuilder withTargetServer(String targetServer)
Override the default target server (https://smsgw.intele.com).
targetServer
- public GatewayClientBuilder withMediaType(javax.ws.rs.core.MediaType mediaType)
Override the default media type .
mediaType
- public GatewayClientBuilder withConfiguration(javax.ws.rs.core.Configuration configuration)
Provide a custom configuration for the Client
.
configuration
- public GatewayClient build()
Copyright © 2016. All rights reserved.