/** * Determine if message is currently being processed on server side. * * @param message the current Message * @return true if message is currently being processed on server side */ public static boolean isServerSide(Message message) { return message.getExchange().getDestination() != null; }
protected void setExchangeProperties(Exchange exchange, Message m) { exchange.put(Bus.class, bus); if (exchange.getDestination() == null) { exchange.setDestination(m.getDestination()); } }
protected void setExchangeProperties(Exchange exchange, Message m) { exchange.put(Bus.class, bus); if (exchange.getDestination() == null) { exchange.setDestination(m.getDestination()); } }
protected void setExchangeProperties(Exchange exchange, Message m) { exchange.put(Bus.class, bus); if (exchange.getDestination() == null) { exchange.setDestination(m.getDestination()); } }
protected void setExchangeProperties(Exchange exchange, Message m) { exchange.put(Bus.class, bus); if (exchange.getDestination() == null) { exchange.setDestination(m.getDestination()); } }
private Conduit getConduit(Message inMessage) throws IOException { Exchange exchange = inMessage.getExchange(); Conduit conduit = exchange.getDestination().getBackChannel(inMessage); exchange.setConduit(conduit); return conduit; }
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) { 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; }
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; }
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; }
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; }
protected void getTransportAssertions(Message message) { Exchange ex = message.getExchange(); Conduit conduit = ex.getConduit(message); Assertor assertor = PolicyUtils.createAsserter(conduit); if (assertor == null) { Destination destination = ex.getDestination(); assertor = PolicyUtils.createAsserter(destination); } if (null != assertor) { assertor.assertMessage(message); } }
protected void getTransportAssertions(Message message) { Exchange ex = message.getExchange(); Conduit conduit = ex.getConduit(message); Assertor assertor = PolicyUtils.createAsserter(conduit); if (assertor == null) { Destination destination = ex.getDestination(); assertor = PolicyUtils.createAsserter(destination); } if (null != assertor) { assertor.assertMessage(message); } }
/** * This method retrieves/creates the conduit for the response * message. */ private Conduit getConduit(Message message) throws IOException { Exchange exchange = message.getExchange(); Conduit conduit = exchange.getDestination().getBackChannel(message); exchange.setConduit(conduit); return conduit; }
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); } } }
exchange.put(Binding.class, getBinding()); exchange.put(Bus.class, bus); if (exchange.getDestination() == null) { exchange.setDestination(m.getDestination());
exchange.put(Binding.class, getBinding()); exchange.put(Bus.class, bus); if (exchange.getDestination() == null) { exchange.setDestination(m.getDestination());
exchange.put(Binding.class, getBinding()); exchange.put(Bus.class, bus); if (exchange.getDestination() == null) { exchange.setDestination(m.getDestination());
private void setTerminateSequence(Message msg, Identifier identifier, ProtocolVariation protocol) throws RMException { TerminateSequenceType ts = new TerminateSequenceType(); ts.setIdentifier(identifier); MessageContentsList contents = new MessageContentsList(new Object[]{protocol.getCodec().convertToSend(ts)}); msg.setContent(List.class, contents); // create a new exchange for this output-only exchange Exchange newex = new ExchangeImpl(); Exchange oldex = msg.getExchange(); newex.put(Bus.class, oldex.getBus()); newex.put(Endpoint.class, oldex.getEndpoint()); newex.put(Service.class, oldex.getEndpoint().getService()); newex.put(Binding.class, oldex.getEndpoint().getBinding()); newex.setConduit(oldex.getConduit(msg)); newex.setDestination(oldex.getDestination()); //Setup the BindingOperationInfo RMEndpoint rmep = getManager().getReliableEndpoint(msg); OperationInfo oi = rmep.getEndpoint(protocol).getEndpointInfo().getService().getInterface() .getOperation(protocol.getConstants().getTerminateSequenceAnonymousOperationName()); BindingInfo bi = rmep.getBindingInfo(protocol); BindingOperationInfo boi = bi.getOperation(oi); newex.put(BindingInfo.class, bi); newex.put(BindingOperationInfo.class, boi); msg.setExchange(newex); newex.setOutMessage(msg); }