public class JMapNetworkConnection extends JMapBaseNetworkConnection
JMapConnectionautoReconnect, autoSendPendingRequests, CONN_DIRECT_ALWAYS, CONN_PROXY_ALWAYS, CONN_PROXY_IFNEEDED, CONNECTION_DIRECT, CONNECTION_PROXY, connectionListeners, connectionMode, DEFAULT_DIRECT_CONNECTION_TIMEOUT, DEFAULT_PROXY_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, directConnectionTimeout, host, httpPort, JMAP_PROXY_SERVLET_PATH, port, protocol, proxyConnectionTimeout, proxyPath, READ_TIMEOUT, serverId, useProxy, verbose, workingOffline| Modifier | Constructor and Description |
|---|---|
protected |
JMapNetworkConnection()
Creates a raw network connection that won't be initialized until
initConnection() is called.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancelRequest(JMapRequest pushedRequest)
Method that cancels a previously pushed request.
|
void |
close()
Closes the connection.
|
static java.lang.Object |
deserializeObject(byte[] bytes)
Deprecated.
use
IOUtil.deserialize(byte[]) instead. |
void |
destroy() |
byte[] |
executeRequest(byte[] requestBytes)
Blocking method that sends a pre-serialized request (byte array) to JMapServer and
returns the serialized response object (byte array) obtained from JMapServer.
|
JMapResponse |
executeRequest(JMapRequest request)
Blocking method that sends a request to JMapServer and returns the response
object obtained from JMapServer.
Notes about the offline mode : - If working offline and the auto reconnect option is true, it
will try to reconnect before sending the request;- If working offline, the OfflineRequestHandler will process the request; - If offline mode is not allowed and the connection is lost, a null
response will be returned; |
int |
getReadTimeout() |
boolean |
goOffline()
This function will force the offline mode.
|
boolean |
goOnline()
This function will force the online mode.
|
protected void |
initConnection() |
boolean |
isConnected() |
void |
open(java.lang.String host,
int port)
Opens a raw network connection with JMapServer using the specified host
and port information.
|
void |
open(java.lang.String host,
int port,
int httpPort,
java.lang.String proxyPath,
java.lang.String serverId,
int connectionMode) |
void |
open(java.lang.String host,
int port,
java.lang.String proxyPath,
java.lang.String serverId)
Opens a HTTP network connection with JMapServer using the specified host,
port, proxy path and serverId.
|
void |
open(java.lang.String protocol,
java.lang.String host,
int port,
int httpPort,
java.lang.String proxyPath,
java.lang.String serverId,
int connectionMode) |
void |
pushRequest(JMapRequest request)
Non-blocking method that pushes a request in the queue.
|
static byte[] |
rawReceive(java.io.DataInputStream is) |
static void |
rawSend(byte[] bytes,
java.io.DataOutputStream os) |
static byte[] |
serializeObject(java.io.Serializable o)
Deprecated.
use
IOUtil.serialize(Serializable) instead. |
void |
setReadTimeout(int readTimeout) |
addConnectionListener, finalize, fireConnectionActivity, fireConnectionEvent, fireDisconnectionEvent, getVerbose, isAutoReconnect, isAutoSendPendingRequests, isOpen, isWorkingOffline, removeConnectionListener, schCallback, setAutoReconnect, setAutoSendPendingRequests, setVerbosepingServerprotected JMapNetworkConnection()
public void open(java.lang.String host,
int port)
throws java.io.IOException
open in class JMapBaseNetworkConnectionhost - IP address or name of JMapServer hostport - network port to usejava.io.IOExceptionpublic void open(java.lang.String host,
int port,
java.lang.String proxyPath,
java.lang.String serverId)
throws java.io.IOException
http://host:port/proxyPath?serverId=serverId that will be used for
communication between the client application and JMapServer.open in class JMapBaseNetworkConnectionhost - IP address or name of JMapServer hostport - network port to useproxyPath - the path of the proxy servletserverId - the server to connect to behind the proxyjava.io.IOExceptionpublic void open(java.lang.String host,
int port,
int httpPort,
java.lang.String proxyPath,
java.lang.String serverId,
int connectionMode)
throws java.io.IOException
open in class JMapBaseNetworkConnectionjava.io.IOExceptionpublic void open(java.lang.String protocol,
java.lang.String host,
int port,
int httpPort,
java.lang.String proxyPath,
java.lang.String serverId,
int connectionMode)
throws java.io.IOException
open in class JMapBaseNetworkConnectionjava.io.IOExceptionpublic boolean isConnected()
isConnected in class JMapConnectionprotected void initConnection()
throws java.io.IOException
java.io.IOExceptionpublic boolean goOffline()
goOffline in class JMapBaseNetworkConnectiontrue if successful, false if the connection is already in offline modepublic boolean goOnline()
goOnline in class JMapBaseNetworkConnectiontrue if successfulpublic void pushRequest(JMapRequest request)
callback method.pushRequest in class JMapConnectionrequest - the request to send to JMapServerJMapRequestClient,
JMapRequestpublic JMapResponse executeRequest(JMapRequest request) throws java.io.IOException
true, it
will try to reconnect before sending the request;null
response will be returned;executeRequest in class JMapConnectionrequest - the request to send to JMapServernull
will be return if disconnected and offline mode is not allowedjava.io.IOExceptionpublic boolean cancelRequest(JMapRequest pushedRequest)
pushedRequest - public byte[] executeRequest(byte[] requestBytes)
throws java.io.IOException
executeRequest in class JMapConnectionrequestBytes - the request bytes to send to JMapServerjava.io.IOExceptionpublic static void rawSend(byte[] bytes,
java.io.DataOutputStream os)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] rawReceive(java.io.DataInputStream is)
throws java.io.IOException
java.io.IOExceptionpublic void close()
close in class JMapConnectionpublic void destroy()
destroy in class JMapBaseNetworkConnection@Deprecated
public static byte[] serializeObject(java.io.Serializable o)
throws java.io.IOException
IOUtil.serialize(Serializable) instead.java.io.IOException@Deprecated
public static java.lang.Object deserializeObject(byte[] bytes)
throws java.io.IOException
IOUtil.deserialize(byte[]) instead.java.io.IOExceptionpublic int getReadTimeout()
public void setReadTimeout(int readTimeout)