public class NashornJavaScriptMessageContext extends Object implements ScriptMessageContext
Constructor and Description |
---|
NashornJavaScriptMessageContext(org.apache.synapse.MessageContext mc,
org.apache.bsf.xml.XMLHelper xmlHelper,
jdk.nashorn.api.scripting.ScriptObjectMirror emptyJsonObject,
jdk.nashorn.api.scripting.ScriptObjectMirror jsonSerializer) |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(boolean mustUnderstand,
Object content)
Add a new SOAP header to the message.
|
org.apache.synapse.config.SynapseConfiguration |
getConfiguration()
All the remainder just use the underlying MessageContext.
|
Map<String,Object> |
getContextEntries() |
Stack<org.apache.synapse.ContinuationState> |
getContinuationStateStack() |
org.apache.synapse.Mediator |
getDefaultConfiguration(String arg0) |
org.apache.synapse.endpoints.Endpoint |
getEndpoint(String key) |
Object |
getEntry(String key) |
org.apache.axiom.soap.SOAPEnvelope |
getEnvelope() |
Object |
getEnvelopeXML()
Get the XML representation of the complete SOAP envelope.
|
org.apache.synapse.core.SynapseEnvironment |
getEnvironment() |
org.apache.synapse.Mediator |
getFaultSequence() |
Stack<org.apache.synapse.FaultHandler> |
getFaultStack() |
org.apache.axis2.addressing.EndpointReference |
getFaultTo() |
org.apache.axiom.om.OMElement |
getFormat(String s) |
org.apache.axis2.addressing.EndpointReference |
getFrom() |
Object |
getJsonText()
Get the Message Payload as a text.
|
Object |
getLocalEntry(String key) |
org.apache.synapse.Mediator |
getMainSequence() |
int |
getMessageFlowTracingState() |
String |
getMessageID() |
String |
getMessageString() |
org.apache.axiom.om.OMElement |
getParsedOMElement(InputStream stream)
Returns the parsed xml document.
|
Object |
getPayloadJSON()
Get the JSON object representation of the JSON message body of the request.
|
String |
getPayloadText()
Get the Message Payload as a text.
|
Object |
getPayloadXML()
Get the XML representation of SOAP Body payload.
|
Object |
getProperty(String key) |
Set |
getPropertyKeySet() |
org.apache.axis2.addressing.RelatesTo |
getRelatesTo() |
org.apache.axis2.addressing.EndpointReference |
getReplyTo() |
org.apache.synapse.Mediator |
getSequence(String key) |
org.apache.synapse.Mediator |
getSequenceTemplate(String key) |
org.apache.commons.logging.Log |
getServiceLog() |
String |
getSoapAction() |
org.apache.axis2.addressing.EndpointReference |
getTo() |
int |
getTracingState() |
String |
getWSAAction() |
String |
getWSAMessageID() |
org.apache.axiom.om.xpath.AXIOMXPath |
getXpathResult(String expression)
Returns the Axiom xpath.
|
boolean |
isContinuationEnabled() |
boolean |
isDoingGET() |
boolean |
isDoingMTOM() |
boolean |
isDoingPOX() |
boolean |
isDoingSWA() |
boolean |
isFaultResponse() |
boolean |
isResponse() |
boolean |
isSOAP11() |
Object |
jsonObject(org.apache.synapse.MessageContext messageContext)
Returns the JavaScript Object saved in this message context.
|
Document |
parseXml(String text)
Returns the parsed xml document.
|
void |
pushContinuationState(org.apache.synapse.ContinuationState continuationState) |
void |
pushFaultHandler(org.apache.synapse.FaultHandler fault) |
void |
removeProperty(String key,
String scope)
Remove property from the message.
|
void |
setConfiguration(org.apache.synapse.config.SynapseConfiguration cfg) |
void |
setContextEntries(Map<String,Object> entries) |
void |
setContinuationEnabled(boolean contStateStackEnabled) |
void |
setDoingGET(boolean b) |
void |
setDoingMTOM(boolean b) |
void |
setDoingPOX(boolean b) |
void |
setDoingSWA(boolean b) |
void |
setEnvelope(org.apache.axiom.soap.SOAPEnvelope envelope) |
void |
setEnvironment(org.apache.synapse.core.SynapseEnvironment se) |
void |
setFaultResponse(boolean b) |
void |
setFaultTo(org.apache.axis2.addressing.EndpointReference reference) |
void |
setFaultTo(String reference)
This is used to set the value which specifies the receiver of the faults relating to the message.
|
void |
setFrom(org.apache.axis2.addressing.EndpointReference reference) |
void |
setFrom(String reference)
This is used to set the value which specifies the sender of the message.
|
boolean |
setJsonObject(org.apache.synapse.MessageContext messageContext,
Object jsonObject)
Saves the JavaScript Object to the message context.
|
boolean |
setJsonText(org.apache.synapse.MessageContext messageContext,
Object jsonObject)
Saves the JSON String to the message context.
|
void |
setMessageFlowTracingState(int state) |
void |
setMessageID(String string) |
void |
setPayloadJSON(Object jsonPayload)
Saves the payload of this message context as a JSON payload.
|
void |
setPayloadXML(Object payload)
Set the SOAP body payload from XML.
|
void |
setProperty(String key,
Object value)
Add a new property to the message.
|
void |
setProperty(String key,
Object value,
String scope)
Add a new property to the message.
|
void |
setRelatesTo(org.apache.axis2.addressing.RelatesTo[] reference) |
void |
setReplyTo(org.apache.axis2.addressing.EndpointReference reference) |
void |
setReplyTo(String reference)
This is used to set the value which specifies the receiver of the replies to the message.
|
void |
setResponse(boolean b) |
void |
setScriptEngine(ScriptEngine scriptEngine)
Set a script engine.
|
void |
setSoapAction(String string) |
void |
setTo(org.apache.axis2.addressing.EndpointReference reference) |
void |
setTo(String reference)
This is used to set the value which specifies the receiver of the message.
|
void |
setTracingState(int tracingState) |
void |
setWSAAction(String actionURI) |
void |
setWSAMessageID(String messageID) |
public NashornJavaScriptMessageContext(org.apache.synapse.MessageContext mc, org.apache.bsf.xml.XMLHelper xmlHelper, jdk.nashorn.api.scripting.ScriptObjectMirror emptyJsonObject, jdk.nashorn.api.scripting.ScriptObjectMirror jsonSerializer)
public Object getPayloadXML()
getPayloadXML
in interface ScriptMessageContext
public void setPayloadXML(Object payload) throws org.apache.axiom.om.OMException, ScriptException
setPayloadXML
in interface ScriptMessageContext
payload
- Message payloadScriptException
- For errors in converting xml To OMorg.apache.axiom.om.OMException
- For errors in OM manipulationpublic Object getPayloadJSON()
getPayloadJSON
in interface ScriptMessageContext
public Object getJsonText()
getJsonText
in interface ScriptMessageContext
public String getPayloadText()
getPayloadText
in interface ScriptMessageContext
public boolean setJsonObject(org.apache.synapse.MessageContext messageContext, Object jsonObject)
setJsonObject
in interface ScriptMessageContext
messageContext
- The message context of the sequencejsonObject
- JavaScript Object which is passed to be saved in message contextpublic boolean setJsonText(org.apache.synapse.MessageContext messageContext, Object jsonObject)
setJsonText
in interface ScriptMessageContext
messageContext
- The message context of the sequencejsonObject
- JavaScript string which is passed to be saved in message contextpublic Object jsonObject(org.apache.synapse.MessageContext messageContext)
jsonObject
in interface ScriptMessageContext
messageContext
- The message context of the sequencepublic void setScriptEngine(ScriptEngine scriptEngine)
setScriptEngine
in interface ScriptMessageContext
scriptEngine
- a ScriptEngine instancepublic Document parseXml(String text) throws ScriptException
text
- xml string or document needed to be parserScriptException
public org.apache.axiom.om.OMElement getParsedOMElement(InputStream stream)
stream
- input stream of xml string or document needed to be parsedpublic org.apache.axiom.om.xpath.AXIOMXPath getXpathResult(String expression) throws org.jaxen.JaxenException
expression
- Xpath expressionorg.jaxen.JaxenException
public void addHeader(boolean mustUnderstand, Object content) throws ScriptException
addHeader
in interface ScriptMessageContext
mustUnderstand
- the value for the soapenv:mustUnderstand
attributecontent
- the XML for the new headerScriptException
- if an error occurs when converting the XML to OMpublic Object getEnvelopeXML() throws ScriptException
getEnvelopeXML
in interface ScriptMessageContext
ScriptException
- in-case of an error in getting
the XML representation of SOAP envelopepublic void setTo(String reference)
setTo
in interface ScriptMessageContext
reference
- specifies the receiver of the messagepublic void setFaultTo(String reference)
setFaultTo
in interface ScriptMessageContext
reference
- specifies the specifies the receiver of the faults relating to the messagepublic void setFrom(String reference)
setFrom
in interface ScriptMessageContext
reference
- specifies the sender of the messagepublic void setReplyTo(String reference)
setReplyTo
in interface ScriptMessageContext
reference
- specifies the receiver of the replies to the messagepublic org.apache.synapse.config.SynapseConfiguration getConfiguration()
getConfiguration
in interface org.apache.synapse.MessageContext
public void setConfiguration(org.apache.synapse.config.SynapseConfiguration cfg)
setConfiguration
in interface org.apache.synapse.MessageContext
public org.apache.synapse.core.SynapseEnvironment getEnvironment()
getEnvironment
in interface org.apache.synapse.MessageContext
public void setEnvironment(org.apache.synapse.core.SynapseEnvironment se)
setEnvironment
in interface org.apache.synapse.MessageContext
public Map<String,Object> getContextEntries()
getContextEntries
in interface org.apache.synapse.MessageContext
public void setContextEntries(Map<String,Object> entries)
setContextEntries
in interface org.apache.synapse.MessageContext
public Object getProperty(String key)
getProperty
in interface org.apache.synapse.MessageContext
public Object getEntry(String key)
getEntry
in interface org.apache.synapse.MessageContext
public Object getLocalEntry(String key)
getLocalEntry
in interface org.apache.synapse.MessageContext
public void setProperty(String key, Object value)
setProperty
in interface org.apache.synapse.MessageContext
key
- unique identifier of propertyvalue
- value of propertypublic void setProperty(String key, Object value, String scope)
setProperty
in interface ScriptMessageContext
key
- unique identifier of propertyvalue
- value of propertyscope
- scope of the propertypublic void removeProperty(String key, String scope)
removeProperty
in interface ScriptMessageContext
key
- unique identifier of propertyscope
- scope of the propertypublic Set getPropertyKeySet()
getPropertyKeySet
in interface org.apache.synapse.MessageContext
public org.apache.synapse.Mediator getMainSequence()
getMainSequence
in interface org.apache.synapse.MessageContext
public org.apache.synapse.Mediator getFaultSequence()
getFaultSequence
in interface org.apache.synapse.MessageContext
public org.apache.synapse.Mediator getSequence(String key)
getSequence
in interface org.apache.synapse.MessageContext
public org.apache.axiom.om.OMElement getFormat(String s)
getFormat
in interface org.apache.synapse.MessageContext
public org.apache.synapse.endpoints.Endpoint getEndpoint(String key)
getEndpoint
in interface org.apache.synapse.MessageContext
public org.apache.axiom.soap.SOAPEnvelope getEnvelope()
getEnvelope
in interface org.apache.synapse.MessageContext
public void setEnvelope(org.apache.axiom.soap.SOAPEnvelope envelope) throws org.apache.axis2.AxisFault
setEnvelope
in interface org.apache.synapse.MessageContext
org.apache.axis2.AxisFault
public org.apache.axis2.addressing.EndpointReference getFaultTo()
getFaultTo
in interface org.apache.synapse.MessageContext
public void setFaultTo(org.apache.axis2.addressing.EndpointReference reference)
setFaultTo
in interface org.apache.synapse.MessageContext
public org.apache.axis2.addressing.EndpointReference getFrom()
getFrom
in interface org.apache.synapse.MessageContext
public void setFrom(org.apache.axis2.addressing.EndpointReference reference)
setFrom
in interface org.apache.synapse.MessageContext
public String getMessageID()
getMessageID
in interface org.apache.synapse.MessageContext
public void setMessageID(String string)
setMessageID
in interface org.apache.synapse.MessageContext
public org.apache.axis2.addressing.RelatesTo getRelatesTo()
getRelatesTo
in interface org.apache.synapse.MessageContext
public void setRelatesTo(org.apache.axis2.addressing.RelatesTo[] reference)
setRelatesTo
in interface org.apache.synapse.MessageContext
public org.apache.axis2.addressing.EndpointReference getReplyTo()
getReplyTo
in interface org.apache.synapse.MessageContext
public void setReplyTo(org.apache.axis2.addressing.EndpointReference reference)
setReplyTo
in interface org.apache.synapse.MessageContext
public org.apache.axis2.addressing.EndpointReference getTo()
getTo
in interface org.apache.synapse.MessageContext
public void setTo(org.apache.axis2.addressing.EndpointReference reference)
setTo
in interface org.apache.synapse.MessageContext
public void setWSAAction(String actionURI)
setWSAAction
in interface org.apache.synapse.MessageContext
public String getWSAAction()
getWSAAction
in interface org.apache.synapse.MessageContext
public String getSoapAction()
getSoapAction
in interface org.apache.synapse.MessageContext
public void setSoapAction(String string)
setSoapAction
in interface org.apache.synapse.MessageContext
public void setWSAMessageID(String messageID)
setWSAMessageID
in interface org.apache.synapse.MessageContext
public String getWSAMessageID()
getWSAMessageID
in interface org.apache.synapse.MessageContext
public boolean isDoingMTOM()
isDoingMTOM
in interface org.apache.synapse.MessageContext
public boolean isDoingSWA()
isDoingSWA
in interface org.apache.synapse.MessageContext
public void setDoingMTOM(boolean b)
setDoingMTOM
in interface org.apache.synapse.MessageContext
public void setDoingSWA(boolean b)
setDoingSWA
in interface org.apache.synapse.MessageContext
public boolean isDoingPOX()
isDoingPOX
in interface org.apache.synapse.MessageContext
public void setDoingPOX(boolean b)
setDoingPOX
in interface org.apache.synapse.MessageContext
public boolean isDoingGET()
isDoingGET
in interface org.apache.synapse.MessageContext
public void setDoingGET(boolean b)
setDoingGET
in interface org.apache.synapse.MessageContext
public boolean isSOAP11()
isSOAP11
in interface org.apache.synapse.MessageContext
public void setResponse(boolean b)
setResponse
in interface org.apache.synapse.MessageContext
public boolean isResponse()
isResponse
in interface org.apache.synapse.MessageContext
public void setFaultResponse(boolean b)
setFaultResponse
in interface org.apache.synapse.MessageContext
public boolean isFaultResponse()
isFaultResponse
in interface org.apache.synapse.MessageContext
public int getTracingState()
getTracingState
in interface org.apache.synapse.MessageContext
public void setTracingState(int tracingState)
setTracingState
in interface org.apache.synapse.MessageContext
public Stack<org.apache.synapse.FaultHandler> getFaultStack()
getFaultStack
in interface org.apache.synapse.MessageContext
public void pushFaultHandler(org.apache.synapse.FaultHandler fault)
pushFaultHandler
in interface org.apache.synapse.MessageContext
public void pushContinuationState(org.apache.synapse.ContinuationState continuationState)
pushContinuationState
in interface org.apache.synapse.MessageContext
public Stack<org.apache.synapse.ContinuationState> getContinuationStateStack()
getContinuationStateStack
in interface org.apache.synapse.MessageContext
public boolean isContinuationEnabled()
isContinuationEnabled
in interface org.apache.synapse.MessageContext
public void setContinuationEnabled(boolean contStateStackEnabled)
setContinuationEnabled
in interface org.apache.synapse.MessageContext
public org.apache.commons.logging.Log getServiceLog()
getServiceLog
in interface org.apache.synapse.MessageContext
public org.apache.synapse.Mediator getSequenceTemplate(String key)
getSequenceTemplate
in interface org.apache.synapse.MessageContext
public void setPayloadJSON(Object jsonPayload) throws ScriptException
setPayloadJSON
in interface ScriptMessageContext
jsonPayload
- Javascript native object to be set as the message bodyScriptException
- in case of creating a JSON object out of the javascript native object.public org.apache.synapse.Mediator getDefaultConfiguration(String arg0)
getDefaultConfiguration
in interface org.apache.synapse.MessageContext
public String getMessageString()
getMessageString
in interface org.apache.synapse.MessageContext
public void setMessageFlowTracingState(int state)
setMessageFlowTracingState
in interface org.apache.synapse.MessageContext
public int getMessageFlowTracingState()
getMessageFlowTracingState
in interface org.apache.synapse.MessageContext
Copyright © 2005–2017 Apache Software Foundation. All rights reserved.