Class HTTPUtil
java.lang.Object
com.mirth.connect.server.userutil.HTTPUtil
Provides HTTP utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringhttpBodyToXml(InputStream httpBody, String contentType) Serializes an HTTP request body into XML.static StringhttpBodyToXml(String httpBody, String contentType) Serializes an HTTP request body into XML.parseHeaders(String str) Converts a block of HTTP header fields into a Map containing each header key and value.
-
Method Details
-
parseHeaders
Converts a block of HTTP header fields into a Map containing each header key and value.- Parameters:
str- The block of HTTP header fields to convert.- Returns:
- The converted Map containing header key-value pairs.
- Throws:
Exception- If the header string could not be parsed.
-
httpBodyToXml
public static String httpBodyToXml(InputStream httpBody, String contentType) throws javax.mail.MessagingException, IOException, com.mirth.connect.donkey.util.DonkeyElement.DonkeyElementException, ParserConfigurationException Serializes an HTTP request body into XML. Multipart requests will also automatically be parsed into separate XML nodes.- Parameters:
httpBody- The request body/payload input stream to parse.contentType- The MIME content type of the request.- Returns:
- The serialized XML string.
- Throws:
javax.mail.MessagingException- If the body could not be converted into a multipart object.IOException- If the body could not be read into a string.com.mirth.connect.donkey.util.DonkeyElement.DonkeyElementException- If an XML parsing error occurs.ParserConfigurationException- If an XML or multipart parsing error occurs.
-
httpBodyToXml
public static String httpBodyToXml(String httpBody, String contentType) throws javax.mail.MessagingException, IOException, com.mirth.connect.donkey.util.DonkeyElement.DonkeyElementException, ParserConfigurationException Serializes an HTTP request body into XML. Multipart requests will also automatically be parsed into separate XML nodes.- Parameters:
httpBody- The request body/payload string to parse.contentType- The MIME content type of the request.- Returns:
- The serialized XML string.
- Throws:
javax.mail.MessagingException- If the body could not be converted into a multipart object.IOException- If the body could not be read into a string.com.mirth.connect.donkey.util.DonkeyElement.DonkeyElementException- If an XML parsing error occurs.ParserConfigurationException- If an XML or multipart parsing error occurs.
-