⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 postinvocationhandler.java

📁 Xfire文件 用于开发web service 的一个开源工具 很好用的
💻 JAVA
字号:
package org.codehaus.xfire.service.binding;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.exchange.OutMessage;
import org.codehaus.xfire.fault.XFireFault;
import org.codehaus.xfire.handler.AbstractHandler;
import org.codehaus.xfire.handler.DefaultFaultHandler;
import org.codehaus.xfire.handler.Phase;

public class PostInvocationHandler extends AbstractHandler {

    private static final Log logger = LogFactory.getLog(PostInvocationHandler.class.getName());
    public static final String RESPONSE_VALUE = "postInvocationHandler.responseValue";

    public PostInvocationHandler() {
        super();
        setPhase(Phase.SERVICE);
        after(ServiceInvocationHandler.class.getName());
    }

    public void invoke(MessageContext context) throws Exception {
        Object value = context.getProperty(RESPONSE_VALUE);
        
        if (context.getExchange().hasOutMessage())
        {
            OutMessage outMsg = context.getExchange().getOutMessage();
            ServiceInvocationHandler.writeHeaders(context, value);
            context.setCurrentMessage(outMsg);
            outMsg.setBody(new Object[] {value});
            outMsg.setSerializer(context.getBinding().getSerializer(context.getExchange().getOperation()));
            
            try
            {
                context.getOutPipeline().invoke(context);
            }
            catch (Exception e)
            { 
                logger.error(e);

                XFireFault fault = XFireFault.createFault(e);
                context.setProperty(DefaultFaultHandler.EXCEPTION, fault);
                
                context.getCurrentPipeline().pause();
                
                context.getCurrentPipeline().handleFault(fault, context);
                context.getInPipeline().handleFault(fault, context);

                context.getFaultHandler().invoke(context);
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -