public abstract class AbstractJSONMessageFormatter extends Object implements MessageFormatter
Constructor and Description |
---|
AbstractJSONMessageFormatter() |
Modifier and Type | Method and Description |
---|---|
String |
formatSOAPAction(MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format,
String soapActionString) |
byte[] |
getBytes(MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format)
Gives the JSON message as an array of bytes.
|
String |
getContentType(MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format,
String soapActionString)
Different message formats can set their own content types
Eg: JSONFormatter can set the content type as application/json
|
protected abstract XMLStreamWriter |
getJSONWriter(Writer writer) |
protected abstract 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.
|
URL |
getTargetAddress(MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format,
URL targetURL)
Some message formats may want to alter the target url.
|
void |
writeTo(MessageContext msgCtxt,
org.apache.axiom.om.OMOutputFormat format,
OutputStream out,
boolean preserve)
Writes the JSON message to the output stream with the correct convention.
|
public String getContentType(MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format, String soapActionString)
MessageFormatter
getContentType
in interface MessageFormatter
public byte[] getBytes(MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format) throws AxisFault
getBytes
in interface MessageFormatter
msgCtxt
- Message context which contains the soap envelope to be writtenformat
- format of the message, this is ignoredAxisFault
- 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 String formatSOAPAction(MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format, String soapActionString)
formatSOAPAction
in interface MessageFormatter
protected abstract XMLStreamWriter getJSONWriter(Writer writer)
protected abstract String getStringToWrite(org.apache.axiom.om.OMDataSource dataSource)
dataSource
- data source to be checkedpublic void writeTo(MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format, OutputStream out, boolean preserve) throws AxisFault
writeTo
in interface 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
- ignoredAxisFault
- 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 URL getTargetAddress(MessageContext msgCtxt, org.apache.axiom.om.OMOutputFormat format, URL targetURL) throws AxisFault
MessageFormatter
getTargetAddress
in interface MessageFormatter
AxisFault
Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.