org.apache.axis2.json
Class JSONMessageFormatter

java.lang.Object
  extended by org.apache.axis2.json.AbstractJSONMessageFormatter
      extended by org.apache.axis2.json.JSONMessageFormatter
All Implemented Interfaces:
MessageFormatter

public class JSONMessageFormatter
extends AbstractJSONMessageFormatter

This JSONMessageFormatter is the formatter for "Mapped" formatted JSON in Axis2. This type of JSON strings are really easy to use in Javascript. Eg: <out><in>mapped JSON</in></out> is converted to... {"out":{"in":"mapped JSON"}} WARNING: We do not support "Mapped" JSON Strings with *namespaces* in Axis2. This convention is supported in Axis2, with the aim of making Javascript users' life easy (services written in Javascript). There are no namespaces used in Javascript. If you want to use JSON with namespaces, use the JSONBadgerfishMessageForatter (for "Badgerfish" formatted JSON) which supports JSON with namespaces.


Constructor Summary
JSONMessageFormatter()
           
 
Method Summary
protected  XMLStreamWriter getJSONWriter(Writer writer)
           
protected  String getStringToWrite(org.apache.axiom.om.OMDataSource dataSource)
          If the data source is a "Mapped" formatted data source, gives the JSON string by directly taking from the data source.
 
Methods inherited from class org.apache.axis2.json.AbstractJSONMessageFormatter
formatSOAPAction, getBytes, getContentType, getTargetAddress, writeTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONMessageFormatter

public JSONMessageFormatter()
Method Detail

getJSONWriter

protected XMLStreamWriter getJSONWriter(Writer writer)
Specified by:
getJSONWriter in class AbstractJSONMessageFormatter

getStringToWrite

protected String getStringToWrite(org.apache.axiom.om.OMDataSource dataSource)
If the data source is a "Mapped" formatted data source, gives the JSON string by directly taking from the data source.

Specified by:
getStringToWrite in class AbstractJSONMessageFormatter
Parameters:
dataSource - data source to be checked
Returns:
the JSON string to write


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