com.mirth.connect.server.userutil
Class HTTPUtil

java.lang.Object
  extended by com.mirth.connect.server.userutil.HTTPUtil

public class HTTPUtil
extends java.lang.Object

Provides HTTP utility methods.


Method Summary
static java.lang.String httpBodyToXml(java.io.InputStream httpBody, java.lang.String contentType)
          Serializes an HTTP request body into XML.
static java.lang.String httpBodyToXml(java.lang.String httpBody, java.lang.String contentType)
          Serializes an HTTP request body into XML.
static java.util.Map<java.lang.String,java.lang.String> parseHeaders(java.lang.String str)
          Converts a block of HTTP header fields into a Map containing each header key and value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseHeaders

public static java.util.Map<java.lang.String,java.lang.String> parseHeaders(java.lang.String str)
                                                                     throws java.lang.Exception
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:
java.lang.Exception

httpBodyToXml

public static java.lang.String httpBodyToXml(java.io.InputStream httpBody,
                                             java.lang.String contentType)
                                      throws javax.mail.MessagingException,
                                             java.io.IOException,
                                             com.mirth.connect.donkey.util.DonkeyElement.DonkeyElementException,
                                             javax.xml.parsers.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
java.io.IOException
com.mirth.connect.donkey.util.DonkeyElement.DonkeyElementException
javax.xml.parsers.ParserConfigurationException

httpBodyToXml

public static java.lang.String httpBodyToXml(java.lang.String httpBody,
                                             java.lang.String contentType)
                                      throws javax.mail.MessagingException,
                                             java.io.IOException,
                                             com.mirth.connect.donkey.util.DonkeyElement.DonkeyElementException,
                                             javax.xml.parsers.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
java.io.IOException
com.mirth.connect.donkey.util.DonkeyElement.DonkeyElementException
javax.xml.parsers.ParserConfigurationException