private boolean isResponseRedirected(Message outMessage) { Exchange exchange = outMessage.getExchange(); return exchange != null && Boolean.TRUE.equals(exchange.get(REQUEST_REDIRECTED)); }
public void run() { outMessage.getExchange().put(Executor.class.getName() + ".USING_SPECIFIED", Boolean.TRUE); ex2.execute(origRunnable); } };
public Servlet3Continuation() { req.setAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE, inMessage.getExchange().getInMessage()); callback = inMessage.getExchange().get(ContinuationCallback.class); blockRestart = PropertyUtils.isTrue(inMessage.getContextualProperty(BLOCK_RESTART)); context = req.startAsync(); context.addListener(this); }
public void handleMessage(Message message) throws Fault { MessageContentsList outObjects = MessageContentsList.getContentsList(message); Exchange exchange = message.getExchange(); OperationInfo op = exchange.getBindingOperationInfo() == null ? null if (!Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE))) { List<MessagePartInfo> parts = op.getOutput().getMessageParts(); MessageContentsList inObjects = MessageContentsList.getContentsList(exchange.getInMessage()); message.put(HolderInInterceptor.CLIENT_HOLDERS, holders);
@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 } } }
outMessage.getExchange().put("client.redirect.exception", "true"); throw ex; outMessage.put("transport.retransmit.url", newURL); retransmit(newURL); return true;
public void handleMessage(Message message) throws Fault { Exchange ex = message.getExchange(); BindingOperationInfo boi = ex.getBindingOperationInfo(); if (Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)) || boi == null) { return; Method method = ex.get(Method.class); BindingMessageInfo bmi; MessageInfo wrappedMessageInfo = message.get(MessageInfo.class); MessageInfo messageInfo; if (wrappedMessageInfo == boi.getOperationInfo().getInput()) { return; message.put(MessageInfo.class, messageInfo); message.put(BindingMessageInfo.class, bmi); ex.put(BindingOperationInfo.class, boi2); Service service = ServiceModelUtil.getService(message.getExchange()); DataBinding dataBinding = service.getDataBinding(); if (dataBinding instanceof WrapperCapableDatabinding) {
private static SchemaValidationType getOverrideSchemaValidationType(Message message) { Object obj = message.get(Message.SCHEMA_VALIDATION_ENABLED); if (obj == null && message.getExchange() != null) { obj = message.getExchange().get(Message.SCHEMA_VALIDATION_ENABLED); } if (obj != null) { // this method will transform the legacy enabled as well return getSchemaValidationType(obj); } return null; }
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) { origMessage = message.getContent(SOAPMessage.class); message.setContent(XMLStreamReader.class, reader); message.removeContent(SOAPMessage.class); 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) { .getContent(XMLStreamReader.class)); message.getExchange().setInMessage(responseMsg); responseMsg.put(InterceptorChain.STARTING_AT_INTERCEPTOR_ID, LogicalHandlerInInterceptor.class.getName()); observer.onMessage(responseMsg);
@Override public void handleMessage(Message message) throws Fault { Throwable exception = message.getContent(Exception.class); if (exception != null) { message.getExchange().put("wrap.in.processing.exception", Boolean.FALSE); throw new ServiceInvocationFailedException(exception, exception.toString(), "ServiceInvoke", null, this.service); } }
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) { origMessage = message.getContent(SOAPMessage.class); message.setContent(XMLStreamReader.class, reader); message.removeContent(SOAPMessage.class); Exchange exchange = message.getExchange(); FaultMode mode = message.get(FaultMode.class); faultMessage.setExchange(message.getExchange()); faultMessage = exchange.getEndpoint().getBinding().createMessage(faultMessage); faultMessage.put(FaultMode.class, mode); reader = message.getContent(XMLStreamReader.class); message.removeContent(XMLStreamReader.class); if (reader != null) {
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 { msg.setContent(InputStream.class, ds.getInputStream()); final InputStream in = msg.getContent(InputStream.class); final String ct2 = (String)msg.get(Message.CONTENT_TYPE); list.set(0, new DataSource() { OutputStream out = message.getContent(OutputStream.class); message.put(Message.CONTENT_TYPE, ct); try { InputStream in = ds.getInputStream();
@Override public void handleFault(Message message) { Exchange ex = message.getExchange(); if (Boolean.TRUE.equals(ex.get("org.apache.cxf.management.counter.enabled"))) { FaultMode mode = message.get(FaultMode.class); if (mode == null) { mode = FaultMode.UNCHECKED_APPLICATION_FAULT; } ex.put(FaultMode.class, mode); } } }
boolean exceptionSet = outMessage.getContent(Exception.class) != null; if (!exceptionSet) { try { Executor ex = outMessage.getExchange().get(Executor.class); if (forceWQ && ex != null) { final Executor ex2 = ex; WorkQueueManager mgr = outMessage.getExchange().getBus() .getExtension(WorkQueueManager.class); AutomaticWorkQueue qu = mgr.getNamedWorkQueue("http-conduit"); outMessage.getExchange().put(Executor.class.getName() + ".USING_SPECIFIED", Boolean.TRUE); ex.execute(runnable);
protected HandlerChainInvoker getInvoker(T message) { Exchange ex = message.getExchange(); HandlerChainInvoker invoker = ex.get(HandlerChainInvoker.class); if (null == invoker) { invoker = new HandlerChainInvoker(binding.getHandlerChain(), isOutbound(message)); ex.put(HandlerChainInvoker.class, invoker); } boolean outbound = isOutbound(message, ex); if (outbound) { invoker.setOutbound(); } else { invoker.setInbound(); } invoker.setRequestor(isRequestor(message)); if (ex.isOneWay() || ((isRequestor(message) && !outbound) || (!isRequestor(message) && outbound))) { invoker.setResponseExpected(false); } else { invoker.setResponseExpected(true); } return invoker; }
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(); 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()); exchange.put("IN_CHAIN_COMPLETE", Boolean.TRUE); exchange.setInMessage(inMessage); return; String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE)); String normalizedEncoding = HttpHeaderHelper.mapCharset(charset); if (normalizedEncoding == null) { throw new IOException(m); inMessage.put(Message.ENCODING, normalizedEncoding); if (in == null) { in = getInputStream();
public void handleMessage(Message message) throws Fault { Fault f = (Fault)message.getContent(Exception.class); if (f == null) { return; SoapVersion soapVersion = (SoapVersion)message.get(SoapVersion.class.getName()); if (soapVersion != null && soapVersion.getVersion() != 1.1) { if (f instanceof SoapFault) { throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_INVOKE", BUNDLE), e); Service service = message.getExchange().getService(); message.getExchange().getBus()); writer.setSchema(schema); OperationInfo op = message.getExchange().getBindingOperationInfo().getOperationInfo(); QName faultName = getFaultName(fault, cause.getClass(), op); MessagePartInfo part = getFaultMessagePart(faultName, op); FaultMode mode = message.get(FaultMode.class); if (mode == FaultMode.CHECKED_APPLICATION_FAULT) {
@Override public void handleMessage(Message message) throws Fault { final Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS)); final TraceScopeHolder<TraceScope> holder = super.startTraceSpan(headers, getUri(message), (String)message.get(Message.HTTP_REQUEST_METHOD)); if (holder != null) { message.getExchange().put(TRACE_SPAN, holder); } } }
private DispatchingRequest getDispatchingRequest(Message message) { Exchange exchange = message.getExchange(); String action = (String) exchange.get(MULE_SOAP_ACTION); Map<String, String> headers = new HashMap<>(); headers.put(SOAP_ACTION, action); // It's important that content type is bundled with the headers headers.put(CONTENT_TYPE, (String) message.get(CONTENT_TYPE)); headers.putAll((Map) exchange.get(MULE_TRANSPORT_HEADERS_KEY)); InputStream content = new ByteArrayInputStream(message.getContent(OutputStream.class).toString().getBytes()); return new DispatchingRequest(content, (String) exchange.get(MULE_WSC_ADDRESS), headers); } }