本文整理汇总了Java中org.apache.axis2.context.MessageContext.pause方法的典型用法代码示例。如果您正苦于以下问题:Java MessageContext.pause方法的具体用法?Java MessageContext.pause怎么用?Java MessageContext.pause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.context.MessageContext
的用法示例。
在下文中一共展示了MessageContext.pause方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {
System.out.println("MessageSaveAndRestoreTest:Inbound handler invoked");
if (messageContext.getProperty(stateProperty) == null) {
System.out.println("MessageSaveAndRestoreTest:Suspending processing");
messageContext.setProperty(stateProperty, new Object());
messageContext.pause();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
ObjectOutputStream objectOutputStream =
new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(messageContext);
objectOutputStream.flush();
objectOutputStream.close();
byteArrayOutputStream.flush();
byteArrayOutputStream.close();
}
catch (IOException e) {
e.printStackTrace();
fail("An error occurred when serializing the MessageContext");
}
new Worker(byteArrayOutputStream.toByteArray(),
messageContext.getConfigurationContext()).start();
return InvocationResponse.SUSPEND;
} else {
System.out.println(
"MessageSaveAndRestoreTest:Skipping previously invoked Inbound handler");
}
return InvocationResponse.CONTINUE;
}
示例2: invoke
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
if (pause) {
msgContext.pause();
pause = false;
return InvocationResponse.SUSPEND;
}
Integer faultIndex = (Integer)msgContext.getProperty(FAULT_IDX);
if (faultIndex != null && faultIndex.equals(index)) {
throw new AxisFault(FAULT_REASON);
}
executedHandlers.add(index);
return InvocationResponse.CONTINUE;
}
示例3: invoke
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {
System.out.println("MessageSaveAndRestoreWithMTOMTest:Inbound handler invoked");
if (messageContext.getProperty(stateProperty) == null) {
System.out.println("MessageSaveAndRestoreWithMTOMTest:Suspending processing");
messageContext.setProperty(stateProperty, new Object());
messageContext.pause();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
ObjectOutputStream objectOutputStream =
new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(messageContext);
objectOutputStream.flush();
objectOutputStream.close();
byteArrayOutputStream.flush();
byteArrayOutputStream.close();
}
catch (IOException e) {
e.printStackTrace();
fail("An error occurred when serializing the MessageContext");
}
new Worker(byteArrayOutputStream.toByteArray(),
messageContext.getConfigurationContext()).start();
} else {
System.out.println(
"MessageSaveAndRestoreWithMTOMTest:Skipping previously invoked Inbound handler");
}
return InvocationResponse.CONTINUE;
}
示例4: invoke
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
String title = "SaveHandler[" + getHandlerID() + "]:invoke(): ";
savedOk = false;
if (performSave == false) {
log.debug(title + "Configured for no action to be performed.");
return InvocationResponse.CONTINUE;
}
log.debug(title + "msgContext.pause()");
msgContext.pause();
if (theFile != null) {
try {
log.debug(title + "Resetting the file to use.");
theFile.delete();
theFile.createNewFile();
theFilename = theFile.getName();
log.debug(title + "temp file = [" + theFilename + "]");
}
catch (Exception ex) {
log.debug(title + "error creating new file = [" + ex.getMessage() + "]");
}
if (theFile.exists() == true) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
// attach a stream capable of writing objects to the
// stream connected to the file
ObjectOutputStream outObjStream = new ObjectOutputStream(outStream);
// try to save the message context
log.debug(title + "saving message context.....");
savedOk = false;
outObjStream.writeObject(msgContext);
// close out the streams
outObjStream.flush();
outObjStream.close();
outStream.flush();
outStream.close();
savedOk = true;
log.debug(title + "....saved message context.....");
long filesize = theFile.length();
log.debug(title + "file size after save [" + filesize +
"] temp file = [" + theFilename + "]");
}
catch (Exception ex2) {
log.debug(title + "error with saving message context = [" +
ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
assertTrue(savedOk);
}
}
log.debug(title + "executedHandlers.add(" + handlerID + ")");
executedHandlers.add(handlerID);
return InvocationResponse.SUSPEND;
}