org.apache.cxf.message.Message.setInterceptorChain()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中org.apache.cxf.message.Message.setInterceptorChain()方法的一些代码示例,展示了Message.setInterceptorChain()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setInterceptorChain()方法的具体详情如下:
包路径:org.apache.cxf.message.Message
类名称:Message
方法名:setInterceptorChain

Message.setInterceptorChain介绍

暂无

代码示例

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public void setInterceptorChain(InterceptorChain chain) {
  message.setInterceptorChain(chain);
}

代码示例来源:origin: org.apache.cxf/cxf-api

public void setInterceptorChain(InterceptorChain chain) {
  message.setInterceptorChain(chain);
}

代码示例来源:origin: apache/cxf

public void setInterceptorChain(InterceptorChain chain) {
  message.setInterceptorChain(chain);
}

代码示例来源:origin: org.apache.cxf/cxf-core

public void setInterceptorChain(InterceptorChain chain) {
  message.setInterceptorChain(chain);
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

private void handleAbort(Message message, W3CDOMStreamWriter writer) {
  message.getInterceptorChain().abort();
  if (!message.getExchange().isOneWay()) {
    //server side inbound
    Endpoint e = message.getExchange().getEndpoint();
    Message responseMsg = new MessageImpl();
    responseMsg.setExchange(message.getExchange());
    responseMsg = e.getBinding().createMessage(responseMsg);
    message.getExchange().setOutMessage(responseMsg);
    XMLStreamReader reader = message.getContent(XMLStreamReader.class);
    if (reader == null && writer != null) {
      reader = StaxUtils.createXMLStreamReader(writer.getDocument());
    }
    InterceptorChain chain = OutgoingChainInterceptor
      .getOutInterceptorChain(message.getExchange());
    responseMsg.setInterceptorChain(chain);
    responseMsg.put("LogicalHandlerInterceptor.INREADER", reader);
    chain.doIntercept(responseMsg);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

faultMessage.setInterceptorChain(ic);
ic.doIntercept(faultMessage);

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

responseMsg.setInterceptorChain(chain);

代码示例来源:origin: apache/cxf

message.setInterceptorChain(chain);
chain.doIntercept(message);
Exception ex = message.getContent(Exception.class);

代码示例来源:origin: apache/cxf

private Message createOutMessage(Message inMessage, Response r) {
    Endpoint e = inMessage.getExchange().getEndpoint();
    Message mout = e.getBinding().createMessage();
    mout.setContent(List.class, new MessageContentsList(r));
    mout.setExchange(inMessage.getExchange());
    mout.setInterceptorChain(
       OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
    inMessage.getExchange().setOutMessage(mout);
    if (r.getStatus() >= Response.Status.BAD_REQUEST.getStatusCode()) {
      inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
    }
    return mout;
  }
}

代码示例来源:origin: apache/cxf

public void handleMessage(Message msg) throws Fault {
    Exchange ex = msg.getExchange();
    if (ex.isOneWay()) {
      return;
    }

    Bus bus = ex.getBus();
    SortedSet<Phase> phases = new TreeSet<>(bus.getExtension(PhaseManager.class).getOutPhases());

    //TODO Set Coloc FaultObserver chain
    ColocUtil.setPhases(phases, Phase.SETUP, Phase.USER_LOGICAL);
    InterceptorChain chain = ColocUtil.getOutInterceptorChain(ex, phases);

    if (LOG.isLoggable(Level.FINER)) {
      LOG.finer("Processing Message at collocated endpoint.  Response message: " + msg);
    }

    //Initiate OutBound Processing
    BindingOperationInfo boi = ex.getBindingOperationInfo();
    Message outBound = ex.getOutMessage();
    if (boi != null) {
      outBound.put(MessageInfo.class,
             boi.getOperationInfo().getOutput());
    }

    outBound.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
    outBound.setInterceptorChain(chain);
    chain.doIntercept(outBound);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-bindings-coloc

public void handleMessage(Message msg) throws Fault {
    Exchange ex = msg.getExchange();
    if (ex.isOneWay()) {
      return;
    }

    Bus bus = ex.getBus();
    SortedSet<Phase> phases = new TreeSet<>(bus.getExtension(PhaseManager.class).getOutPhases());

    //TODO Set Coloc FaultObserver chain
    ColocUtil.setPhases(phases, Phase.SETUP, Phase.USER_LOGICAL);
    InterceptorChain chain = ColocUtil.getOutInterceptorChain(ex, phases);

    if (LOG.isLoggable(Level.FINER)) {
      LOG.finer("Processing Message at collocated endpoint.  Response message: " + msg);
    }

    //Initiate OutBound Processing
    BindingOperationInfo boi = ex.getBindingOperationInfo();
    Message outBound = ex.getOutMessage();
    if (boi != null) {
      outBound.put(MessageInfo.class,
             boi.getOperationInfo().getOutput());
    }

    outBound.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
    outBound.setInterceptorChain(chain);
    chain.doIntercept(outBound);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

private Message createOutMessage(Message inMessage, Response r) {
    Endpoint e = inMessage.getExchange().get(Endpoint.class);
    Message mout = new MessageImpl();
    mout.setContent(List.class, new MessageContentsList(r));
    mout.setExchange(inMessage.getExchange());
    mout = e.getBinding().createMessage(mout);
    mout.setInterceptorChain(
       OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
    inMessage.getExchange().setOutMessage(mout);
    if (r.getStatus() >= Response.Status.BAD_REQUEST.getStatusCode()) {
      inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
    }
    return mout;
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-features-throttling

private Message createOutMessage(Message inMessage) {
    Endpoint e = inMessage.getExchange().getEndpoint();
    Message mout = e.getBinding().createMessage();
    mout.setExchange(inMessage.getExchange());
    mout.setInterceptorChain(
       OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
    inMessage.getExchange().setOutMessage(mout);
    inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
    return mout;
  }
}

代码示例来源:origin: apache/cxf

private Message createOutMessage(Message inMessage) {
    Endpoint e = inMessage.getExchange().getEndpoint();
    Message mout = e.getBinding().createMessage();
    mout.setExchange(inMessage.getExchange());
    mout.setInterceptorChain(
       OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
    inMessage.getExchange().setOutMessage(mout);
    inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
    return mout;
  }
}

代码示例来源:origin: apache/cxf

public void onMessage(Message m) {
  Message message = cfg.getConduitSelector().getEndpoint().getBinding().createMessage(m);
  message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
  message.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
  PhaseInterceptorChain chain = AbstractClient.setupInInterceptorChain(cfg);
  message.setInterceptorChain(chain);
  message.getExchange().setInMessage(message);
  Bus bus = cfg.getBus();
  Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus);
  ClassLoaderHolder origLoader = null;
  try {
    if (loader != null) {
      origLoader = ClassLoaderUtils.setThreadContextClassloader(loader);
    }
    // execute chain
    chain.doIntercept(message);
  } finally {
    if (origBus != bus) {
      BusFactory.setThreadDefaultBus(origBus);
    }
    if (origLoader != null) {
      origLoader.reset();
    }
    synchronized (message.getExchange()) {
      message.getExchange().notifyAll();
    }
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-client

public void onMessage(Message m) {
  Message message = cfg.getConduitSelector().getEndpoint().getBinding().createMessage(m);
  message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
  message.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
  PhaseInterceptorChain chain = AbstractClient.setupInInterceptorChain(cfg);
  message.setInterceptorChain(chain);
  message.getExchange().setInMessage(message);
  Bus bus = cfg.getBus();
  Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus);
  ClassLoaderHolder origLoader = null;
  try {
    if (loader != null) {
      origLoader = ClassLoaderUtils.setThreadContextClassloader(loader);
    }
    // execute chain
    chain.doIntercept(message);
  } finally {
    if (origBus != bus) {
      BusFactory.setThreadDefaultBus(origBus);
    }
    if (origLoader != null) {
      origLoader.reset();
    }
    synchronized (message.getExchange()) {
      message.getExchange().notifyAll();
    }
  }
}

代码示例来源:origin: apache/cxf

protected void invokeInboundChain(Exchange ex, Endpoint ep) {
  Message m = getInBoundMessage(ex);
  Message inMsg = ep.getBinding().createMessage();
  MessageImpl.copyContent(m, inMsg);
  //Copy Response Context to Client inBound Message
  //TODO a Context Filter Strategy required.
  inMsg.putAll(m);
  inMsg.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
  inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
  inMsg.setExchange(ex);
  Exception exc = inMsg.getContent(Exception.class);
  if (exc != null) {
    ex.setInFaultMessage(inMsg);
    ColocInFaultObserver observer = new ColocInFaultObserver(bus);
    observer.onMessage(inMsg);
  } else {
    //Handle Response
    ex.setInMessage(inMsg);
    PhaseManager pm = bus.getExtension(PhaseManager.class);
    SortedSet<Phase> phases = new TreeSet<>(pm.getInPhases());
    ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.PRE_INVOKE);
    InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases);
    inMsg.setInterceptorChain(chain);
    chain.doIntercept(inMsg);
  }
  ex.put(ClientImpl.FINISHED, Boolean.TRUE);
}

代码示例来源:origin: apache/cxf

private void handleAbort(Message message, W3CDOMStreamWriter writer) {
  message.getInterceptorChain().abort();
  if (!message.getExchange().isOneWay()) {
    //server side inbound
    Endpoint e = message.getExchange().getEndpoint();
    Message responseMsg = new MessageImpl();
    responseMsg.setExchange(message.getExchange());
    responseMsg = e.getBinding().createMessage(responseMsg);
    message.getExchange().setOutMessage(responseMsg);
    XMLStreamReader reader = message.getContent(XMLStreamReader.class);
    if (reader == null && writer != null) {
      reader = StaxUtils.createXMLStreamReader(writer.getDocument());
    }
    InterceptorChain chain = OutgoingChainInterceptor
      .getOutInterceptorChain(message.getExchange());
    responseMsg.setInterceptorChain(chain);
    responseMsg.put("LogicalHandlerInterceptor.INREADER", reader);
    chain.doIntercept(responseMsg);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-api

public void handleMessage(Message message) {
  Exchange ex = message.getExchange();
  BindingOperationInfo binding = ex.get(BindingOperationInfo.class);
  //if we get this far, we're going to be outputting some valid content, but we COULD
  //also be "echoing" some of the content from the input.   Thus, we need to 
  //mark it as requiring the input to be cached.   
  if (message.getExchange().get(CACHE_INPUT_PROPERTY) == null) {
    message.put(CACHE_INPUT_PROPERTY, Boolean.TRUE);
  }
  if (null != binding && null != binding.getOperationInfo() && binding.getOperationInfo().isOneWay()) {
    closeInput(message);
    return;
  }
  Message out = ex.getOutMessage();
  if (out != null) {
    getBackChannelConduit(message);
    if (binding != null) {
      out.put(MessageInfo.class, binding.getOperationInfo().getOutput());
      out.put(BindingMessageInfo.class, binding.getOutput());
    }
    
    InterceptorChain outChain = out.getInterceptorChain();
    if (outChain == null) {
      outChain = OutgoingChainInterceptor.getChain(ex, chainCache);
      out.setInterceptorChain(outChain);
    }
    outChain.doIntercept(out);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public void handleMessage(Message message) {
  Exchange ex = message.getExchange();
  BindingOperationInfo binding = ex.get(BindingOperationInfo.class);
  //if we get this far, we're going to be outputting some valid content, but we COULD
  //also be "echoing" some of the content from the input.   Thus, we need to 
  //mark it as requiring the input to be cached.   
  if (message.getExchange().get(CACHE_INPUT_PROPERTY) == null) {
    message.put(CACHE_INPUT_PROPERTY, Boolean.TRUE);
  }
  if (null != binding && null != binding.getOperationInfo() && binding.getOperationInfo().isOneWay()) {
    closeInput(message);
    return;
  }
  Message out = ex.getOutMessage();
  if (out != null) {
    getBackChannelConduit(message);
    if (binding != null) {
      out.put(MessageInfo.class, binding.getOperationInfo().getOutput());
      out.put(BindingMessageInfo.class, binding.getOutput());
    }
    
    InterceptorChain outChain = out.getInterceptorChain();
    if (outChain == null) {
      outChain = OutgoingChainInterceptor.getChain(ex, chainCache);
      out.setInterceptorChain(outChain);
    }
    outChain.doIntercept(out);
  }
}

相关文章