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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. private void handleAbort(Message message, W3CDOMStreamWriter writer) {
  2. message.getInterceptorChain().abort();
  3. if (!message.getExchange().isOneWay()) {
  4. //server side inbound
  5. Endpoint e = message.getExchange().getEndpoint();
  6. Message responseMsg = new MessageImpl();
  7. responseMsg.setExchange(message.getExchange());
  8. responseMsg = e.getBinding().createMessage(responseMsg);
  9. message.getExchange().setOutMessage(responseMsg);
  10. XMLStreamReader reader = message.getContent(XMLStreamReader.class);
  11. if (reader == null && writer != null) {
  12. reader = StaxUtils.createXMLStreamReader(writer.getDocument());
  13. }
  14. InterceptorChain chain = OutgoingChainInterceptor
  15. .getOutInterceptorChain(message.getExchange());
  16. responseMsg.setInterceptorChain(chain);
  17. responseMsg.put("LogicalHandlerInterceptor.INREADER", reader);
  18. chain.doIntercept(responseMsg);
  19. }
  20. }

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

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

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

  1. responseMsg.setInterceptorChain(chain);

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

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

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

  1. private Message createOutMessage(Message inMessage, Response r) {
  2. Endpoint e = inMessage.getExchange().getEndpoint();
  3. Message mout = e.getBinding().createMessage();
  4. mout.setContent(List.class, new MessageContentsList(r));
  5. mout.setExchange(inMessage.getExchange());
  6. mout.setInterceptorChain(
  7. OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
  8. inMessage.getExchange().setOutMessage(mout);
  9. if (r.getStatus() >= Response.Status.BAD_REQUEST.getStatusCode()) {
  10. inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
  11. }
  12. return mout;
  13. }
  14. }

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

  1. public void handleMessage(Message msg) throws Fault {
  2. Exchange ex = msg.getExchange();
  3. if (ex.isOneWay()) {
  4. return;
  5. }
  6. Bus bus = ex.getBus();
  7. SortedSet<Phase> phases = new TreeSet<>(bus.getExtension(PhaseManager.class).getOutPhases());
  8. //TODO Set Coloc FaultObserver chain
  9. ColocUtil.setPhases(phases, Phase.SETUP, Phase.USER_LOGICAL);
  10. InterceptorChain chain = ColocUtil.getOutInterceptorChain(ex, phases);
  11. if (LOG.isLoggable(Level.FINER)) {
  12. LOG.finer("Processing Message at collocated endpoint. Response message: " + msg);
  13. }
  14. //Initiate OutBound Processing
  15. BindingOperationInfo boi = ex.getBindingOperationInfo();
  16. Message outBound = ex.getOutMessage();
  17. if (boi != null) {
  18. outBound.put(MessageInfo.class,
  19. boi.getOperationInfo().getOutput());
  20. }
  21. outBound.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
  22. outBound.setInterceptorChain(chain);
  23. chain.doIntercept(outBound);
  24. }
  25. }

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

  1. public void handleMessage(Message msg) throws Fault {
  2. Exchange ex = msg.getExchange();
  3. if (ex.isOneWay()) {
  4. return;
  5. }
  6. Bus bus = ex.getBus();
  7. SortedSet<Phase> phases = new TreeSet<>(bus.getExtension(PhaseManager.class).getOutPhases());
  8. //TODO Set Coloc FaultObserver chain
  9. ColocUtil.setPhases(phases, Phase.SETUP, Phase.USER_LOGICAL);
  10. InterceptorChain chain = ColocUtil.getOutInterceptorChain(ex, phases);
  11. if (LOG.isLoggable(Level.FINER)) {
  12. LOG.finer("Processing Message at collocated endpoint. Response message: " + msg);
  13. }
  14. //Initiate OutBound Processing
  15. BindingOperationInfo boi = ex.getBindingOperationInfo();
  16. Message outBound = ex.getOutMessage();
  17. if (boi != null) {
  18. outBound.put(MessageInfo.class,
  19. boi.getOperationInfo().getOutput());
  20. }
  21. outBound.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
  22. outBound.setInterceptorChain(chain);
  23. chain.doIntercept(outBound);
  24. }
  25. }

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

  1. private Message createOutMessage(Message inMessage, Response r) {
  2. Endpoint e = inMessage.getExchange().get(Endpoint.class);
  3. Message mout = new MessageImpl();
  4. mout.setContent(List.class, new MessageContentsList(r));
  5. mout.setExchange(inMessage.getExchange());
  6. mout = e.getBinding().createMessage(mout);
  7. mout.setInterceptorChain(
  8. OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
  9. inMessage.getExchange().setOutMessage(mout);
  10. if (r.getStatus() >= Response.Status.BAD_REQUEST.getStatusCode()) {
  11. inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
  12. }
  13. return mout;
  14. }
  15. }

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

  1. private Message createOutMessage(Message inMessage) {
  2. Endpoint e = inMessage.getExchange().getEndpoint();
  3. Message mout = e.getBinding().createMessage();
  4. mout.setExchange(inMessage.getExchange());
  5. mout.setInterceptorChain(
  6. OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
  7. inMessage.getExchange().setOutMessage(mout);
  8. inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
  9. return mout;
  10. }
  11. }

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

  1. private Message createOutMessage(Message inMessage) {
  2. Endpoint e = inMessage.getExchange().getEndpoint();
  3. Message mout = e.getBinding().createMessage();
  4. mout.setExchange(inMessage.getExchange());
  5. mout.setInterceptorChain(
  6. OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
  7. inMessage.getExchange().setOutMessage(mout);
  8. inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
  9. return mout;
  10. }
  11. }

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

  1. public void onMessage(Message m) {
  2. Message message = cfg.getConduitSelector().getEndpoint().getBinding().createMessage(m);
  3. message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
  4. message.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
  5. PhaseInterceptorChain chain = AbstractClient.setupInInterceptorChain(cfg);
  6. message.setInterceptorChain(chain);
  7. message.getExchange().setInMessage(message);
  8. Bus bus = cfg.getBus();
  9. Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus);
  10. ClassLoaderHolder origLoader = null;
  11. try {
  12. if (loader != null) {
  13. origLoader = ClassLoaderUtils.setThreadContextClassloader(loader);
  14. }
  15. // execute chain
  16. chain.doIntercept(message);
  17. } finally {
  18. if (origBus != bus) {
  19. BusFactory.setThreadDefaultBus(origBus);
  20. }
  21. if (origLoader != null) {
  22. origLoader.reset();
  23. }
  24. synchronized (message.getExchange()) {
  25. message.getExchange().notifyAll();
  26. }
  27. }
  28. }

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

  1. public void onMessage(Message m) {
  2. Message message = cfg.getConduitSelector().getEndpoint().getBinding().createMessage(m);
  3. message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
  4. message.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
  5. PhaseInterceptorChain chain = AbstractClient.setupInInterceptorChain(cfg);
  6. message.setInterceptorChain(chain);
  7. message.getExchange().setInMessage(message);
  8. Bus bus = cfg.getBus();
  9. Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus);
  10. ClassLoaderHolder origLoader = null;
  11. try {
  12. if (loader != null) {
  13. origLoader = ClassLoaderUtils.setThreadContextClassloader(loader);
  14. }
  15. // execute chain
  16. chain.doIntercept(message);
  17. } finally {
  18. if (origBus != bus) {
  19. BusFactory.setThreadDefaultBus(origBus);
  20. }
  21. if (origLoader != null) {
  22. origLoader.reset();
  23. }
  24. synchronized (message.getExchange()) {
  25. message.getExchange().notifyAll();
  26. }
  27. }
  28. }

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

  1. protected void invokeInboundChain(Exchange ex, Endpoint ep) {
  2. Message m = getInBoundMessage(ex);
  3. Message inMsg = ep.getBinding().createMessage();
  4. MessageImpl.copyContent(m, inMsg);
  5. //Copy Response Context to Client inBound Message
  6. //TODO a Context Filter Strategy required.
  7. inMsg.putAll(m);
  8. inMsg.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
  9. inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
  10. inMsg.setExchange(ex);
  11. Exception exc = inMsg.getContent(Exception.class);
  12. if (exc != null) {
  13. ex.setInFaultMessage(inMsg);
  14. ColocInFaultObserver observer = new ColocInFaultObserver(bus);
  15. observer.onMessage(inMsg);
  16. } else {
  17. //Handle Response
  18. ex.setInMessage(inMsg);
  19. PhaseManager pm = bus.getExtension(PhaseManager.class);
  20. SortedSet<Phase> phases = new TreeSet<>(pm.getInPhases());
  21. ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.PRE_INVOKE);
  22. InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases);
  23. inMsg.setInterceptorChain(chain);
  24. chain.doIntercept(inMsg);
  25. }
  26. ex.put(ClientImpl.FINISHED, Boolean.TRUE);
  27. }

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

  1. private void handleAbort(Message message, W3CDOMStreamWriter writer) {
  2. message.getInterceptorChain().abort();
  3. if (!message.getExchange().isOneWay()) {
  4. //server side inbound
  5. Endpoint e = message.getExchange().getEndpoint();
  6. Message responseMsg = new MessageImpl();
  7. responseMsg.setExchange(message.getExchange());
  8. responseMsg = e.getBinding().createMessage(responseMsg);
  9. message.getExchange().setOutMessage(responseMsg);
  10. XMLStreamReader reader = message.getContent(XMLStreamReader.class);
  11. if (reader == null && writer != null) {
  12. reader = StaxUtils.createXMLStreamReader(writer.getDocument());
  13. }
  14. InterceptorChain chain = OutgoingChainInterceptor
  15. .getOutInterceptorChain(message.getExchange());
  16. responseMsg.setInterceptorChain(chain);
  17. responseMsg.put("LogicalHandlerInterceptor.INREADER", reader);
  18. chain.doIntercept(responseMsg);
  19. }
  20. }

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

  1. public void handleMessage(Message message) {
  2. Exchange ex = message.getExchange();
  3. BindingOperationInfo binding = ex.get(BindingOperationInfo.class);
  4. //if we get this far, we're going to be outputting some valid content, but we COULD
  5. //also be "echoing" some of the content from the input. Thus, we need to
  6. //mark it as requiring the input to be cached.
  7. if (message.getExchange().get(CACHE_INPUT_PROPERTY) == null) {
  8. message.put(CACHE_INPUT_PROPERTY, Boolean.TRUE);
  9. }
  10. if (null != binding && null != binding.getOperationInfo() && binding.getOperationInfo().isOneWay()) {
  11. closeInput(message);
  12. return;
  13. }
  14. Message out = ex.getOutMessage();
  15. if (out != null) {
  16. getBackChannelConduit(message);
  17. if (binding != null) {
  18. out.put(MessageInfo.class, binding.getOperationInfo().getOutput());
  19. out.put(BindingMessageInfo.class, binding.getOutput());
  20. }
  21. InterceptorChain outChain = out.getInterceptorChain();
  22. if (outChain == null) {
  23. outChain = OutgoingChainInterceptor.getChain(ex, chainCache);
  24. out.setInterceptorChain(outChain);
  25. }
  26. outChain.doIntercept(out);
  27. }
  28. }

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

  1. public void handleMessage(Message message) {
  2. Exchange ex = message.getExchange();
  3. BindingOperationInfo binding = ex.get(BindingOperationInfo.class);
  4. //if we get this far, we're going to be outputting some valid content, but we COULD
  5. //also be "echoing" some of the content from the input. Thus, we need to
  6. //mark it as requiring the input to be cached.
  7. if (message.getExchange().get(CACHE_INPUT_PROPERTY) == null) {
  8. message.put(CACHE_INPUT_PROPERTY, Boolean.TRUE);
  9. }
  10. if (null != binding && null != binding.getOperationInfo() && binding.getOperationInfo().isOneWay()) {
  11. closeInput(message);
  12. return;
  13. }
  14. Message out = ex.getOutMessage();
  15. if (out != null) {
  16. getBackChannelConduit(message);
  17. if (binding != null) {
  18. out.put(MessageInfo.class, binding.getOperationInfo().getOutput());
  19. out.put(BindingMessageInfo.class, binding.getOutput());
  20. }
  21. InterceptorChain outChain = out.getInterceptorChain();
  22. if (outChain == null) {
  23. outChain = OutgoingChainInterceptor.getChain(ex, chainCache);
  24. out.setInterceptorChain(outChain);
  25. }
  26. outChain.doIntercept(out);
  27. }
  28. }

相关文章