Java Code Examples for org.apache.cxf.message.Exchange#setInFaultMessage()
The following examples show how to use
org.apache.cxf.message.Exchange#setInFaultMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProviderFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
private Message prepareFaultMessage(String contentType, String acceptType) { Message message = new MessageImpl(); Map<String, List<String>> headers = new MetadataMap<String, String>(); message.put(Message.PROTOCOL_HEADERS, headers); Exchange exchange = new ExchangeImpl(); exchange.setInMessage(null); exchange.setInFaultMessage(message); if (acceptType != null) { headers.put("Accept", Collections.singletonList(acceptType)); exchange.setOutMessage(new MessageImpl()); } else { headers.put("Content-Type", Collections.singletonList(contentType)); } message.put("Content-Type", contentType); message.setExchange(exchange); return message; }
Example 2
Source File: CorbaConduit.java From cxf with Apache License 2.0 | 6 votes |
public void handleResponse() throws IOException { LOG.log(Level.FINE, "incoming observer is " + incomingObserver); Exchange exchange = message.getExchange(); CorbaMessage corbaMsg = (CorbaMessage) message; MessageImpl inMessage = new MessageImpl(); CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig, typeMap); inMessage.setDestination(destination); exchange.put(ORB.class, orb); inMessage.setExchange(exchange); CorbaMessage inCorbaMsg = new CorbaMessage(inMessage); inCorbaMsg.setCorbaTypeMap(typeMap); if (corbaMsg.getStreamableException() != null) { exchange.setInFaultMessage(corbaMsg); inCorbaMsg.setStreamableException(corbaMsg.getStreamableException()); } else if (corbaMsg.getSystemException() != null) { exchange.setInFaultMessage(corbaMsg); inCorbaMsg.setSystemException(corbaMsg.getSystemException()); } LOG.log(Level.FINE, "incoming observer is " + incomingObserver); incomingObserver.onMessage(inCorbaMsg); message.setContent(Exception.class, inCorbaMsg.getContent(Exception.class)); }
Example 3
Source File: ColocOutInterceptor.java From cxf with Apache License 2.0 | 5 votes |
protected void invokeInboundChain(Exchange ex, Endpoint ep) { Message m = getInBoundMessage(ex); Message inMsg = ep.getBinding().createMessage(); MessageImpl.copyContent(m, inMsg); //Copy Response Context to Client inBound Message //TODO a Context Filter Strategy required. inMsg.putAll(m); inMsg.put(Message.REQUESTOR_ROLE, Boolean.TRUE); inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE); inMsg.setExchange(ex); Exception exc = inMsg.getContent(Exception.class); if (exc != null) { ex.setInFaultMessage(inMsg); ColocInFaultObserver observer = new ColocInFaultObserver(bus); observer.onMessage(inMsg); } else { //Handle Response ex.setInMessage(inMsg); PhaseManager pm = bus.getExtension(PhaseManager.class); SortedSet<Phase> phases = new TreeSet<>(pm.getInPhases()); ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.PRE_INVOKE); InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases); inMsg.setInterceptorChain(chain); chain.doIntercept(inMsg); } ex.put(ClientImpl.FINISHED, Boolean.TRUE); }
Example 4
Source File: ColocMessageObserver.java From cxf with Apache License 2.0 | 5 votes |
protected void setOutBoundMessage(Exchange from, Exchange to) { if (from.getOutFaultMessage() != null) { to.setInFaultMessage(from.getOutFaultMessage()); } else { to.setInMessage(from.getOutMessage()); } }