|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.axis2.json.JSONMessageFormatter
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 | |
java.lang.String |
formatSOAPAction(org.apache.axis2.context.MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format,
java.lang.String soapActionString)
|
byte[] |
getBytes(org.apache.axis2.context.MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format)
Gives the JSON message as an array of bytes. |
java.lang.String |
getContentType(org.apache.axis2.context.MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format,
java.lang.String soapActionString)
|
protected javax.xml.stream.XMLStreamWriter |
getJSONWriter(java.io.OutputStream outStream)
|
protected java.lang.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. |
java.net.URL |
getTargetAddress(org.apache.axis2.context.MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format,
java.net.URL targetURL)
|
void |
writeTo(org.apache.axis2.context.MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format,
java.io.OutputStream out,
boolean preserve)
Writes the JSON message to the output stream with the correct convention. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JSONMessageFormatter()
Method Detail |
public java.lang.String getContentType(org.apache.axis2.context.MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format, java.lang.String soapActionString)
getContentType
in interface org.apache.axis2.transport.MessageFormatter
public byte[] getBytes(org.apache.axis2.context.MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format) throws org.apache.axis2.AxisFault
getBytes
in interface org.apache.axis2.transport.MessageFormatter
msgCtxt
- Message context which contains the soap envelope to be writtenformat
- format of the message, this is ignored
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.public java.lang.String formatSOAPAction(org.apache.axis2.context.MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format, java.lang.String soapActionString)
formatSOAPAction
in interface org.apache.axis2.transport.MessageFormatter
protected javax.xml.stream.XMLStreamWriter getJSONWriter(java.io.OutputStream outStream)
protected java.lang.String getStringToWrite(org.apache.axiom.om.OMDataSource dataSource)
dataSource
- data source to be checked
public void writeTo(org.apache.axis2.context.MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format, java.io.OutputStream out, boolean preserve) throws org.apache.axis2.AxisFault
writeTo
in interface org.apache.axis2.transport.MessageFormatter
msgCtxt
- Message context which contains the soap envelope to be writtenformat
- format of the message, this is ignoredout
- output stream to be written in topreserve
- ignored
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.public java.net.URL getTargetAddress(org.apache.axis2.context.MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format, java.net.URL targetURL) throws org.apache.axis2.AxisFault
getTargetAddress
in interface org.apache.axis2.transport.MessageFormatter
org.apache.axis2.AxisFault
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |