message.getInterceptorChain().abort(); MessageObserver observer = message.getExchange().get(MessageObserver.class); if (!message.getExchange().isOneWay() && observer != null) { Endpoint e = message.getExchange().getEndpoint(); Message responseMsg = new MessageImpl(); responseMsg.setExchange(message.getExchange()); responseMsg = e.getBinding().createMessage(responseMsg); responseMsg.setContent(SOAPMessage.class, soapMessage); XMLStreamReader xmlReader = createXMLStreamReaderFromSOAPMessage(soapMessage); responseMsg.setContent(XMLStreamReader.class, xmlReader); responseMsg.put(InterceptorChain.STARTING_AT_INTERCEPTOR_ID, responseMsg.setContent(SOAPMessage.class, soapMessage); InterceptorChain chain = OutgoingChainInterceptor.getOutInterceptorChain(message .getExchange()); responseMsg.setInterceptorChain(chain);
public static Conduit getConduit(Message message) throws IOException { Exchange exchange = message.getExchange(); Conduit conduit = exchange.getConduit(message); if (conduit == null && (exchange.getOutMessage() != null || exchange.getOutFaultMessage() != null)) { conduit = OutgoingChainInterceptor.getBackChannelConduit(message); } return conduit; }
private static void modifyChain(PhaseInterceptorChain chain, Exchange ex) { modifyChain(chain, ex.getInMessage()); modifyChain(chain, ex.getOutMessage()); } private static void modifyChain(PhaseInterceptorChain chain, Message m) {
if (!ContextUtils.retrievePartialResponseSent(inMessage)) { ContextUtils.storePartialResponseSent(inMessage); Exchange exchange = inMessage.getExchange(); Message fullResponse = exchange.getOutMessage(); Message partialResponse = ContextUtils.createMessage(exchange); ensurePartialResponseMAPs(partialResponse, namespaceURI); Destination target = inMessage.getDestination(); if (target == null) { return; Exception exception = inMessage.getContent(Exception.class); if (backChannel != null && !inMessage.getExchange().isOneWay() && ContextUtils.isFault(inMessage)) { exchange.setOutMessage(ContextUtils.createMessage(exchange)); exchange.put(ConduitSelector.class, new NullConduitSelector()); exchange.put("org.apache.cxf.http.no_io_exceptions", true); fullResponse != null ? fullResponse.getInterceptorChain() : OutgoingChainInterceptor.getOutInterceptorChain(exchange); exchange.setOutMessage(partialResponse); partialResponse.setInterceptorChain(chain);
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); } }
public void handleMessage(Message message) throws Fault { String method = (String)message.get(Message.HTTP_REQUEST_METHOD); String query = (String)message.get(Message.QUERY_STRING); String baseUri = (String)message.get(Message.REQUEST_URL); String ctx = (String)message.get(Message.PATH_INFO); Document doc = getDocument(utils, message, baseUri, map, ctx); Endpoint e = message.getExchange().getEndpoint(); Message mout = new MessageImpl(); mout.setExchange(message.getExchange()); mout = e.getBinding().createMessage(mout); mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange())); message.getExchange().setOutMessage(mout); mout.put(DOCUMENT_HOLDER, doc); mout.getInterceptorChain().add(wsdlGetOutInterceptor); message.getExchange().put(TRANSFORM_SKIP, Boolean.TRUE); message.getInterceptorChain().doInterceptStartingAt(
public void handleMessage(Message message) throws Fault { String method = (String)message.get(Message.HTTP_REQUEST_METHOD); String query = (String)message.get(Message.QUERY_STRING); String baseUri = (String)message.get(Message.REQUEST_URL); String ctx = (String)message.get(Message.PATH_INFO); if (isRecognizedQuery(map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) { Document doc = getDocument(message, baseUri, map, ctx); Endpoint e = message.getExchange().get(Endpoint.class); Message mout = new MessageImpl(); mout.setExchange(message.getExchange()); mout = e.getBinding().createMessage(mout); mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange())); message.getExchange().setOutMessage(mout); mout.put(DOCUMENT_HOLDER, doc);
if (!ContextUtils.retrievePartialResponseSent(inMessage)) { ContextUtils.storePartialResponseSent(inMessage); Exchange exchange = inMessage.getExchange(); Message fullResponse = exchange.getOutMessage(); Message partialResponse = ContextUtils.createMessage(exchange); ensurePartialResponseMAPs(partialResponse, namespaceURI); Destination target = inMessage.getDestination(); if (target == null) { return; partialResponse.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE); partialResponse.put(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE); boolean robust = MessageUtils.getContextualBoolean(inMessage, Message.ROBUST_ONEWAY, false); BindingOperationInfo boi = exchange.getBindingOperationInfo(); exchange.put(Executor.class, getExecutor(inMessage)); inMessage.getInterceptorChain().pause(); fullResponse != null ? fullResponse.getInterceptorChain() : OutgoingChainInterceptor.getOutInterceptorChain(exchange); exchange.setOutMessage(partialResponse); partialResponse.setInterceptorChain(chain);
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); } }
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; } }
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; } }
@AroundInvoke public Object intercept(InvocationContext context) throws Exception { Endpoint endpoint = this.exchange.get(Endpoint.class); Service service = endpoint.getService(); Binding binding = ((JaxWsEndpointImpl) endpoint).getJaxwsBinding(); this.exchange.put(InvocationContext.class, context); Message inMessage = this.exchange.getInMessage(); PhaseInterceptorChain chain = new PhaseInterceptorChain(this.bus.getExtension(PhaseManager.class).getInPhases()); chain.add(new OutgoingChainInterceptor()); copyDataBindingInterceptors(chain, inMessage.getInterceptorChain()); InterceptorChain oldChain = inMessage.getInterceptorChain(); inMessage.setInterceptorChain(chain); try { chain.doIntercept(inMessage);
public static InterceptorChain getOutInterceptorChain(Exchange ex) { Bus bus = ex.get(Bus.class); Binding binding = ex.get(Binding.class); PhaseManager pm = bus.getExtension(PhaseManager.class); PhaseInterceptorChain chain = new PhaseInterceptorChain(pm.getOutPhases()); Endpoint ep = ex.get(Endpoint.class); List<Interceptor<? extends Message>> il = ep.getOutInterceptors(); if (LOG.isLoggable(Level.FINE)) { modifyChain(chain, ex); chain.setFaultObserver(ep.getOutFaultObserver()); return chain;
public static InterceptorChain getOutInterceptorChain(Exchange ex) { Bus bus = ex.getBus(); Binding binding = ex.getBinding(); PhaseManager pm = bus.getExtension(PhaseManager.class); PhaseInterceptorChain chain = new PhaseInterceptorChain(pm.getOutPhases()); Endpoint ep = ex.getEndpoint(); List<Interceptor<? extends Message>> il = ep.getOutInterceptors(); if (LOG.isLoggable(Level.FINE)) { modifyChain(chain, ex); chain.setFaultObserver(ep.getOutFaultObserver()); return chain;
protected void initializeDefaultInterceptors() { service.getInInterceptors().add(new ServiceInvokerInterceptor()); service.getInInterceptors().add(new OutgoingChainInterceptor()); service.getInInterceptors().add(new OneWayProcessorInterceptor()); }
if (!ContextUtils.retrievePartialResponseSent(inMessage)) { ContextUtils.storePartialResponseSent(inMessage); Exchange exchange = inMessage.getExchange(); Message fullResponse = exchange.getOutMessage(); Message partialResponse = ContextUtils.createMessage(exchange); ensurePartialResponseMAPs(partialResponse, namespaceURI); Destination target = inMessage.getDestination(); if (target == null) { return; Exception exception = inMessage.getContent(Exception.class); if (backChannel != null && !inMessage.getExchange().isOneWay() && ContextUtils.isFault(inMessage)) { exchange.setOutMessage(ContextUtils.createMessage(exchange)); exchange.put(ConduitSelector.class, new NullConduitSelector()); exchange.put("org.apache.cxf.http.no_io_exceptions", true); fullResponse != null ? fullResponse.getInterceptorChain() : OutgoingChainInterceptor.getOutInterceptorChain(exchange); exchange.setOutMessage(partialResponse); partialResponse.setInterceptorChain(chain);
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); } }
public void handleMessage(Message message) throws Fault { String method = (String)message.get(Message.HTTP_REQUEST_METHOD); String query = (String)message.get(Message.QUERY_STRING); String baseUri = (String)message.get(Message.REQUEST_URL); String ctx = (String)message.get(Message.PATH_INFO); Document doc = getDocument(utils, message, baseUri, map, ctx); Endpoint e = message.getExchange().getEndpoint(); Message mout = new MessageImpl(); mout.setExchange(message.getExchange()); mout = e.getBinding().createMessage(mout); mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange())); message.getExchange().setOutMessage(mout); mout.put(DOCUMENT_HOLDER, doc); mout.getInterceptorChain().add(wsdlGetOutInterceptor); message.getExchange().put(TRANSFORM_SKIP, Boolean.TRUE); message.getInterceptorChain().doInterceptStartingAt(
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); } }
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; } }