Refine search
public void handleMessage(Message message) throws Fault { W3CDOMStreamWriter domWriter = (W3CDOMStreamWriter)message.getContent(XMLStreamWriter.class); XMLStreamWriter origWriter = (XMLStreamWriter)message .get(LogicalHandlerOutInterceptor.ORIGINAL_WRITER); XMLStreamReader reader = (XMLStreamReader)message.get("LogicalHandlerInterceptor.INREADER"); SOAPMessage origMessage = null; if (reader != null) { if (requestor) { message.getInterceptorChain().abort(); if (!message.getExchange().isOneWay()) { Endpoint e = message.getExchange().getEndpoint(); Message responseMsg = new MessageImpl(); responseMsg.setExchange(message.getExchange()); responseMsg = e.getBinding().createMessage(responseMsg); MessageObserver observer = message.getExchange() .get(MessageObserver.class); if (observer != null) { responseMsg.put(InterceptorChain.STARTING_AT_INTERCEPTOR_ID, LogicalHandlerInInterceptor.class.getName()); observer.onMessage(responseMsg);
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); in.cacheInput(); inMessage.getInterceptorChain().reset(); if (inMessage.get(Message.PATH_INFO) != null) { inMessage.remove(Message.PATH_INFO); inMessage.getInterceptorChain().doIntercept(inMessage); exchange.put(Executor.class, getExecutor(inMessage)); inMessage.getExchange().setOneWay(false); faultObserver.onMessage(inMessage); return;
if (!filters.isEmpty()) { final Exchange exchange = outMessage.getExchange(); final ClientRequestContext context = new ClientRequestContextImpl(outMessage, false); for (ProviderInfo<ClientRequestFilter> filter : filters) { filter.getProvider().filter(context); Response response = outMessage.getExchange().get(Response.class); if (response != null) { outMessage.getInterceptorChain().abort(); Message inMessage = new MessageImpl(); inMessage.setExchange(exchange); inMessage.put(Message.RESPONSE_CODE, response.getStatus()); inMessage.put(Message.PROTOCOL_HEADERS, response.getMetadata()); exchange.setInMessage(inMessage); MessageObserver observer = exchange.get(MessageObserver.class); observer.onMessage(inMessage); return;
inMessage.setExchange(new ExchangeImpl()); inMessage.getExchange().put(Bus.class, bus); inMessage.put(Message.DECOUPLED_CHANNEL_MESSAGE, Boolean.TRUE); inMessage.setContent(InputStream.class, cos.getInputStream()); incomingObserver.onMessage(inMessage); } catch (IOException e) { logStackTrace(e);
@Override public void close(Message message) throws IOException { // set the pseudo status code if not set (REVISIT add this method in MessageUtils to be reused elsewhere?) Integer i = (Integer)message.get(Message.RESPONSE_CODE); if (i == null) { int code = ((message.getExchange().isOneWay() && !MessageUtils.isPartialResponse(message)) || MessageUtils.isEmptyPartialResponse(message)) ? 202 : 200; message.put(Message.RESPONSE_CODE, code); } if (Boolean.TRUE.equals(message.getExchange().get(LocalConduit.DIRECT_DISPATCH))) { final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE); MessageImpl copy = new MessageImpl(); copy.putAll(message); message.getContent(OutputStream.class).close(); CachedOutputStream stream = message.getContent(CachedOutputStream.class); message.setContent(OutputStream.class, stream); MessageImpl.copyContent(message, copy); copy.setContent(InputStream.class, stream.getInputStream()); stream.releaseTempFileHold(); if (exchange != null && exchange.getInMessage() == null) { exchange.setInMessage(copy); } conduit.getMessageObserver().onMessage(copy); return; } super.close(message); }
protected void handleResponseInternal() throws IOException { Exchange exchange = outMessage.getExchange(); int responseCode = doProcessResponseCode(); Message inMessage = new MessageImpl(); inMessage.setExchange(exchange); updateResponseHeaders(inMessage); inMessage.put(Message.RESPONSE_CODE, responseCode); if (MessageUtils.getContextualBoolean(outMessage, SET_HTTP_RESPONSE_MESSAGE, false)) { inMessage.put(HTTP_RESPONSE_MESSAGE, getResponseMessage()); Endpoint ep = exchange.getEndpoint(); if (null != ep && null != ep.getEndpointInfo() && null == ep.getEndpointInfo(). getProperty("org.apache.cxf.ws.addressing.MAPAggregator.decoupledDestination")) { ClientCallback cc = exchange.remove(ClientCallback.class); if (null != cc) { cc.handleResponse(null, null); exchange.put("IN_CHAIN_COMPLETE", Boolean.TRUE); exchange.setInMessage(inMessage); return; incomingObserver.onMessage(inMessage);
CURRENT_MESSAGE.set(message); if (oldMessage != null && !message.containsKey(PREVIOUS_MESSAGE) && message != oldMessage && message.getExchange() != oldMessage.getExchange()) { message.put(PREVIOUS_MESSAGE, new WeakReference<Message>(oldMessage)); if (message.getExchange() != null) { Exchange exchange = message.getExchange(); Service service = exchange.get(Service.class); if (service != null) { description.append('\''); description.append(service.getName()); OperationInfo opInfo = exchange.get(OperationInfo.class); if (opInfo != null) { description.append("#").append(opInfo.getName()); if (message.getExchange() != null) { if (message.getContent(Exception.class) != null) { message.getExchange().put(Exception.class, ex2); isOneWay = message.getExchange().isOneWay() message.getExchange().setOneWay(false); faultObserver.onMessage(message);
return; XMLStreamReader xsr = message.getContent(XMLStreamReader.class); Endpoint ep = message.getExchange().get(Endpoint.class); BindingInfo binding = ep.getEndpointInfo().getBinding(); if (!(binding instanceof NMRBindingInfo)) { throw new IllegalStateException( Exchange ex = message.getExchange(); QName startQName = reader.getName(); message.getInterceptorChain().abort(); if (ep.getInFaultObserver() != null) { ep.getInFaultObserver().onMessage(message); return; BindingOperationInfo bop = ex.get(BindingOperationInfo.class); DataReader<XMLStreamReader> dr = getDataReader(message); List<Object> parameters = new ArrayList<Object>();
private void dataReceived(Message message, IoBuffer buf, boolean async, boolean multi) { synchronized (message.getExchange()) { if (message.getExchange().getInMessage() == null) { final Message inMessage = new MessageImpl(); IoSessionInputStream ins = new IoSessionInputStream(buf); inMessage.setContent(InputStream.class, ins); inMessage.put(IoSessionInputStream.class, ins); message.getExchange().setInMessage(inMessage); inMessage.setExchange(message.getExchange()); queue = queuem.getAutomaticWorkQueue(); queue.execute(() -> incomingObserver.onMessage(inMessage)); } else { incomingObserver.onMessage(inMessage); if (!message.getExchange().isSynchronous() || multi) { message.getExchange().setInMessage(null); message.getExchange().setInFaultMessage(null);
protected void handleResponseInternal() throws IOException { Exchange exchange = outMessage.getExchange(); int responseCode = doProcessResponseCode(); Message inMessage = new MessageImpl(); inMessage.setExchange(exchange); updateResponseHeaders(inMessage); inMessage.put(Message.RESPONSE_CODE, responseCode); propagateConduit(exchange, inMessage); throw new HTTPException(responseCode, getResponseMessage(), url.toURL()); ClientCallback cc = exchange.get(ClientCallback.class); if (null != cc) { Endpoint ep = exchange.getEndpoint(); if (null != ep && null != ep.getEndpointInfo() && null == ep.getEndpointInfo(). getProperty("org.apache.cxf.ws.addressing.MAPAggregator.decoupledDestination")) { cc.handleResponse(null, null); exchange.setInMessage(inMessage); return; incomingObserver.onMessage(inMessage);
if (inMessage.getExchange().get(Message.RESPONSE_CODE) == null) { throw t; Endpoint ep = inMessage.getExchange().getEndpoint(); inMessage.getExchange().put(InterceptorProvider.class, getConfiguration()); inMessage.setContent(Exception.class, new Fault(t)); inMessage.getInterceptorChain().abort(); if (ep.getInFaultObserver() != null) { ep.getInFaultObserver().onMessage(inMessage);
private void commitOutputMessage() throws IOException { try { Member member = (Member) message.get(Method.class.getName()); Class<?> clz = member.getDeclaringClass(); Exchange exchange = message.getExchange(); BindingOperationInfo bop = exchange.get(BindingOperationInfo.class); if (target != null) { serviceName = EndpointReferenceUtils.getServiceName(target, message.getExchange().get(Bus.class)); } else { serviceName = message.getExchange().get(org.apache.cxf.service.Service.class).getName(); normalizedMessageProps = ((InOut)xchng).getFault().getPropertyNames(); Message inMessage = new MessageImpl(); message.getExchange().setInMessage(inMessage); InputStream ins = JBIMessageHelper.convertMessageToInputStream(content); conduit.getMessageObserver().onMessage(inMessage);
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, SOAPHandlerInterceptor.class.getName()); observer.onMessage(responseMsg); if (!getInvoker(message).isOutbound()) { chain.doInterceptStartingAfter(responseMsg, SoapPreProtocolOutInterceptor.class.getName());
public void run() { try { handleResponseInternal(); } catch (Throwable e) { ((PhaseInterceptorChain)outMessage.getInterceptorChain()).abort(); outMessage.setContent(Exception.class, e); ((PhaseInterceptorChain)outMessage.getInterceptorChain()).unwind(outMessage); MessageObserver mo = outMessage.getInterceptorChain().getFaultObserver(); if (mo == null) { mo = outMessage.getExchange().get(MessageObserver.class); } mo.onMessage(outMessage); } } };
private void sendOutputMessage() throws IOException { try { Member member = (Member) message.get(Method.class.getName()); Class<?> clz = member.getDeclaringClass(); Exchange exchange = message.getExchange(); final BindingOperationInfo bop = exchange.get(BindingOperationInfo.class); QName serviceName = null; if (target != null) { serviceName = EndpointReferenceUtils.getServiceName(target, message.getExchange() .get(Bus.class)); } else { serviceName = message.getExchange().get(org.apache.cxf.service.Service.class) .getName(); Message inMessage = new MessageImpl(); inMessage.setExchange(exchange); conduit.getMessageObserver().onMessage(inMessage);
public void run() { ExchangeImpl ex = new ExchangeImpl(); ex.put(Bus.class, destination.getBus()); ex.setInMessage(inMsg); inMsg.setExchange(ex); ex.put(IN_EXCHANGE, exchange); try { destination.getMessageObserver().onMessage(inMsg); } catch (Throwable t) { Message m = inMsg.getExchange().getOutFaultMessage(); if (m == null) { m = inMsg.getExchange().getOutMessage(); } if (m != null) { try { m.put(Message.RESPONSE_CODE, 500); m.put(Message.PROTOCOL_HEADERS, new HashMap<String, List<String>>()); m.getExchange().put(Message.RESPONSE_CODE, 500); m.getContent(OutputStream.class).close(); } catch (IOException e) { //ignore } } } } };
return; Endpoint ep = message.getExchange().get(Endpoint.class); XMLStreamReader xsr = message.getContent(XMLStreamReader.class); if (xsr == null) { return; Exchange ex = message.getExchange(); QName startQName = reader.getName(); message.getInterceptorChain().abort(); if (ep.getInFaultObserver() != null) { ep.getInFaultObserver().onMessage(message); return; BindingOperationInfo boi = ex.get(BindingOperationInfo.class); boolean isRequestor = isRequestor(message); if (boi == null) { BindingInfo service = ep.getEndpointInfo().getBinding(); boi = getBindingOperationInfo(isRequestor, startQName, service, xsr); if (boi != null) { ex.put(BindingOperationInfo.class, boi); ex.put(OperationInfo.class, boi.getOperationInfo()); ex.setOneWay(boi.getOperationInfo().isOneWay());
return; Endpoint ep = message.getExchange().getEndpoint(); XMLStreamReader xsr = message.getContent(XMLStreamReader.class); if (xsr == null) { return; Exchange ex = message.getExchange(); QName startQName = reader.getName(); message.getInterceptorChain().abort(); if (ep.getInFaultObserver() != null) { ep.getInFaultObserver().onMessage(message); return; BindingOperationInfo boi = ex.getBindingOperationInfo(); boolean isRequestor = isRequestor(message); if (boi == null) { BindingInfo service = ep.getEndpointInfo().getBinding(); boi = getBindingOperationInfo(isRequestor, startQName, service, xsr); if (boi != null) { ex.put(BindingOperationInfo.class, boi); ex.setOneWay(boi.getOperationInfo().isOneWay());
private void handleRequestResponse(Exchange exchange, Object encoding, DispatchingResponse response) { Message inMessage = new MessageImpl(); inMessage.put(ENCODING, encoding); inMessage.put(CONTENT_TYPE, response.getContentType()); inMessage.setContent(InputStream.class, response.getContent()); exchange.put(MULE_TRANSPORT_HEADERS_KEY, response.getHeaders()); inMessage.setExchange(exchange); messageObserver.onMessage(inMessage); }
private void dispatchDirect(Message message) throws IOException { if (destination.getMessageObserver() == null) { throw new IllegalStateException("Local destination does not have a MessageObserver on address " + destination.getAddress().getAddress().getValue()); } MessageImpl copy = new MessageImpl(); copy.put(IN_CONDUIT, this); copy.setDestination(destination); transportFactory.copy(message, copy); MessageImpl.copyContent(message, copy); OutputStream out = message.getContent(OutputStream.class); out.flush(); out.close(); CachedOutputStream stream = message.get(CachedOutputStream.class); copy.setContent(InputStream.class, stream.getInputStream()); copy.removeContent(CachedOutputStream.class); stream.releaseTempFileHold(); // Create a new incoming exchange and store the original exchange for the response ExchangeImpl ex = new ExchangeImpl(); ex.setInMessage(copy); ex.put(IN_EXCHANGE, message.getExchange()); ex.put(LocalConduit.DIRECT_DISPATCH, true); ex.setDestination(destination); destination.getMessageObserver().onMessage(copy); }