Refine search
public static String getEndpointAddress(Message m) { String address = null; Destination d = m.getExchange().getDestination(); if (d != null) { if (d instanceof AbstractHTTPDestination) { EndpointInfo ei = ((AbstractHTTPDestination)d).getEndpointInfo(); HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST); Object property = request != null ? request.getAttribute("org.apache.cxf.transport.endpoint.address") : null; address = property != null ? property.toString() : ei.getAddress(); } else { address = m.containsKey(Message.BASE_PATH) ? (String)m.get(Message.BASE_PATH) : d.getAddress().getAddress().getValue(); } } else { address = (String)m.get(Message.ENDPOINT_ADDRESS); } if (address.startsWith("http") && address.endsWith("//")) { address = address.substring(0, address.length() - 1); } return address; }
public static Endpoint getEndpoint(DestinationFactory df, String uri) throws IOException, EndpointNotFoundException { int idx = uri.indexOf('?'); if (idx != -1) { uri = uri.substring(0, idx); } EndpointInfo ei = new EndpointInfo(); ei.setAddress(uri); Destination d = df.getDestination(ei); if (d.getMessageObserver() == null) { // TODO is this the right Mule exception? throw new EndpointNotFoundException(uri); } MessageObserver mo = d.getMessageObserver(); if (!(mo instanceof ChainInitiationObserver)) { throw new EndpointNotFoundException(uri); } ChainInitiationObserver co = (ChainInitiationObserver) mo; return co.getEndpoint(); } }
public void handleMessage(Message message) throws Fault { String method = (String)message.get(Message.HTTP_REQUEST_METHOD); String query = (String)message.get(Message.QUERY_STRING); if (!"GET".equals(method) || StringUtils.isEmpty(query)) { return; } String baseUri = (String)message.get(Message.REQUEST_URL); URI uri = null; try { uri = URI.create(baseUri); } catch (IllegalArgumentException iae) { //invalid URI, ignore and continue return; } Map<String, String> map = UrlUtils.parseQueryString(query); if (isRecognizedQuery(map, uri, message.getExchange().getEndpoint().getEndpointInfo())) { try { Conduit c = message.getExchange().getDestination().getBackChannel(message); Message mout = new MessageImpl(); mout.setExchange(message.getExchange()); message.getExchange().setOutMessage(mout); mout.put(Message.CONTENT_TYPE, "application/javascript;charset=UTF-8"); c.prepare(mout); OutputStream os = mout.getContent(OutputStream.class); writeResponse(uri, map, os, message.getExchange().getEndpoint()); } catch (IOException ioe) { throw new Fault(ioe); } } }
public void clientDestroyed(Client client) { Destination dest = client.getEndpoint().getEndpointInfo() .getProperty(DECOUPLED_DESTINATION, Destination.class); if (dest != null) { dest.setMessageObserver(null); dest.shutdown(); } }
public void stop() { if (stopped) { return; } LOG.fine("Server is stopping."); if (slcMgr != null) { slcMgr.stopServer(this); } MessageObserver mo = getDestination().getMessageObserver(); if (mo instanceof MultipleEndpointObserver) { ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint); if (((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) { getDestination().setMessageObserver(null); } } else { getDestination().setMessageObserver(null); } stopped = true; }
public void handleMessage(Message message) throws Fault { if (message.getExchange().isOneWay() && !isRequestor(message) && message.get(OneWayProcessorInterceptor.class) == null && message.getExchange().get(Executor.class) == null) { partial.remove(Message.CONTENT_TYPE); partial.setExchange(message.getExchange()); Conduit conduit = message.getExchange().getDestination() .getBackChannel(message, null, null); if (conduit != null) { message.getExchange().setInMessage(null);
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; reference = ContextUtils.getNoneEndpointReference(); Conduit backChannel = target.getBackChannel(inMessage); 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);
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; reference = ContextUtils.getNoneEndpointReference(); Conduit backChannel = target.getBackChannel(inMessage); if (backChannel != null) { 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();
LOG.fine("Listening on the destination '" + queueName + "' using address '" + destination.getAddress() + "'."); destination.getMessageObserver().onMessage(inMessage); } finally { BusFactory.setThreadDefaultBus(null); 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 '" Exception exception = receivedExceptionMessage.getContent(Exception.class); SoapFault fault = null; BindingOperationInfo matchingBindingOperationInfo = null; BindingInfo bindingInfo = ((ReliableJMSTransportDestination) destination).getEndpointInfo().getBinding(); for (BindingOperationInfo b : bindingInfo.getOperations()) { exchange.put(BindingOperationInfo.class, matchingBindingOperationInfo); exception = receivedExceptionMessage.getContent(Exception.class); FaultMode faultMode = (FaultMode) inMessage.getExchange().getOutFaultMessage().get(org.apache.cxf.message.FaultMode.class); if (faultMode == FaultMode.CHECKED_APPLICATION_FAULT) { LOG.fine("There is a checked exception that has been sent to the client");
protected static Conduit getBackChannelConduit(Message message) { Conduit conduit = null; Exchange ex = message.getExchange(); if (ex.getConduit(message) == null && ex.getDestination() != null) { try { conduit = ex.getDestination().getBackChannel(ex.getInMessage(), null, null); ex.put(ConduitSelector.class, new PreexistingConduitSelector(conduit, ex.get(Endpoint.class))); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return conduit; }
protected static Conduit getBackChannelConduit(Message message) throws IOException { Conduit conduit = null; Exchange ex = message.getExchange(); if (ex.getConduit(message) == null && ex.getDestination() != null) { try { conduit = ex.getDestination().getBackChannel(ex.getInMessage()); ex.put(ConduitSelector.class, new PreexistingConduitSelector(conduit, ex.getEndpoint())); } catch (IOException e) { throw new Fault(e); } } return conduit; }
acksTo = maps.getReplyTo(); if (RMUtils.getAddressingConstants().getNoneURI().equals(acksTo.getAddress().getValue())) { Endpoint ei = message.getExchange().getEndpoint(); org.apache.cxf.transport.Destination dest = ei == null ? null : ei.getEndpointInfo() .getProperty(MAPAggregator.DECOUPLED_DESTINATION, org.apache.cxf.transport.Destination.class); if (null == dest) { acksTo = RMUtils.createAnonymousReference(); } else { acksTo = dest.getAddress(); Exchange exchange = new ExchangeImpl(); Map<String, Object> context = new HashMap<>(16); for (String key : message.getContextualPropertyKeys()) { context.put(key, message.getContextualProperty(key)); Exchange appex = message.getExchange(); if (appex.get(SecurityConstants.TOKEN) == null) { appex.put(SecurityConstants.TOKEN, exchange.get(SecurityConstants.TOKEN)); appex.put(SecurityConstants.TOKEN_ID, exchange.get(SecurityConstants.TOKEN_ID));
/** * @param address the address * @return a Destination for the address */ private Destination getDestination(Bus bus, String address, Message message) throws IOException { Destination destination = null; DestinationFactoryManager factoryManager = bus.getExtension(DestinationFactoryManager.class); DestinationFactory factory = factoryManager.getDestinationFactoryForUri(address); if (factory != null) { Endpoint ep = message.getExchange().getEndpoint(); EndpointInfo ei = new EndpointInfo(); ei.setName(new QName(ep.getEndpointInfo().getName().getNamespaceURI(), ep.getEndpointInfo().getName().getLocalPart() + ".decoupled")); ei.setAddress(address); destination = factory.getDestination(ei, bus); Conduit conduit = ContextUtils.getConduit(null, message); if (conduit != null) { MessageObserver ob = conduit.getMessageObserver(); ob = new InterposedMessageObserver(bus, ob); destination.setMessageObserver(ob); } } return destination; } protected static class InterposedMessageObserver implements MessageObserver {
if (PropertyUtils.isTrue(message.get(RMMessageConstants.DELIVERING_ROBUST_ONEWAY))) { return; message.getInterceptorChain().abort(); if (seq.sendAcknowledgement()) { ackImmediately(seq, message); Exchange exchange = message.getExchange(); Conduit conduit = exchange.getDestination().getBackChannel(message); if (conduit != null) {
private EndpointReferenceType getReplyTo(Message message, EndpointReferenceType originalReplyTo) { Exchange exchange = message.getExchange(); Endpoint info = exchange.getEndpoint(); if (info == null) { return originalReplyTo; Destination dest = ei.getProperty(DECOUPLED_DESTINATION, Destination.class); if (dest == null) { dest = createDecoupledDestination(message); if (dest != null) { info.getEndpointInfo().setProperty(DECOUPLED_DESTINATION, dest); final String replyTo = dest.getAddress().getAddress().getValue(); if (replyTo.startsWith("/")) { String debase = (String)message.getContextualProperty(WSAContextUtils.DECOUPLED_ENDPOINT_BASE_PROPERTY); if (debase != null) { return EndpointReferenceUtils.getEndpointReference(debase + replyTo); return dest.getAddress();
LOG.fine("Listening on the destination '" + queueName + "' using address '" + destination.getAddress() + "'."); destination.getMessageObserver().onMessage(inMessage); } finally { BusFactory.setThreadDefaultBus(null); org.apache.cxf.message.Message receivedExceptionMessage = exchange.getInFaultMessage(); if (receivedExceptionMessage != null) { MDBTransportConfiguration mdbTransportConfiguration = exchange.get(MDBTransportConfiguration.class); if (mdbTransportConfiguration == null) { throw new IllegalStateException("Unable to get the MDB receiver configuration for operation '" Exception exception = receivedExceptionMessage.getContent(Exception.class); SoapFault fault = null; BindingOperationInfo matchingBindingOperationInfo = null; BindingInfo bindingInfo = ((MDBTransportDestination) destination).getEndpointInfo().getBinding(); for (BindingOperationInfo b : bindingInfo.getOperations()) { exchange.put(BindingOperationInfo.class, matchingBindingOperationInfo); exception = receivedExceptionMessage.getContent(Exception.class);
) { Exchange ex = message.getExchange(); Bus bus = ex.getBus(); PolicyEngine pe = bus.getExtension(PolicyEngine.class); if (null == pe) { return; Destination destination = ex.getDestination(); try { Endpoint endpoint = message.getExchange().getEndpoint(); endpoint = STSUtils.createSCEndpoint(bus, namespace, endpoint.getEndpointInfo().getTransportId(), destination.getAddress().getAddress().getValue(), message.getVersion().getBindingId(), policy); endpoint = STSUtils.createSTSEndpoint(bus, namespace, endpoint.getEndpointInfo().getTransportId(), destination.getAddress().getAddress().getValue(), message.getVersion().getBindingId(), policy, null); endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store); message.getExchange().put(TokenStore.class.getName(), store);
DestinationFactory df = dfm.getDestinationFactoryForUri(serviceUri); EndpointInfo ei = new EndpointInfo(); ei.setAddress(serviceUri); d = df.getDestination(ei); if (eventRequestUri.startsWith(JMS_TRANSPORT) || SoapJMSConstants.SOAP_JMS_NAMESPACE.equals(((MuleUniversalDestination) d).getEndpointInfo().getTransportId())) exchange.put(StaxInEndingInterceptor.STAX_IN_NOCLOSE, Boolean.TRUE); exchange.setInMessage(m); exchange.put(CxfConstants.MULE_EVENT, event); d.getMessageObserver().onMessage(m);
private Conduit getConduit(Message inMessage) throws IOException { Exchange exchange = inMessage.getExchange(); Conduit conduit = exchange.getDestination().getBackChannel(inMessage); exchange.setConduit(conduit); return conduit; }
@Override public synchronized void addListener(Destination d, Endpoint e) { synchronized (d) { MessageObserver mo = d.getMessageObserver(); if (d.getAddress() != null && d.getAddress().getAddress() != null && d.getAddress().getAddress().getValue() != null && d.getAddress().getAddress().getValue().startsWith("soap.udp")) { .getSoapVersion().getVersion() + " endpoint already registered on address " + e.getEndpointInfo().getAddress()); d.setMessageObserver(mo);