public abstract class MessageUtils extends Object
Constructor and Description |
---|
MessageUtils() |
Modifier and Type | Method and Description |
---|---|
static Charset |
computeDecodingCharset(Message message)
Reads the first 10k bytes of (binary) messages to determine the charset when not present in the
MessageContext . |
static Charset |
computeDecodingCharset(Message message,
int confidence)
Reads the first 10k bytes of (binary) messages to determine the charset when not present in the
MessageContext . |
static org.springframework.util.MimeType |
computeMimeType(Message message)
Computes the
MimeType when not available. |
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. |
static long |
computeSize(Message message)
Resource intensive operation, calculates the binary size of a Message.
|
static Long |
generateCRC32(Message message)
Resource intensive operation, preserves the message and calculates an CRC32 checksum over the entire message.
|
static String |
generateMD5Hash(Message message)
Resource intensive operation, preserves the message and calculates an MD5 hash over the entire message.
|
static MessageContext |
getContext(javax.servlet.http.HttpServletRequest request)
Fetch metadata from the
HttpServletRequest such as Content-Length, Content-Type (mimetype + charset) |
static MessageContext |
getContext(Iterator<MimeHeader> mimeHeaders) |
static org.springframework.util.MimeType |
getMimeType(Message message)
Returns the
MimeType if present in the MessageContext . |
static boolean |
isMimeType(Message message,
org.springframework.util.MimeType compareTo) |
static Message |
parse(AttachmentPart soapAttachment) |
static Message |
parseContentAsMessage(javax.servlet.http.HttpServletRequest request)
If content is present (POST/PUT) one of the following headers must be set:
Content-Length / Transfer-Encoding If neither header is present a nullMessage will be returned. |
public static MessageContext getContext(javax.servlet.http.HttpServletRequest request)
HttpServletRequest
such as Content-Length, Content-Type (mimetype + charset)public static MessageContext getContext(Iterator<MimeHeader> mimeHeaders)
public static Message parseContentAsMessage(javax.servlet.http.HttpServletRequest request) throws IOException
nullMessage
will be returned.IOException
public static Message parse(AttachmentPart soapAttachment) throws SOAPException
SOAPException
public static Charset computeDecodingCharset(Message message) throws IOException
MessageContext
.IOException
- when it cannot read the first 10k bytes.public static Charset computeDecodingCharset(Message message, int confidence) throws IOException
MessageContext
.confidence
- percentage required to successfully determine the charset.IOException
- when it cannot read the first 10k bytes.public static org.springframework.util.MimeType getMimeType(Message message)
MimeType
if present in the MessageContext
.public static boolean isMimeType(Message message, org.springframework.util.MimeType compareTo)
public static org.springframework.util.MimeType computeMimeType(Message message)
MimeType
when not available.
NOTE: This is a resource intensive operation, the first 64k is being read and stored in memory.
public static org.springframework.util.MimeType computeMimeType(Message message, String filename)
MimeType
when not available, attempts to resolve the Charset when of type TEXT.
NOTE: This is a resource intensive operation, the first bytes are being read and stored in memory.
public static String generateMD5Hash(Message message)
public static Long generateCRC32(Message message)
public static long computeSize(Message message)
Copyright © 2023 Frank!Framework. All rights reserved.