Class AbstractJSONMessageFormatter

  • All Implemented Interfaces:
    org.apache.axis2.kernel.MessageFormatter
    Direct Known Subclasses:
    JSONBadgerfishMessageFormatter, JSONMessageFormatter

    public abstract class AbstractJSONMessageFormatter
    extends Object
    implements org.apache.axis2.kernel.MessageFormatter
    Base class for JSON message formatters.
    • Constructor Detail

      • AbstractJSONMessageFormatter

        public AbstractJSONMessageFormatter​(Class<? extends AbstractJSONDataSource> dataSourceClass)
        Constructor.
        Parameters:
        dataSourceClass - the OMDataSource class corresponding to the JSON format used by this message formatter; this information is used for optimization (pass through)
    • Method Detail

      • getContentType

        public String getContentType​(org.apache.axis2.context.MessageContext msgCtxt,
                                     org.apache.axiom.om.OMOutputFormat format,
                                     String soapActionString)
        Specified by:
        getContentType in interface org.apache.axis2.kernel.MessageFormatter
      • formatSOAPAction

        public String formatSOAPAction​(org.apache.axis2.context.MessageContext msgCtxt,
                                       org.apache.axiom.om.OMOutputFormat format,
                                       String soapActionString)
        Specified by:
        formatSOAPAction in interface org.apache.axis2.kernel.MessageFormatter
      • writeTo

        public void writeTo​(org.apache.axis2.context.MessageContext msgCtxt,
                            org.apache.axiom.om.OMOutputFormat format,
                            OutputStream out,
                            boolean preserve)
                     throws org.apache.axis2.AxisFault
        Writes the JSON message to the output stream with the correct convention. If the payload is an OMSourcedElement and it contains a JSONDataSource with a correctly formatted JSON String, gets it directly from the DataSource and writes to the output stream. If not, the OM tree is expanded and it is serialized into the output stream. *
        Specified by:
        writeTo in interface org.apache.axis2.kernel.MessageFormatter
        Parameters:
        msgCtxt - Message context which contains the soap envelope to be written
        format - format of the message, this is ignored
        out - output stream to be written in to
        preserve - ignored
        Throws:
        org.apache.axis2.AxisFault - if there is an error in writing the message using StAX writer or IF THE USER TRIES TO SEND A JSON MESSAGE WITH NAMESPACES USING THE "MAPPED" CONVENTION.
      • getTargetAddress

        public URL getTargetAddress​(org.apache.axis2.context.MessageContext msgCtxt,
                                    org.apache.axiom.om.OMOutputFormat format,
                                    URL targetURL)
                             throws org.apache.axis2.AxisFault
        Specified by:
        getTargetAddress in interface org.apache.axis2.kernel.MessageFormatter
        Throws:
        org.apache.axis2.AxisFault