当前位置: 首页>>代码示例>>Java>>正文


Java MessageContext.pause方法代码示例

本文整理汇总了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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:31,代码来源:MessageSaveAndRestoreTest.java

示例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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:EnginePausingTest.java

示例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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:29,代码来源:MessageSaveAndRestoreWithMTOMTest.java

示例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;

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:74,代码来源:MessageContextSaveCTest.java


注:本文中的org.apache.axis2.context.MessageContext.pause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。