Package com.qwazr.server
Class RemoteService
java.lang.Object
com.qwazr.server.RemoteService
public class RemoteService
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RemoteService.Builder
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
host
The hostname of the remote server.java.lang.String
password
the (optional) password (Basic HTTP authentication)java.lang.String
path
The root path of the servicejava.lang.Integer
port
the TCP port (9091 by default)java.lang.String
scheme
The protocol.java.lang.String
serverAddress
java.lang.String
serviceAddress
java.lang.Integer
timeout
the default timeout (milliseconds)static java.lang.String
TIMEOUT_PARAMETER
java.lang.String
username
the (optional) login (Basic HTTP authentication) -
Constructor Summary
Constructors Modifier Constructor Description protected
RemoteService(RemoteService.Builder builder)
protected
RemoteService(java.lang.String scheme, java.lang.String host, java.lang.Integer port, java.lang.String path, java.lang.Integer timeout, java.lang.String username, java.lang.String password)
-
Method Summary
Modifier and Type Method Description static RemoteService[]
build(java.lang.String... remoteServiceURLs)
Build an array of RemoteService filled with an array of URL.static RemoteService[]
build(java.util.Collection<java.lang.String> remoteServiceURLs)
Build an array of RemoteService filled with an array of URL.static java.util.List<RemoteService.Builder>
builders(java.lang.String... remoteServiceURLs)
Build a list of Builder filled with an array of URL.static java.util.List<RemoteService.Builder>
builders(java.util.Collection<java.lang.String> remoteServiceURLs)
boolean
equals(java.lang.Object o)
int
hashCode()
boolean
isCredential()
static RemoteService.Builder
of()
static RemoteService.Builder
of(java.lang.String url)
static RemoteService.Builder
of(java.net.URI uri)
java.lang.String
toString()
-
Field Details
-
TIMEOUT_PARAMETER
public static final java.lang.String TIMEOUT_PARAMETER- See Also:
- Constant Field Values
-
scheme
public final java.lang.String schemeThe protocol. Should be "http" or "https" -
host
public final java.lang.String hostThe hostname of the remote server. Localhost by default. -
path
public final java.lang.String pathThe root path of the service -
port
public final java.lang.Integer portthe TCP port (9091 by default) -
timeout
public final java.lang.Integer timeoutthe default timeout (milliseconds) -
username
public final java.lang.String usernamethe (optional) login (Basic HTTP authentication) -
password
public final java.lang.String passwordthe (optional) password (Basic HTTP authentication) -
serverAddress
public final java.lang.String serverAddress -
serviceAddress
public final java.lang.String serviceAddress
-
-
Constructor Details
-
RemoteService
protected RemoteService(java.lang.String scheme, java.lang.String host, java.lang.Integer port, java.lang.String path, java.lang.Integer timeout, java.lang.String username, java.lang.String password) -
RemoteService
-
-
Method Details
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
isCredential
public boolean isCredential() -
of
-
of
-
of
- Throws:
java.net.URISyntaxException
-
builders
public static java.util.List<RemoteService.Builder> builders(java.lang.String... remoteServiceURLs) throws java.net.URISyntaxExceptionBuild a list of Builder filled with an array of URL. The form of the URL should be: {protocol}://{username:password@}{host}:{port}/{service_path}?timeout={timeout}- Parameters:
remoteServiceURLs
- an array of URL- Returns:
- a list of RemoteService
- Throws:
java.net.URISyntaxException
- if the URI is malformatted
-
builders
public static java.util.List<RemoteService.Builder> builders(java.util.Collection<java.lang.String> remoteServiceURLs) throws java.net.URISyntaxException- Throws:
java.net.URISyntaxException
-
build
public static RemoteService[] build(java.lang.String... remoteServiceURLs) throws java.net.URISyntaxExceptionBuild an array of RemoteService filled with an array of URL. The form of the URL should be: {protocol}://{username:password@}{host}:{port}/{service_path}?timeout={timeout}- Parameters:
remoteServiceURLs
- an array of URL- Returns:
- an array of RemoteService
- Throws:
java.net.URISyntaxException
- if the URI is malformatted
-
build
public static RemoteService[] build(java.util.Collection<java.lang.String> remoteServiceURLs) throws java.net.URISyntaxExceptionBuild an array of RemoteService filled with an array of URL. The form of the URL should be: {protocol}://{username:password@}{host}:{port}/{service_path}?timeout={timeout}- Parameters:
remoteServiceURLs
- an collection of URL- Returns:
- an array of RemoteService
- Throws:
java.net.URISyntaxException
- if the URI is malformatted
-