Refine search
public void handleMessage(Message message) throws Fault { if (binding.getHandlerChain().isEmpty()) { return; } HandlerChainInvoker invoker = getInvoker(message); if (invoker.getLogicalHandlers().isEmpty()) { return; } XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class); Document doc = DOMUtils.newDocument(); message.setContent(Node.class, doc); W3CDOMStreamWriter writer = new W3CDOMStreamWriter(doc); // set up the namespace context try { writer.setNamespaceContext(origWriter.getNamespaceContext()); } catch (XMLStreamException ex) { // don't set the namespaceContext } // Replace stax writer with DomStreamWriter message.setContent(XMLStreamWriter.class, writer); message.put(ORIGINAL_WRITER, origWriter); message.getInterceptorChain().add(ending); }
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) { message.setContent(XMLStreamWriter.class, origWriter); } catch (XMLStreamException e) { throw new Fault(e);
boolean requestor = isRequestor(message); XMLStreamReader reader = (XMLStreamReader)message.get("LogicalHandlerInterceptor.INREADER"); SOAPMessage origMessage = null; if (reader != null) { Exchange exchange = message.getExchange(); Exception ex = new Fault(exception); FaultMode mode = message.get(FaultMode.class); faultMessage.setContent(Exception.class, ex); faultMessage.put(FaultMode.class, mode); exchange.setOutMessage(null); exchange.setOutFaultMessage(faultMessage); InterceptorChain ic = message.getInterceptorChain(); ic.reset(); faultMessage.setInterceptorChain(ic); ic.doIntercept(faultMessage); message.setContent(XMLStreamWriter.class, origWriter); } catch (XMLStreamException e) { throw new Fault(e);
@Override public void handleFault(Message message) { Exception ex = message.getContent(Exception.class); if (ex instanceof AuthenticationException) { HttpServletResponse resp = (HttpServletResponse)message.getExchange() .getInMessage().get(AbstractHTTPDestination.HTTP_RESPONSE); resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED); resp.setHeader("WWW-Authenticate", authenticationType + " realm=\"" + realm + "\""); resp.setContentType("text/plain"); try { resp.getOutputStream().write(ex.getMessage().getBytes()); resp.getOutputStream().flush(); message.getInterceptorChain().setFaultObserver(null); //avoid return soap fault message.getInterceptorChain().abort(); } catch (IOException e) { // TODO } } }
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); } }
message.getInterceptorChain().abort(); responseMsg.setContent(SOAPMessage.class, soapMessage); XMLStreamReader xmlReader = createXMLStreamReaderFromSOAPMessage(soapMessage); responseMsg.setContent(XMLStreamReader.class, xmlReader); responseMsg.put(InterceptorChain.STARTING_AT_INTERCEPTOR_ID, if (!getInvoker(message).isOutbound()) { message.getInterceptorChain().abort(); 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(); chain.doInterceptStartingAfter(responseMsg, SoapPreProtocolOutInterceptor.class.getName());
public void handleMessage(Message message) { if (!isHttpVerbSupported(message)) { return; } if (contextPropertyName != null && !MessageUtils.getContextualBoolean(message.getExchange().getInMessage(), contextPropertyName, false)) { return; } if (skipOnFault && null != message.getContent(Exception.class) || MessageUtils.getContextualBoolean(message, TRANSFORM_SKIP, false)) { return; } XMLStreamWriter writer = message.getContent(XMLStreamWriter.class); OutputStream out = message.getContent(OutputStream.class); XMLStreamWriter transformWriter = createTransformWriterIfNeeded(writer, out); if (transformWriter != null) { message.setContent(XMLStreamWriter.class, transformWriter); message.put(AbstractOutDatabindingInterceptor.DISABLE_OUTPUTSTREAM_OPTIMIZATION, Boolean.TRUE); if (MessageUtils.isRequestor(message)) { message.removeContent(OutputStream.class); message.put(OUTPUT_STREAM_HOLDER, out); message.getInterceptorChain().add(ENDING); } } }
public void handleMessage(Message message) { if (message.getContent(XMLStreamReader.class) != null || !isHttpVerbSupported(message)) { return; } String ct = (String)message.get(Message.CONTENT_TYPE); if (ct != null && ct.indexOf("fastinfoset") != -1 && message.getContent(InputStream.class) != null && message.getContent(XMLStreamReader.class) == null) { message.setContent(XMLStreamReader.class, getParser(message.getContent(InputStream.class))); //add the StaxInEndingInterceptor which will close the reader message.getInterceptorChain().add(StaxInEndingInterceptor.INSTANCE); ct = ct.replace("fastinfoset", "xml"); if (ct.contains("application/xml")) { ct = ct.replace("application/xml", "text/xml"); } message.put(Message.CONTENT_TYPE, ct); message.getExchange().put(FIStaxOutInterceptor.FI_ENABLED, Boolean.TRUE); if (isRequestor(message)) { //record the fact that is worked so future requests will //automatically be FI enabled Endpoint ep = message.getExchange().getEndpoint(); ep.put(FIStaxOutInterceptor.FI_ENABLED, Boolean.TRUE); } } }
Exception exception = inMessage.getContent(Exception.class); exchange.setOutMessage(ContextUtils.createMessage(exchange)); in.cacheInput(); inMessage.getInterceptorChain().reset(); inMessage.getInterceptorChain().doIntercept(inMessage); throw new Fault(partialResponse.getContent(Exception.class)); MessageUtils.getContextualBoolean(inMessage, Message.ROBUST_ONEWAY, false); inMessage.getInterceptorChain().pause(); inMessage.getInterceptorChain().resume(); MessageObserver faultObserver = inMessage.getInterceptorChain().getFaultObserver(); if (chain != null && !chain.doIntercept(partialResponse) throw new Fault(partialResponse.getContent(Exception.class)); chain.reset(); inMessage.getInterceptorChain().pause(); inMessage.getInterceptorChain().resume();
protected void handle(Message msg) { if (MessageUtils.isRequestor(msg)) { LOG.fine("Is a requestor."); return; Exchange exchange = msg.getExchange(); assert null != exchange; BindingOperationInfo boi = exchange.getBindingOperationInfo(); if (null == boi) { LOG.fine("No binding operation info."); EndpointInfo ei = e.getEndpointInfo(); Bus bus = exchange.getBus(); PolicyEngine pe = bus.getExtension(PolicyEngine.class); if (null == pe) { Policy p = (Policy)msg.getContextualProperty(PolicyConstants.POLICY_OVERRIDE); if (p != null) { EndpointPolicyImpl endpi = new EndpointPolicyImpl(p); && msg.get(FaultMode.class) != FaultMode.UNCHECKED_APPLICATION_FAULT && msg.get(FaultMode.class) != FaultMode.CHECKED_APPLICATION_FAULT) { return; msg.getInterceptorChain().add(oi); LOG.log(Level.FINE, "Added interceptor of type {0}", oi.getClass().getSimpleName());
public void handleMessage(Message message) throws Fault { if (message.getExchange().isOneWay() && !isRequestor(message) && message.get(OneWayProcessorInterceptor.class) == null && message.getExchange().get(Executor.class) == null) { MessageUtils.isTrue(message.getContextualProperty(Message.ROBUST_ONEWAY)); MessageUtils.isTrue(message.getContextualProperty(USE_ORIGINAL_THREAD)); chain.pause(); chain.resume(); if (message.getContent(Exception.class) != null) { chain.pause(); try { final Object lock = new Object(); + " Users can specify a larger executor queue to avoid this."); if (!MessageUtils.isTrue( message.getContextualProperty( "org.apache.cxf.oneway.rejected_execution_exception"))) { chain.unpause();
public void handleMessage(Message message) throws Fault { if (message.getExchange().isOneWay() && !isRequestor(message) && message.get(OneWayProcessorInterceptor.class) == null && message.getExchange().get(Executor.class) == null) { MessageUtils.getContextualBoolean(message, Message.ROBUST_ONEWAY, false); MessageUtils.getContextualBoolean(message, USE_ORIGINAL_THREAD, false); chain.pause(); chain.resume(); if (message.getContent(Exception.class) != null) { chain.pause(); try { final Object lock = new Object(); + " Users can specify a larger executor queue to avoid this."); if (!MessageUtils.getContextualBoolean(message, "org.apache.cxf.oneway.rejected_execution_exception", false)) { chain.unpause();
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);
public void handleMessage(Message message) throws Fault { if (message.getExchange().get(Throwable.class) != null) { return; OutputStream os = message.getContent(OutputStream.class); String encoding = getEncoding(message); message.setContent(XMLStreamWriter.class, newXMLStreamWriter); } catch (Exception e) { throwFault(e.getMessage(), e); message.put(StaxOutInterceptor.FORCE_START_DOCUMENT, Boolean.TRUE); if (MessageUtils.getContextualBoolean(message, StaxOutInterceptor.FORCE_START_DOCUMENT, false)) { try { newXMLStreamWriter.writeStartDocument(encoding, "1.0"); } catch (XMLStreamException e) { throw new Fault(e); message.removeContent(OutputStream.class); message.getInterceptorChain().add(ending);
public void handleMessage(final Message message) throws Fault { final Exchange cxfExchange = message.getExchange(); final Endpoint endpoint = cxfExchange.get(Endpoint.class); final Service service = endpoint.getService(); final Invoker invoker = service.getInvoker(); Exchange runableEx = message.getExchange(); if (!cxfExchange.isOneWay()) { Endpoint end = cxfExchange.get(Endpoint.class); Message outMessage = runableEx.getOutMessage(); if (outMessage == null) { outMessage = end.getBinding().createMessage(); cxfExchange.setOutMessage(outMessage); resList = new MessageContentsList((Object[]) result); } else { outMessage.setContent(Object.class, result); .getExchangeId(), message); context.getDeliveryChannel().send(exchange); message.getInterceptorChain().pause(); } else { throw e; } catch (Exception e) { throw new Fault(e);
public void handleMessage(Message message) throws Fault { Exchange ex = message.getExchange(); Set<Endpoint> endpoints = CastUtils.cast((Set<?>)ex.get(MultipleEndpointObserver.ENDPOINTS)); Endpoint ep = selectEndpoint(message, endpoints); if (ep == null) { return; } ex.put(Endpoint.class, ep); ex.put(Binding.class, ep.getBinding()); ex.put(Service.class, ep.getService()); InterceptorChain chain = message.getInterceptorChain(); chain.add(ep.getInInterceptors()); chain.add(ep.getBinding().getInInterceptors()); chain.add(ep.getService().getInInterceptors()); chain.setFaultObserver(ep.getOutFaultObserver()); }
public void handleMessage(Message message) { OutputStream out = message.getContent(OutputStream.class); XMLStreamWriter writer = message.getContent(XMLStreamWriter.class); if (out == null || writer != null) { return; Object o = message.getContextualProperty(FI_ENABLED); if (!req) { if (message.getExchange().getInMessage() != null) { String s = (String)message.getExchange().getInMessage().get(Message.ACCEPT_CONTENT_TYPE); if (s != null && s.contains("fastinfoset")) { o = Boolean.TRUE; || MessageUtils.isTrue(o)) { StAXDocumentSerializer serializer = getOutput(message, out); message.setContent(XMLStreamWriter.class, serializer); serializer.writeStartDocument(); } catch (XMLStreamException e) { throw new Fault(e); message.getInterceptorChain().add(ENDING);
public void handleMessage(Message message) throws Fault { String method = (String)message.get(Message.HTTP_REQUEST_METHOD); String query = (String)message.get(Message.QUERY_STRING); String baseUri = (String)message.get(Message.REQUEST_URL); String ctx = (String)message.get(Message.PATH_INFO); if (isRecognizedQuery(map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) { Document doc = getDocument(message, baseUri, map, ctx); mout.put(DOCUMENT_HOLDER, doc); Iterator<Interceptor<? extends Message>> iterator = mout.getInterceptorChain().iterator(); while (iterator.hasNext()) { Interceptor<? extends Message> inInterceptor = iterator.next(); mout.getInterceptorChain().remove(inInterceptor); mout.getInterceptorChain().add(RawMessageWSDLGetOutInterceptor.INSTANCE); message.getInterceptorChain().doInterceptStartingAt( message, OutgoingChainInterceptor.class.getName());
protected void handle(Message msg) { if (!MessageUtils.isRequestor(msg)) { LOG.fine("Not a requestor."); return; Exchange exchange = msg.getExchange(); assert null != exchange; Endpoint e = exchange.getEndpoint(); if (null == e) { LOG.fine("No endpoint."); return; EndpointInfo ei = e.getEndpointInfo(); Bus bus = exchange.getBus(); PolicyEngine pe = bus.getExtension(PolicyEngine.class); if (null == pe) { Conduit conduit = exchange.getConduit(msg); LOG.fine("conduit: " + conduit); Policy p = (Policy)msg.getContextualProperty(PolicyConstants.POLICY_OVERRIDE); if (p != null) { EndpointPolicyImpl endpi = new EndpointPolicyImpl(p); msg.getInterceptorChain().add(i); LOG.log(Level.FINE, "Added interceptor of type {0}", i.getClass().getSimpleName());
Destination target = inMessage.getDestination(); if (target == null) { return; BindingOperationInfo boi = exchange.getBindingOperationInfo(); exchange.put(Executor.class, getExecutor(inMessage)); inMessage.getInterceptorChain().pause(); inMessage.getInterceptorChain().resume(); exchange.put(BindingOperationInfo.class, boi); exchange.getEndpoint())); if (chain != null && !chain.doIntercept(partialResponse) && partialResponse.getContent(Exception.class) != null) { if (partialResponse.getContent(Exception.class) instanceof Fault) { throw (Fault)partialResponse.getContent(Exception.class); throw new Fault(partialResponse.getContent(Exception.class)); chain.reset(); exchange.put(ConduitSelector.class, new NullConduitSelector());