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) { 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) {
public final void setVersion(SoapVersion v) { super.put(SoapVersion.class, v); this.version = v; }
LOG.fine("Service http request on thread: " + Thread.currentThread()); Message inMessage = new MessageImpl(); ExchangeImpl exchange = new ExchangeImpl(); exchange.setInMessage(inMessage); ((MessageImpl)inMessage).setDestination(this); exchange.setSession(new HTTPSession(req));
@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); }
public void handleMessage(Message message) throws Fault { W3CDOMStreamWriter domWriter = (W3CDOMStreamWriter)message.getContent(XMLStreamWriter.class); XMLStreamWriter origWriter = (XMLStreamWriter)message .get(LogicalHandlerFaultOutInterceptor.ORIGINAL_WRITER); boolean requestor = isRequestor(message); XMLStreamReader reader = (XMLStreamReader)message.get("LogicalHandlerInterceptor.INREADER"); SOAPMessage origMessage = null; if (reader != null) { FaultMode mode = message.get(FaultMode.class); Message faultMessage = exchange.getOutMessage(); if (null == faultMessage) { faultMessage = new MessageImpl(); faultMessage.setExchange(message.getExchange()); faultMessage = exchange.getEndpoint().getBinding().createMessage(faultMessage); faultMessage.setContent(Exception.class, ex); faultMessage.put(FaultMode.class, mode); exchange.setOutMessage(null); exchange.setOutFaultMessage(faultMessage);
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); } }
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;
public void handleMessage(Message message) throws Fault { BindingOperationInfo bop = message.getExchange().getBindingOperationInfo(); if (bop != null && !bindingName.equals(bop.getBinding().getName())) { return; } else if (DataSource.class.isAssignableFrom(type)) { MessageContentsList list = (MessageContentsList)message.getContent(List.class); DataSource ds = (DataSource)list.get(0); String ct = ds.getContentType(); if (ct.toLowerCase().contains("multipart/related")) { Message msg = new MessageImpl(); msg.setExchange(message.getExchange()); msg.put(Message.CONTENT_TYPE, ct); try {
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 } } } } };
private MultipartBody createAttachments(String propertyName) { Message inMessage = m.getExchange().getInMessage(); boolean embeddedAttachment = inMessage.get("org.apache.cxf.multipart.embedded") != null; Object o = inMessage.get(propertyName); if (o != null) { return (MultipartBody)o; inMessage = new MessageImpl(); inMessage.setExchange(new ExchangeImpl()); inMessage.put(AttachmentDeserializer.ATTACHMENT_DIRECTORY, m.getExchange().getInMessage().get(AttachmentDeserializer.ATTACHMENT_DIRECTORY)); inMessage.put(AttachmentDeserializer.ATTACHMENT_MEMORY_THRESHOLD, m.getExchange().getInMessage().get(AttachmentDeserializer.ATTACHMENT_MEMORY_THRESHOLD)); inMessage.put(AttachmentDeserializer.ATTACHMENT_MAX_SIZE, m.getExchange().getInMessage().get(AttachmentDeserializer.ATTACHMENT_MAX_SIZE));
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); }
private void updateClientPolicy() { if (!clientSidePolicyCalced) { //do no spend time on building Message and Exchange (which basically //are ConcurrentHashMap instances) if the policy is already available Message m = new MessageImpl(); m.setExchange(new ExchangeImpl()); m.getExchange().put(EndpointInfo.class, this.endpointInfo); updateClientPolicy(m); } }
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, Endpoint e = message.getExchange().getEndpoint(); if (!message.getExchange().isOneWay()) { Message responseMsg = new MessageImpl(); responseMsg.setExchange(message.getExchange()); responseMsg = e.getBinding().createMessage(responseMsg); message.getExchange().setOutMessage(responseMsg); SOAPMessage soapMessage = ((SOAPMessageContext)context).getMessage();
conduit.setMessageObserver(obs); Message m = new MessageImpl(); String ct = "multipart/related; type=\"application/xop+xml\"; " + "start=\"<soap.xml@xfire.codehaus.org>\"; " + "boundary=\"----=_Part_4_701508.1145579811786\""; m.put(Message.CONTENT_TYPE, ct); conduit.prepare(m); OutputStream os = m.getContent(OutputStream.class); InputStream is = testUtilities.getResourceAsStream("request"); if (is == null) { MessageImpl resMsg = new MessageImpl(); resMsg.setContent(InputStream.class, new ByteArrayInputStream(res)); resMsg.put(Message.CONTENT_TYPE, obs.getResponseContentType()); resMsg.setExchange(new ExchangeImpl()); AttachmentDeserializer deserializer = new AttachmentDeserializer(resMsg); deserializer.initializeAttachments(); Collection<Attachment> attachments = resMsg.getAttachments(); assertNotNull(attachments); assertEquals(1, attachments.size());
Message m = null; if (pf.isParamConverterContextsAvailable()) { m = new MessageImpl(); m.put(Message.REQUESTOR_ROLE, Boolean.TRUE); m.setExchange(new ExchangeImpl()); m.getExchange().setOutMessage(m); m.getExchange().put(Endpoint.class, cfg.getEndpoint());
private Message createResponseMessage() { if (exchange == null || exchange.isOneWay()) { return null; m = exchange.getInFaultMessage(); if (m == null) { m = exchange.getInMessage(); Endpoint ep = exchange.getEndpoint(); m = new org.apache.cxf.message.MessageImpl(); m.setExchange(exchange); m = ep.getBinding().createMessage(m); exchange.setInMessage(m); Endpoint ep = exchange.getEndpoint(); m = new org.apache.cxf.message.MessageImpl(); m.setExchange(exchange); m = ep.getBinding().createMessage(m); exchange.setOutMessage(m);
private Message getOutMessage() { Message message = m.getExchange().getOutMessage(); if (message == null) { Endpoint ep = m.getExchange().getEndpoint(); message = new org.apache.cxf.message.MessageImpl(); message.setExchange(m.getExchange()); message = ep.getBinding().createMessage(message); m.getExchange().setOutMessage(message); } return message; }
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; } }
MessageImpl inMessage = new MessageImpl(); try { JMSUtils.populateIncomingContext(message, inMessage, JMSConstants.JMS_SERVER_REQUEST_HEADERS, jmsConfig); JMSUtils.retrieveAndSetPayload(inMessage, message, (String) inMessage.get(org.apache.cxf.message.Message.ENCODING)); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Cannot get payload of the given JMS message", e); inMessage.put("JMSReplyTo", jmsReplyTo); inMessage.put("CorrelationID", correlationID); inMessage.put(JMSConstants.JMS_SERVER_RESPONSE_HEADERS, new JMSMessageHeadersType()); inMessage.put(JMSConstants.JMS_REQUEST_MESSAGE, message); inMessage.setDestination(destination); } finally { BusFactory.setThreadDefaultBus(null); Exchange exchange = inMessage.getExchange(); if (ReliableJMSTransportModeType.CLIENT_RECEIVER == inMessage.get(ReliableJMSTransportModeType.class)) { org.apache.cxf.message.Message receivedExceptionMessage = exchange.getInFaultMessage(); if (receivedExceptionMessage != null) { ReliableJMSTransportConfiguration reliableJMSTransportConfiguration = exchange.get(ReliableJMSTransportConfiguration.class); if (reliableJMSTransportConfiguration == null) { throw new IllegalStateException("Unable to get the MDB receiver configuration for operation '" + inMessage.getExchange() + "'."); if (ReliableJMSTransportModeType.SERVER_ENDPOINT == inMessage.get(ReliableJMSTransportModeType.class)) {
private static Message createMessage(Exchange exchange) { Endpoint ep = exchange.get(Endpoint.class); Message msg = null; if (ep != null) { msg = new MessageImpl(); msg.setExchange(exchange); msg = ep.getBinding().createMessage(msg); } return msg; }