Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.axis2.transport
Class TransportUtils

    java.lang.Object
      org.apache.axis2.transport.TransportUtils

    public class TransportUtils

extends java.lang.Object

Constructor Summary
`TransportUtils()`

Method Summary
`static org.apache.axiom.om.OMElement` | `createDocumentElement(java.lang.String contentType, MessageContext msgContext, java.io.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, java.io.InputStream inStream, java.lang.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 void` | `deleteAttachments(MessageContext msgContext)` Clean up cached attachment file
`static void` | `detachInputStream(MessageContext msgContext)` This method can be called by components wishing to detach the DetachableInputStream object that is present on the MessageContext.
`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 java.lang.String` | `getCharSetEncoding(MessageContext msgContext)` Utility method to query CharSetEncoding.
`static java.lang.String` | `getCharSetEncoding(java.lang.String contentType)` Extracts and returns the character set encoding from the Content-type header Example: Content-Type: text/xml; charset=utf-8
`static java.lang.String` | `getContentType(java.lang.String contentType, MessageContext msgContext)`
`static MessageFormatter` | `getMessageFormatter(MessageContext msgContext)` Initial work for a builder selector which selects the builder for a given message format based on the the content type of the recieved message.
`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(java.lang.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, java.io.OutputStream out)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TransportUtils

    public TransportUtils()

Method Detail

### createSOAPMessage

    public static org.apache.axiom.soap.SOAPEnvelope createSOAPMessage(MessageContext msgContext)
                                                                throws AxisFault

  Throws:
    `AxisFault`

### createSOAPMessage

    public static org.apache.axiom.soap.SOAPEnvelope createSOAPMessage(MessageContext msgContext,
                                                                       boolean detach)
                                                                throws AxisFault

  This method will create a SOAPEnvelope based on the InputStream stored on the MessageContext. The 'detach' parameter controls whether or not the underlying DetachableInputStream is detached at the end of the method. Note, detaching the DetachableInputStream closes the underlying InputStream that is stored on the MessageContext.

  Throws:
    `AxisFault`

### createSOAPMessage

    public static org.apache.axiom.soap.SOAPEnvelope createSOAPMessage(MessageContext msgContext,
                                                                       java.io.InputStream inStream,
                                                                       java.lang.String contentType)
                                                                throws AxisFault,
                                                                       org.apache.axiom.om.OMException,
                                                                       javax.xml.stream.XMLStreamException,
                                                                       javax.xml.parsers.FactoryConfigurationError

  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.

  Parameters:
    `msgContext` -
    `inStream` -
    `contentType` -
  Returns:
    the SOAPEnvelope
  Throws:
    `AxisFault`
    `org.apache.axiom.om.OMException`
    `javax.xml.stream.XMLStreamException`
    `javax.xml.parsers.FactoryConfigurationError`

### createSOAPEnvelope

    public static org.apache.axiom.soap.SOAPEnvelope createSOAPEnvelope(org.apache.axiom.om.OMElement documentElement)

### createDocumentElement

    public static org.apache.axiom.om.OMElement createDocumentElement(java.lang.String contentType,
                                                                      MessageContext msgContext,
                                                                      java.io.InputStream inStream)
                                                               throws AxisFault,
                                                                      javax.xml.stream.XMLStreamException

  Throws:
    `AxisFault`
    `javax.xml.stream.XMLStreamException`

### getContentType

    public static java.lang.String getContentType(java.lang.String contentType,
                                                  MessageContext msgContext)

### getCharSetEncoding

    public static java.lang.String getCharSetEncoding(java.lang.String contentType)

  Extracts and returns the character set encoding from the Content-type header Example: Content-Type: text/xml; charset=utf-8

  Parameters:
    `contentType` -

### writeMessage

    public static void writeMessage(MessageContext msgContext,
                                    java.io.OutputStream out)
                             throws AxisFault

  Throws:
    `AxisFault`

### getMessageFormatter

    public static MessageFormatter getMessageFormatter(MessageContext msgContext)
                                                throws AxisFault

  Initial work for a builder selector which selects the builder for a given message format based on the the content type of the recieved message. content-type to builder mapping can be specified through the Axis2.xml.

  Parameters:
    `msgContext` -
  Returns:
    the builder registered against the given content-type
  Throws:
    `AxisFault`

### processContentTypeForAction

    public static void processContentTypeForAction(java.lang.String contentType,
                                                   MessageContext msgContext)

### isResponseWritten

    public static boolean isResponseWritten(MessageContext messageContext)

  This is a helper method to get the response written flag from the RequestResponseTransport instance.

### setResponseWritten

    public static void setResponseWritten(MessageContext messageContext,
                                          boolean responseWritten)

  This is a helper method to set the response written flag on the RequestResponseTransport instance.

### deleteAttachments

    public static void deleteAttachments(MessageContext msgContext)

  Clean up cached attachment file

  Parameters:
    `msgContext` -

### detachInputStream

    public static void detachInputStream(MessageContext msgContext)
                                  throws AxisFault

  This method can be called by components wishing to detach the DetachableInputStream object that is present on the MessageContext. This is meant to shield components from any logic that needs to be executed on the DetachableInputStream in order to have it effectively detached. If the DetachableInputStream is not present, or if the supplied MessageContext is null, no action will be taken.

  Throws:
    `AxisFault`

### doWriteMTOM

    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.

  Parameters:
    `msgContext` - the active MessageContext
  Returns:
    true if SwA needs to be enabled

### doWriteSwA

    public 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.

  Parameters:
    `msgContext` - the active MessageContext
  Returns:
    true if SwA needs to be enabled

### isDoingREST

    public static boolean isDoingREST(MessageContext msgContext)

### getCharSetEncoding

    public static java.lang.String getCharSetEncoding(MessageContext msgContext)

  Utility method to query CharSetEncoding. First look in the MessageContext. If it's not there look in the OpContext. Use the defualt, if it's not given in either contexts.

  Parameters:
    `msgContext` - the active MessageContext
  Returns:
    String the CharSetEncoding

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2011 The Apache Software Foundation. All Rights Reserved.