public final class ConnectionManager extends Object
connections
. Example usage: Connection connection = ConnectionManager.getConnection("localhost", 8000, ConnectionManager.HTTP_MODE, "login", "password", );
try { connection.connect(); ... } catch (IOException e) { context.logError(e.getMessage()); } catch (AuthenticationException e) { context.logError(e.getMessage()); } catch (MaximumNumberOfSessionsExceededException e) { context.logError(e.getMessage()); } finally { try { connection.close(); } catch (IOException e) { context.logError(e.getMessage()); } }
Modifier and Type | Class and Description |
---|---|
static class |
ConnectionManager.ClientJarInputStream
An input stream for accessing client jars.
|
static class |
ConnectionManager.SocketParam
Container for socket parameters.
|
Modifier and Type | Field and Description |
---|---|
static String |
AUTH_ADMIN
Authentication method using the default admin as defined in the fs-jaas.conf.
|
static String |
AUTH_CLIENT
Authentication method using the client login as defined in the fs-jaas.conf.
|
static String |
AUTH_DEFAULT
Authentication method using the default login as defined in the fs-jaas.conf.
|
static String |
AUTH_SYSTEM
Authentication method using the system login as defined in the fs-jaas.conf.
|
static String |
AUTH_WEB_NONSSO
Authentication method using the Non-SSO-based web login as defined in the fs-jaas.conf.
|
static String |
AUTH_WEB_SSO
Authentication method using the SSO-based web login as defined in the fs-jaas.conf.
|
static byte |
COMPRESSION_DEFLATE
Default compression level.
|
static byte |
COMPRESSION_DEFLATE_BEST
Compression level for best compression.
|
static byte |
COMPRESSION_DEFLATE_SPEED
Compression level for fastest compression.
|
static byte |
COMPRESSION_NONE
Use this value to use communication without compression.
|
static byte |
COMPRESSION_SNAPPY
Deprecated.
since 5.2.12, use
COMPRESSION_NONE , COMPRESSION_DEFLATE_SPEED , or any of the other compression flags instead. |
static byte |
ENCRYPTION_DH_ARC4
Use the Alleged RC4 encryption type for communications.
|
static byte |
ENCRYPTION_NONE
Use this value to use communication without encryption.
|
static byte |
ENCRYPTION_TLS
Use the TLS encryption type for communications.
|
static byte |
HTTP_DEFAULT_COMPRESSION
Default compression level for HTTP-mode.
|
static byte |
HTTP_DEFAULT_ENCRYPTION
Default encryption level for HTTP-mode.
|
static int |
HTTP_MODE
User HTTP-mode for communication
|
static String |
REVISION
Current package implementation revision.
|
static byte |
SOCKET_DEFAULT_COMPRESSION
Default compression level for SOCKET-mode.
|
static byte |
SOCKET_DEFAULT_ENCRYPTION
Default encryption level for SOCKET-mode.
|
static int |
SOCKET_MODE
Use Socket-Mode for communication
|
Modifier and Type | Method and Description |
---|---|
static de.espirit.firstspirit.client.io.ServerCaller |
createCaller(String host,
int port,
int mode,
String servletZone)
Creates a server caller based on the given information.
|
static Map<String,String> |
createLoginParams(String user,
String plainPassword)
Creates a login parameter container based on the given user name and plain password.
|
static ConnectionManager.ClientJarInputStream |
downloadClientJar(String host,
int port,
int mode)
Download fs-client.jar from server
|
static ConnectionManager.ClientJarInputStream |
downloadClientJar(String host,
int port,
int mode,
String servletZone)
Download fs-client.jar from server
|
static byte |
getCompression(int mode)
Get the used compression for the specified connection mode.
|
static Connection |
getConnection(String host,
int port,
int mode,
String login,
Map<?,?> loginParams)
Create a connection to a FIRSTspirit server instance, the physical connection is not already established after this call.
|
static Connection |
getConnection(String host,
int port,
int mode,
String login,
String password)
Create a connection to a FIRSTspirit server instance, the physical connection is not already established after this call.
|
static Connection |
getConnection(String host,
int port,
int mode,
String servletzone,
String module,
CallbackHandler cbHandler)
Create a connection accessor to a FirstSpirit server.
|
static Connection |
getConnection(String host,
int port,
int mode,
String servletZone,
String login,
Map<?,?> loginParams)
Create a connection to a FIRSTspirit server instance, the physical connection is not already established after this call.
|
static Connection |
getConnection(String host,
int port,
int mode,
String servletZone,
String login,
String password)
Create a connection to a FIRSTspirit server instance, the physical connection is not already established after this call.
|
static de.espirit.firstspirit.access.ExceptionHandler |
getDefaultExceptionHandler()
Returns current default
ExceptionHandler |
static byte |
getEncryption(int mode)
Get the used encryption for the specified connection mode.
|
static boolean |
getForceConnect()
Indicates, whether to force connections.
|
static de.espirit.firstspirit.access.Proxy |
getProxy()
Get the proxy used for new connections.
|
static boolean |
getUseHttps()
Should https protocol be used for servlet communication.
|
static void |
resetCompression()
Reset the used compression to default values.
|
static void |
resetEncryption()
Reset the used encryption to default values.
|
static void |
setCompression(byte compression)
Set the used compression.
|
static void |
setDefaultExceptionHandler(de.espirit.firstspirit.access.ExceptionHandler handler)
Sets the default
ExceptionHandler for all connections without an own handler. |
static void |
setEncryption(byte encryption)
Set the used encryption.
|
static void |
setProxy(de.espirit.firstspirit.access.Proxy proxy)
Set the proxy used for creating new connections.
|
static void |
setUseHttps(boolean useHttps)
Set if https protocol should be used for servlet communication.
|
static void |
testConnection(String host,
int port,
int mode)
Test connection parameters
|
static void |
testConnection(String host,
int port,
int mode,
String servletZone)
Test connection parameters
|
public static final String AUTH_DEFAULT
public static final String AUTH_CLIENT
public static final String AUTH_ADMIN
public static final String AUTH_SYSTEM
public static final String AUTH_WEB_SSO
public static final String AUTH_WEB_NONSSO
public static final byte ENCRYPTION_NONE
setEncryption(byte)
,
Constant Field Valuespublic static final byte ENCRYPTION_TLS
setEncryption(byte)
,
Constant Field Valuespublic static final byte ENCRYPTION_DH_ARC4
setEncryption(byte)
,
Constant Field Valuespublic static final byte COMPRESSION_NONE
setCompression(byte)
,
Constant Field Valuespublic static final byte COMPRESSION_DEFLATE
setCompression(byte)
,
Constant Field Valuespublic static final byte COMPRESSION_DEFLATE_SPEED
setCompression(byte)
,
Constant Field Valuespublic static final byte COMPRESSION_DEFLATE_BEST
setCompression(byte)
,
Constant Field Values@Deprecated public static final byte COMPRESSION_SNAPPY
COMPRESSION_NONE
, COMPRESSION_DEFLATE_SPEED
, or any of the other compression flags instead.setCompression(byte)
,
Constant Field Valuespublic static final String REVISION
public static final int HTTP_MODE
public static final int SOCKET_MODE
public static byte SOCKET_DEFAULT_COMPRESSION
public static byte SOCKET_DEFAULT_ENCRYPTION
public static byte HTTP_DEFAULT_COMPRESSION
public static byte HTTP_DEFAULT_ENCRYPTION
public static Connection getConnection(String host, int port, int mode, @Nullable String servletzone, String module, CallbackHandler cbHandler)
Connection.connect()
at a later point.host
- The name of the server's host to set up a connection for.port
- The port of the server to be used.mode
- The connection mode, one of HTTP_MODE
or SOCKET_MODE
.servletzone
- The servlet zone to be used.module
- The login method to be used, as defined in the fs-jaas.conf.cbHandler
- The callback handler.public static Connection getConnection(String host, int port, int mode, String login, Map<?,?> loginParams)
Connection.connect()
.host
- hostnameport
- portmode
- connection mode, one of HTTP_MODE
, or SOCKET_MODE
login
- login method (AuthenticationModule
).loginParams
- login parameters.Connection.connect()
topublic static Connection getConnection(String host, int port, int mode, String servletZone, String login, Map<?,?> loginParams)
Connection.connect()
.host
- hostnameport
- portmode
- connection mode, one of HTTP_MODE
, or SOCKET_MODE
servletZone
- servletzone, only used when mode is HTTP_MODE
login
- login method (AuthenticationModule
).loginParams
- login parameters.Connection.connect()
before you can use the connectionpublic static Connection getConnection(String host, int port, int mode, String login, String password)
Connection.connect()
.host
- hostnameport
- portmode
- connection mode, one of HTTP_MODE
, or SOCKET_MODE
login
- unsernamepassword
- passwordConnection.connect()
topublic static Connection getConnection(String host, int port, int mode, String servletZone, String login, String password)
Connection.connect()
.host
- hostnameport
- portmode
- connection mode, one of HTTP_MODE
, or SOCKET_MODE
servletZone
- servletzone, only used when mode is HTTP_MODE
login
- usernamepassword
- passwordConnection.connect()
before you can use the connectionpublic static de.espirit.firstspirit.access.Proxy getProxy()
public static void setProxy(de.espirit.firstspirit.access.Proxy proxy)
proxy
- The proxypublic static byte getEncryption(int mode)
mode
- connection mode, one of HTTP_MODE
, or SOCKET_MODE
ENCRYPTION_NONE
, ENCRYPTION_TLS
, ENCRYPTION_DH_ARC4
public static void setEncryption(byte encryption)
encryption
- the used encryption, one of ENCRYPTION_NONE
, ENCRYPTION_TLS
, ENCRYPTION_DH_ARC4
public static void resetEncryption()
public static void setCompression(byte compression)
compression
- the used compression, one of COMPRESSION_NONE
, COMPRESSION_DEFLATE
, COMPRESSION_DEFLATE_BEST
, COMPRESSION_DEFLATE_SPEED
public static void resetCompression()
public static boolean getUseHttps()
public static void setUseHttps(boolean useHttps)
public static byte getCompression(int mode)
mode
- connection mode, one of HTTP_MODE
, or SOCKET_MODE
COMPRESSION_NONE
, COMPRESSION_DEFLATE
, COMPRESSION_DEFLATE_BEST
, COMPRESSION_DEFLATE_SPEED
public static void testConnection(String host, int port, int mode) throws IOException
host
- The host o connect toport
- The server portmode
- The connection modeVersionMismatchException
- Throw if client has wrong versionIOException
- Thrown if there is a communication problempublic static void testConnection(String host, int port, int mode, String servletZone) throws IOException
host
- The host to connect toport
- The server portmode
- The connection modeservletZone
- The servletzoneVersionMismatchException
- Throw if client has wrong versionIOException
- Thrown if there is a communication problempublic static ConnectionManager.ClientJarInputStream downloadClientJar(String host, int port, int mode) throws IOException
host
- The server host nameport
- The server portmode
- The connection modeIOException
- Thrown if there is a communication problempublic static ConnectionManager.ClientJarInputStream downloadClientJar(String host, int port, int mode, String servletZone) throws IOException
host
- The server host nameport
- The server portmode
- The connection modeservletZone
- The servletzoneIOException
- Thrown if there is a communication problem@NotNull public static de.espirit.firstspirit.client.io.ServerCaller createCaller(String host, int port, int mode, String servletZone)
host
- The server host name.port
- The server port.mode
- The connection mode, one of HTTP_MODE
or SOCKET_MODE
.servletZone
- The servlet zone.public static boolean getForceConnect()
true
, if to force connections.public static Map<String,String> createLoginParams(String user, String plainPassword)
user
- The user's name.plainPassword
- The plain given password.public static de.espirit.firstspirit.access.ExceptionHandler getDefaultExceptionHandler()
ExceptionHandler
ExceptionHandler
.public static void setDefaultExceptionHandler(de.espirit.firstspirit.access.ExceptionHandler handler)
ExceptionHandler
for all connections without an own handler.handler
- new default handler.Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210