public class TransportUtils extends Object
Constructor and Description |
---|
TransportUtils() |
Modifier and Type | Method and Description |
---|---|
static org.apache.axiom.om.OMElement |
createDocumentElement(String contentType,
Builder builder,
MessageContext msgContext,
InputStream inStream) |
static org.apache.axiom.om.OMElement |
createDocumentElement(String contentType,
MessageContext msgContext,
InputStream inStream) |
static org.apache.axiom.soap.SOAPEnvelope |
createSOAPEnvelope(org.apache.axiom.om.OMElement documentElement) |
static org.apache.axiom.soap.SOAPEnvelope |
createSOAPMessage(MessageContext msgContext) |
static org.apache.axiom.soap.SOAPEnvelope |
createSOAPMessage(MessageContext msgContext,
boolean detach)
This method will create a SOAPEnvelope based on the InputStream stored on
the MessageContext.
|
static org.apache.axiom.soap.SOAPEnvelope |
createSOAPMessage(MessageContext msgContext,
InputStream inStream,
String contentType)
Objective of this method is to capture the SOAPEnvelope creation logic
and make it a common for all the transports and to in/out flows.
|
static org.apache.axiom.soap.SOAPEnvelope |
createSOAPMessage(MessageContext msgContext,
InputStream inStream,
String contentType,
Builder builder)
Objective of this method is to capture the SOAPEnvelope creation logic
and make it a common for all the transports and to in/out flows.
|
static void |
deleteAttachments(MessageContext msgContext)
Clean up cached attachment file
|
static void |
detachInputStream(MessageContext msgContext)
Prepare the message in the given message context so that the underlying input stream can be
closed.
|
static boolean |
doWriteMTOM(MessageContext msgContext)
Checks whether MTOM needs to be enabled for the message represented by
the msgContext.
|
static boolean |
doWriteSwA(MessageContext msgContext)
Checks whether SOAP With Attachments (SwA) needs to be enabled for the
message represented by the msgContext.
|
static String |
getCharSetEncoding(MessageContext msgContext)
Utility method to query CharSetEncoding.
|
static String |
getCharSetEncoding(String contentType)
Extracts and returns the character set encoding from the
Content-type header
Example:
Content-Type: text/xml; charset=utf-8
|
static String |
getContentType(String contentType,
MessageContext msgContext) |
static boolean |
isDoingREST(MessageContext msgContext) |
static boolean |
isResponseWritten(MessageContext messageContext)
This is a helper method to get the response written flag from the RequestResponseTransport
instance.
|
static void |
processContentTypeForAction(String contentType,
MessageContext msgContext) |
static void |
setResponseWritten(MessageContext messageContext,
boolean responseWritten)
This is a helper method to set the response written flag on the RequestResponseTransport
instance.
|
static void |
writeMessage(MessageContext msgContext,
OutputStream out) |
public static org.apache.axiom.soap.SOAPEnvelope createSOAPMessage(MessageContext msgContext) throws AxisFault
AxisFault
public static org.apache.axiom.soap.SOAPEnvelope createSOAPMessage(MessageContext msgContext, boolean detach) throws AxisFault
AxisFault
public static org.apache.axiom.soap.SOAPEnvelope createSOAPMessage(MessageContext msgContext, InputStream inStream, String contentType) throws AxisFault, org.apache.axiom.om.OMException, XMLStreamException, FactoryConfigurationError
msgContext
- message contextinStream
- input streamcontentType
- content type of the messageAxisFault
- if an error occursorg.apache.axiom.om.OMException
- if the xml is invalidXMLStreamException
- if the stream is invalidFactoryConfigurationError
public static org.apache.axiom.soap.SOAPEnvelope createSOAPMessage(MessageContext msgContext, InputStream inStream, String contentType, Builder builder) throws AxisFault, org.apache.axiom.om.OMException, XMLStreamException, FactoryConfigurationError
msgContext
- message contextinStream
- input streamcontentType
- content type of the messagebuilder
- the builder to be usedAxisFault
- if an error occursorg.apache.axiom.om.OMException
- if the xml is invalidXMLStreamException
- if the stream is invalidFactoryConfigurationError
public static org.apache.axiom.soap.SOAPEnvelope createSOAPEnvelope(org.apache.axiom.om.OMElement documentElement)
public static org.apache.axiom.om.OMElement createDocumentElement(String contentType, MessageContext msgContext, InputStream inStream) throws AxisFault, XMLStreamException
AxisFault
XMLStreamException
public static org.apache.axiom.om.OMElement createDocumentElement(String contentType, Builder builder, MessageContext msgContext, InputStream inStream) throws AxisFault, XMLStreamException
AxisFault
XMLStreamException
public static String getContentType(String contentType, MessageContext msgContext)
public static String getCharSetEncoding(String contentType)
contentType
- public static void writeMessage(MessageContext msgContext, OutputStream out) throws AxisFault
AxisFault
public static void processContentTypeForAction(String contentType, MessageContext msgContext)
public static boolean isResponseWritten(MessageContext messageContext)
public static void setResponseWritten(MessageContext messageContext, boolean responseWritten)
public static void deleteAttachments(MessageContext msgContext)
msgContext
- public static void detachInputStream(MessageContext msgContext) throws AxisFault
msgContext
- AxisFault
public static boolean doWriteMTOM(MessageContext msgContext)
Checks whether MTOM needs to be enabled for the message represented by the msgContext. We check value assigned to the "enableMTOM" property either using the config files (axis2.xml, services.xml) or programatically. Programatic configuration is given priority. If the given value is "optional", MTOM will be enabled only if the incoming message was an MTOM message.
msgContext
- the active MessageContextpublic static boolean doWriteSwA(MessageContext msgContext)
Checks whether SOAP With Attachments (SwA) needs to be enabled for the message represented by the msgContext. We check value assigned to the "enableSwA" property either using the config files (axis2.xml, services.xml) or programatically. Programatic configuration is given priority. If the given value is "optional", SwA will be enabled only if the incoming message was SwA type.
msgContext
- the active MessageContextpublic static boolean isDoingREST(MessageContext msgContext)
public static String getCharSetEncoding(MessageContext msgContext)
msgContext
- the active MessageContextCopyright © The Apache Software Foundation. All Rights Reserved.