Class JSyncUtil

    • Field Detail

      • logger

        public static final org.apache.log4j.Logger logger
    • Constructor Detail

      • JSyncUtil

        public JSyncUtil()
    • Method Detail

      • sendMessage

        public static AckMessage sendMessage​(java.lang.String url,
                                             Message msg,
                                             java.lang.String secret,
                                             int timeout)
        Send a message
        Parameters:
        url - the url the message must be sent to
        msg - the message to be sent
        secret - the sharedSecret
        timeout - request timeout
        Returns:
        the AckMessage
        Since:
        jcms-4.1
      • writeAck

        public static void writeAck​(java.io.OutputStream out,
                                    java.lang.String urid,
                                    int status,
                                    StampTable progressTable)
        Write an AckMessage
        Parameters:
        out - the OutputStream to use for writing the message
        urid - the URID of the sender
        status - the status code
        progressTable - the progressTable of the sender
        Since:
        jcms-4.1
      • readAck

        public static AckMessage readAck​(java.io.InputStream in)
        Read and parse an AckMessage
        Parameters:
        in - the InputStream that contains the message to be read
        Returns:
        an AckMessage or null if the message have not been correctly parsed
        Since:
        jcms-4.1
      • readAck

        public static AckMessage readAck​(java.lang.String responseBody)
        Read and parse an AckMessage
        Parameters:
        responseBody - a string containing the message to be read, usually the response body of JSync http request.
        Returns:
        an AckMessage or null if the message could not be parsed
        Since:
        jcms-5.7.5
      • writeMessage

        public static void writeMessage​(java.io.OutputStream out,
                                        Message msg)
        Write a Message
        Parameters:
        out - the OutputStream to use for writing the message
        msg - the message to write
        Since:
        jcms-4.1
      • readMessage

        public static Message readMessage​(java.io.InputStream in)
                                   throws org.jdom.JDOMException,
                                          java.io.IOException
        Read and parse a Message
        Parameters:
        in - the InputStream that contains the message to be read
        Returns:
        an instance of a sub class of Message class, or null if the message have not been correctly parsed
        Throws:
        org.jdom.JDOMException - if an error occurs
        java.io.IOException - if an error occurs
        Since:
        jcms-4.1
      • readMessage

        public static Message readMessage​(java.lang.String responseBody)
                                   throws org.jdom.JDOMException,
                                          java.io.IOException
        Read and parse a Message
        Parameters:
        responseBody - a string containing the message to be read, usually the response body of JSync http request.
        Returns:
        an instance of a sub class of Message class, or null if the message could not be parsed
        Throws:
        org.jdom.JDOMException - if an error occurs
        java.io.IOException - if an error occurs
        Since:
        jcms-5.7.5
      • cleanStatusCode

        public static int cleanStatusCode​(int status)
      • getStatusPhrase

        public static java.lang.String getStatusPhrase​(int status)
        Returns an english phrase associated to the given status code.
        Parameters:
        status - the status code
        Returns:
        an english phrase associated to the given status code.
        Since:
        jcms-4.1
      • checkIP

        public static boolean checkIP​(javax.servlet.ServletRequest request,
                                      org.apache.oro.text.regex.Pattern ipPattern)
      • main

        public static void main​(java.lang.String[] args)