Class MessageUtils

java.lang.Object
org.frankframework.util.MessageUtils

public abstract class MessageUtils extends Object
  • Constructor Details

    • MessageUtils

      public MessageUtils()
  • Method Details

    • getContext

      public static MessageContext getContext(javax.servlet.http.HttpServletRequest request)
      Fetch metadata from the HttpServletRequest such as Content-Length, Content-Type (mimetype + charset)
    • getContext

      public static MessageContext getContext(Iterator<javax.xml.soap.MimeHeader> mimeHeaders)
    • parseContentAsMessage

      public static Message parseContentAsMessage(javax.servlet.http.HttpServletRequest request) throws IOException
      If content is present (POST/PUT) one of the following headers must be set:
      Content-Length / Transfer-Encoding
      If neither header is present, or the size is 0 a nullMessage will be returned.
      Throws:
      IOException
      See Also:
    • parse

      public static Message parse(javax.xml.soap.AttachmentPart soapAttachment) throws javax.xml.soap.SOAPException
      Throws:
      javax.xml.soap.SOAPException
    • computeDecodingCharset

      public static Charset computeDecodingCharset(Message message) throws IOException
      Reads the first 10k bytes of (binary) messages to determine the charset when not present in the MessageContext.
      Throws:
      IOException - when it cannot read the first 10k bytes.
    • computeDecodingCharset

      public static Charset computeDecodingCharset(Message message, int confidence) throws IOException
      Reads the first 10k bytes of (binary) messages to determine the charset when not present in the MessageContext.
      Parameters:
      confidence - percentage required to successfully determine the charset.
      Throws:
      IOException - when it cannot read the first 10k bytes.
    • getMimeType

      public static org.springframework.util.MimeType getMimeType(Message message)
      Returns the MimeType if present in the MessageContext.
    • isMimeType

      public static boolean isMimeType(Message message, org.springframework.util.MimeType compareTo)
    • computeMimeType

      public static org.springframework.util.MimeType computeMimeType(Message message)
      Computes the MimeType when not available.

      NOTE: This is a resource intensive operation, the first 64k is being read and stored in memory.

    • computeMimeType

      public static org.springframework.util.MimeType computeMimeType(Message message, String filename)
      Computes the MimeType when not available, attempts to resolve the Charset when of type TEXT.

      NOTE: This is a resource intensive operation, the first 65536 bytes are being read and stored in memory.

    • generateMD5Hash

      public static String generateMD5Hash(Message message)
      Resource intensive operation, preserves the message and calculates an MD5 hash over the entire message.
    • generateCRC32

      public static Long generateCRC32(Message message)
      Resource intensive operation, preserves the message and calculates an CRC32 checksum over the entire message.
    • computeSize

      public static long computeSize(Message message)
      Resource intensive operation, calculates the binary size of a Message.