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

📄 correlatorhandler.java

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

import java.util.Collection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.addressing.AddressingInHandler;
import org.codehaus.xfire.handler.AbstractHandler;
import org.codehaus.xfire.handler.Phase;

public class CorrelatorHandler extends AbstractHandler
{
    private static final Log log = LogFactory.getLog(Client.class);

    private Collection calls;
    private Correlator correlator;
    
    public CorrelatorHandler(Collection calls)
    {
        super();
        
        setPhase(Phase.PRE_DISPATCH);
        after(AddressingInHandler.class.getName());
        
        this.calls = calls;
    }

    public void invoke(MessageContext context)
        throws Exception
    {
        log.debug("Correlating context with ID " + context.getId());
        
        Invocation invocation = correlator.correlate(context, calls);
        
        if (invocation == null)
        {
            log.info("No correlated invocation was found.");
            return;
        }
        
        if (context != invocation.getContext())
        {
            context.getExchange().setOperation(invocation.getContext().getExchange().getOperation());
            context.getExchange().setOutMessage(invocation.getContext().getExchange().getOutMessage());
        }
        
        if (invocation != null)
        {
            log.debug("Found correlated context with ID " + context.getId());
            context.getInPipeline().addHandler(new ClientReceiveHandler(invocation));
        }
    }

    public Correlator getCorrelator()
    {
        return correlator;
    }

    public void setCorrelator(Correlator correlator)
    {
        this.correlator = correlator;
    }
}

⌨️ 快捷键说明

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