public class JSyncUtil extends java.lang.Object implements JSyncConstants
| Modifier and Type | Field and Description | 
|---|---|
static org.apache.log4j.Logger | 
logger  | 
static java.lang.String | 
REVISION  | 
SC_BAD_ADDRESS, SC_BAD_LEADER, SC_BAD_MESSAGE, SC_DISCONNECTED, SC_INTERNAL_SERVER_ERROR, SC_JOIN_REJECTED, SC_LEADER_CANNOT_JOIN, SC_NO_ACK, SC_NO_SEND, SC_OK, SC_UNKNOWN, SC_UNKNOWN_URID, SC_URID_ALREADY_ADDED, STATUS_DISCONNECTED, STATUS_LEADER, STATUS_LONE, STATUS_MEMBER, STATUS_SUBLEADERCRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR| Constructor and Description | 
|---|
JSyncUtil()  | 
| Modifier and Type | Method and Description | 
|---|---|
static boolean | 
checkIP(javax.servlet.ServletRequest request,
       org.apache.oro.text.regex.Pattern ipPattern)  | 
static int | 
cleanStatusCode(int status)  | 
static java.lang.String | 
getStatusPhrase(int status)
Returns an english phrase associated to the given status code. 
 | 
static void | 
main(java.lang.String[] args)  | 
static AckMessage | 
readAck(java.io.InputStream in)
Read and parse an AckMessage 
 | 
static AckMessage | 
readAck(java.lang.String responseBody)
Read and parse an AckMessage 
 | 
static Message | 
readMessage(java.io.InputStream in)
Read and parse a Message 
 | 
static Message | 
readMessage(java.lang.String responseBody)
Read and parse a Message 
 | 
static AckMessage | 
sendMessage(java.lang.String url,
           Message msg)
Send a message 
 | 
static void | 
writeAck(java.io.OutputStream out,
        java.lang.String urid,
        int status,
        StampTable progressTable)
Write an AckMessage 
 | 
static void | 
writeMessage(java.io.OutputStream out,
            Message msg)
Write a Message 
 | 
public static final java.lang.String REVISION
public static final org.apache.log4j.Logger logger
public static AckMessage sendMessage(java.lang.String url, Message msg)
url - the url the message must be sent tomsg - the message to be sentpublic static void writeAck(java.io.OutputStream out,
                            java.lang.String urid,
                            int status,
                            StampTable progressTable)
out - the OutputStream to use for writing the messageurid - the URID of the senderstatus - the status codeprogressTable - the progressTable of the senderpublic static AckMessage readAck(java.io.InputStream in)
in - the InputStream that contains the message to be readpublic static AckMessage readAck(java.lang.String responseBody)
responseBody - a string containing the message to be read, usually the response body of JSync http request.public static void writeMessage(java.io.OutputStream out,
                                Message msg)
out - the OutputStream to use for writing the messagemsg - the message to writepublic static Message readMessage(java.io.InputStream in) throws org.jdom.JDOMException, java.io.IOException
in - the InputStream that contains the message to be readorg.jdom.JDOMException - if an error occursjava.io.IOException - if an error occurspublic static Message readMessage(java.lang.String responseBody) throws org.jdom.JDOMException, java.io.IOException
responseBody - a string containing the message to be read, usually the response body of JSync http request.org.jdom.JDOMException - if an error occursjava.io.IOException - if an error occurspublic static int cleanStatusCode(int status)
public static java.lang.String getStatusPhrase(int status)
status - the status codepublic static boolean checkIP(javax.servlet.ServletRequest request,
                              org.apache.oro.text.regex.Pattern ipPattern)
public static void main(java.lang.String[] args)
Copyright © 2001-2018 Jalios SA. All Rights Reserved.