messagecontext.java
来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 2,012 行 · 第 1/5 页
JAVA
2,012 行
/**
* @param b
*/
public void setDoingSwA(boolean b) {
doingSwA = b;
}
/**
* @param envelope
*/
public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
this.envelope = envelope;
if (this.envelope != null) {
String soapNamespaceURI = envelope.getNamespace().getNamespaceURI();
if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
.equals(soapNamespaceURI)) {
isSOAP11 = false;
} else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
.equals(soapNamespaceURI)) {
isSOAP11 = true;
} else {
throw new AxisFault(
"Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
}
}
}
/**
* Set the execution chain of Handler in this MessageContext. Doing this
* causes the current handler/phase indexes to reset to 0, since we have new
* Handlers to execute (this usually only happens at initialization and when
* a fault occurs).
*
* @param executionChain
*/
public void setExecutionChain(ArrayList executionChain) {
this.executionChain = executionChain;
currentHandlerIndex = -1;
currentPhaseIndex = 0;
}
/**
* @param reference
*/
public void setFaultTo(EndpointReference reference) {
options.setFaultTo(reference);
}
/**
* @param reference
*/
public void setFrom(EndpointReference reference) {
options.setFrom(reference);
}
/**
* @param messageId
*/
public void setMessageID(String messageId) {
options.setMessageId(messageId);
}
/**
* @param b
*/
public void setNewThreadRequired(boolean b) {
newThreadRequired = b;
}
/**
* @param context The OperationContext
*/
public void setOperationContext(OperationContext context) {
// allow setting the fields to null
// useful when extracting the messge context from the object graph
operationContext = context;
this.setParent(operationContext);
if (operationContext != null) {
if (serviceContext == null) {
setServiceContext(operationContext.getServiceContext());
} else {
if (operationContext.getParent() != serviceContext) {
throw new AxisError("ServiceContext in OperationContext does not match !");
}
}
this.setAxisOperation(operationContext.getAxisOperation());
}
}
/**
* @param b
*/
public void setOutputWritten(boolean b) {
outputWritten = b;
}
/**
* @param b
*/
public void setProcessingFault(boolean b) {
processingFault = b;
}
/**
* Add a RelatesTo
*
* @param reference RelatesTo describing how we relate to another message
*/
public void addRelatesTo(RelatesTo reference) {
options.addRelatesTo(reference);
}
/**
* Set ReplyTo destination
*
* @param reference the ReplyTo EPR
*/
public void setReplyTo(EndpointReference reference) {
options.setReplyTo(reference);
}
/**
* @param b
*/
public void setResponseWritten(boolean b) {
responseWritten = b;
}
/**
* @param b
*/
public void setServerSide(boolean b) {
serverSide = b;
}
/**
* @param context
*/
public void setServiceContext(ServiceContext context) {
// allow the service context to be set to null
// this allows the message context object to be extraced from
// the object graph
serviceContext = context;
if (serviceContext != null) {
if ((operationContext != null)
&& (operationContext.getParent() != context)) {
throw new AxisError("ServiceContext and OperationContext.parent do not match!");
}
// setting configcontext using configuration context in service context
if (configurationContext == null) {
// setting configcontext
configurationContext = context.getConfigurationContext();
}
if (serviceGroupContext == null) {
// setting service group context
serviceGroupContext = context.getServiceGroupContext();
}
this.setAxisService(context.getAxisService());
}
}
/**
* Sets the service context id.
*
* @param serviceContextID
*/
public void setServiceContextID(String serviceContextID) {
this.serviceContextID = serviceContextID;
}
public void setServiceGroupContext(ServiceGroupContext serviceGroupContext) {
// allow the service group context to be set to null
// this allows the message context object to be extraced from
// the object graph
this.serviceGroupContext = serviceGroupContext;
if (this.serviceGroupContext != null) {
this.axisServiceGroup = serviceGroupContext.getDescription();
}
}
public void setServiceGroupContextId(String serviceGroupContextId) {
this.serviceGroupContextId = serviceGroupContextId;
}
/**
* @param soapAction
*/
public void setSoapAction(String soapAction) {
options.setAction(soapAction);
}
/**
* @param to
*/
public void setTo(EndpointReference to) {
options.setTo(to);
}
/**
* @param in
*/
public void setTransportIn(TransportInDescription in) {
this.transportIn = in;
}
/**
* @param out
*/
public void setTransportOut(TransportOutDescription out) {
transportOut = out;
}
/**
* setWSAAction
*/
public void setWSAAction(String actionURI) {
options.setAction(actionURI);
}
public void setWSAMessageId(String messageID) {
options.setMessageId(messageID);
}
// to get the flow inwhich the execution chain below
public int getFLOW() {
return FLOW;
}
public void setFLOW(int FLOW) {
this.FLOW = FLOW;
}
public Options getOptions() {
if (LoggingControl.debugLoggingAllowed) {
checkActivateWarning("getOptions");
}
return options;
}
/**
* Set the options for myself. I make the given options my own options'
* parent so that that becomes the default. That allows the user to override
* specific options on a given message context and not affect the overall
* options.
*
* @param options the options to set
*/
public void setOptions(Options options) {
this.options.setParent(options);
}
public String getIncomingTransportName() {
return incomingTransportName;
}
public void setIncomingTransportName(String incomingTransportName) {
this.incomingTransportName = incomingTransportName;
}
public void setRelationships(RelatesTo[] list) {
options.setRelationships(list);
}
public Policy getEffectivePolicy() {
if (LoggingControl.debugLoggingAllowed) {
checkActivateWarning("getEffectivePolicy");
}
if (axisMessage != null) {
return axisMessage.getPolicyInclude().getEffectivePolicy();
}
if (axisOperation != null) {
return axisOperation.getPolicyInclude().getEffectivePolicy();
}
if (axisService != null) {
return axisService.getPolicyInclude().getEffectivePolicy();
}
return configurationContext.getAxisConfiguration().getPolicyInclude().getEffectivePolicy();
}
public boolean isEngaged(String moduleName) {
if (LoggingControl.debugLoggingAllowed) {
checkActivateWarning("isEngaged");
}
boolean enegage;
if (configurationContext != null) {
AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
AxisModule module = axisConfig.getModule(moduleName);
if (module == null) {
return false;
}
enegage = axisConfig.isEngaged(module);
if (enegage) {
return true;
}
if (axisServiceGroup != null) {
enegage = axisServiceGroup.isEngaged(module);
if (enegage) {
return true;
}
}
if (axisService != null) {
enegage = axisService.isEngaged(module);
if (enegage) {
return true;
}
}
if (axisOperation != null) {
enegage = axisOperation.isEngaged(module);
if (enegage) {
return true;
}
}
}
return false;
}
/**
* Gets the first child of the envelope, check if it is a soap:Body, which means there is no header.
* We do this basically to make sure we don't parse and build the om tree of the whole envelope
* looking for the soap header. If this method returns true, there still is no guarantee that there is
* a soap:Header present, use getHeader() and also check for null on getHeader() to be absolutely sure.
*
* @return boolean
* @deprecated The bonus you used to get from this is now built in to SOAPEnvelope.getHeader()
*/
public boolean isHeaderPresent() {
// If there's no envelope there can't be a header.
if (this.envelope == null) {
return false;
}
return (this.envelope.getHeader() != null);
}
/**
* Setting of the attachments map should be performed at the receipt of a
* message only. This method is only meant to be used by the Axis2
* internals.
*
* @param attachments
*/
public void setAttachmentMap(Attachments attachments) {
this.attachments = attachments;
}
/**
* You can directly access the attachment map of the message context from
* here. Returned attachment map can be empty.
*
* @return attachment
*/
public Attachments getAttachmentMap() {
if (attachments == null) {
attachments = new Attachments();
}
return attachments;
}
/**
* Adds an attachment to the attachment Map of this message context. This
* attachment gets serialised as a MIME attachment when sending the message
* if SOAP with Attachments is enabled.
*
* @param contentID :
* will be the content ID of the MIME part
* @param dataHandler
*/
public void addAttachment(String contentID, DataHandler dataHandler) {
if (attachments == null) {
attachments = new Attachments();
}
attachments.addDataHandler(contentID, dataHandler);
}
/**
* Adds an attachment to the attachment Map of this message context. This
* attachment gets serialised as a MIME attachment when sending the message
* if SOAP with Attachments is enabled. Content ID of the MIME part will be
* auto generated by Axis2.
*
* @param dataHandler
* @return the auto generated content ID of the MIME attachment
*/
public String addAttachment(DataHandler dataHandler) {
String contentID = UUIDGenerator.getUUID();
addAttachment(contentID, dataHandler);
return contentID;
}
/**
* Access the DataHandler of the attachment contained in the map corresponding to the given
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?