Package org.apache.cxf.message

Examples of org.apache.cxf.message.MessageContentsList


        org.apache.camel.Message out = exchange.getOut();
        // The response message's body is an MessageContentsList which first element is the return value of the operation,
        // If there are some holder parameters, the holder parameter will be filled in the reset of List.
        // The result will be extract from the MessageContentsList with the String class type
        MessageContentsList result = (MessageContentsList)out.getBody();
        LOG.info("Received output text: " + result.get(0));
        Map<String, Object> responseContext = CastUtils.cast((Map)out.getHeader(Client.RESPONSE_CONTEXT));
        assertNotNull(responseContext);
        assertEquals("We should get the response context here", "UTF-8", responseContext.get(org.apache.cxf.message.Message.ENCODING));
        assertEquals("Reply body on Camel is wrong", "echo " + TEST_MESSAGE, result.get(0));
     // END SNIPPET: sending
    }
View Full Code Here


            = CastUtils.cast((Map<?, ?>)outMessage.get(Message.INVOCATION_CONTEXT));
        return CastUtils.cast((Map<?, ?>)invContext.get(REQUEST_CONTEXT));
    }
   
    protected List<?> getContentsList(Object body) {
        return body == null ? new MessageContentsList() : new MessageContentsList(body);
    }
View Full Code Here

    private void processResponse(ProviderFactory providerFactory, Message message) {
       
        if (isResponseAlreadyHandled(message)) {
            return;
        }
        MessageContentsList objs = MessageContentsList.getContentsList(message);
        if (objs == null || objs.size() == 0) {
            return;
        }
       
        Object responseObj = objs.get(0);
       
        Response response = null;
        if (responseObj instanceof Response) {
            response = (Response)responseObj;
            if (response.getStatus() == 500
View Full Code Here

        }
        Response r = JAXRSUtils.convertFaultToResponse(ex, message);
        if (r != null) {
            message.removeContent(Exception.class);
            message.getInterceptorChain().setFaultObserver(null);
            message.setContent(List.class, new MessageContentsList(r));
            if (message.getContextualProperty(FaultListener.class.getName()) == null) {
                message.put(FaultListener.class.getName(), new NoOpFaultListener());
            }
           
            PhaseManager pm = message.getExchange().get(Bus.class).getExtension(PhaseManager.class);
View Full Code Here

    }
   
    private Message createOutMessage(Message inMessage, Response r) {
        Endpoint e = inMessage.getExchange().get(Endpoint.class);
        Message mout = new MessageImpl();
        mout.setContent(List.class, new MessageContentsList(r));
        mout.setExchange(inMessage.getExchange());
        mout = e.getBinding().createMessage(mout);
        mout.setInterceptorChain(
             OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange()));
        inMessage.getExchange().setOutMessage(mout);
View Full Code Here

            super(Phase.WRITE);
        }
       
        public void handleMessage(Message outMessage) throws Fault {
           
            MessageContentsList objs = MessageContentsList.getContentsList(outMessage);
            if (objs == null || objs.size() == 0) {
                return;
            }
           
            OutputStream os = outMessage.getContent(OutputStream.class);
            if (os == null) {
                XMLStreamWriter writer = outMessage.getContent(XMLStreamWriter.class);
                if (writer == null) {
                    return;
                }
            }
           
            Object body = objs.get(0);
            Annotation[] customAnns = (Annotation[])outMessage.get(Annotation.class.getName());
            Type t = outMessage.get(Type.class);
            doWriteBody(outMessage, body, t, customAnns, os);
        }
View Full Code Here

        // TODO Auto-generated method stub
        return null;
    }
   
    private Object getMessageContent() {
        MessageContentsList objs = MessageContentsList.getContentsList(m);
        if (objs == null || objs.size() == 0) {
            return null;
        }
        return objs.get(0);
    }
View Full Code Here

    }


    private void doSetEntity(Object entity) {
        Object actualEntity = InjectionUtils.getEntity(entity);
        m.setContent(List.class, actualEntity == null ? new MessageContentsList()
            : new MessageContentsList(actualEntity));
        Type type = null;
        if (entity != null) {
            if (GenericEntity.class.isAssignableFrom(entity.getClass())) {
                type = ((GenericEntity<?>)entity).getType();
            } else {
View Full Code Here

                        outMessage = end.getBinding().createMessage();
                        cxfExchange.setOutMessage(outMessage);
                    }
                    copyJaxwsProperties(message, outMessage);
                    if (result != null) {
                        MessageContentsList resList = null;
                        if (result instanceof MessageContentsList) {
                            resList = (MessageContentsList) result;
                        } else if (result instanceof List) {
                            resList = new MessageContentsList((List) result);
                        } else if (result.getClass().isArray()) {
                            resList = new MessageContentsList((Object[]) result);
                        } else {
                            outMessage.setContent(Object.class, result);
                        }
                        if (resList != null) {
                            outMessage.setContent(List.class, resList);
View Full Code Here

   
    public JAXRSInvoker() {
    }

    public Object invoke(Exchange exchange, Object request) {
        MessageContentsList responseList = checkExchangeForResponse(exchange);
        if (responseList != null) {
            return responseList;
        }
        AsyncResponse asyncResp = exchange.get(AsyncResponse.class);
        if (asyncResp != null) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.message.MessageContentsList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.