Examples of MessageContentsList


Examples of org.apache.cxf.message.MessageContentsList

            return endedHeader;
        }
       
        List<MessagePartInfo> parts = wrappedBmi.getMessageInfo().getMessageParts();
        if (parts.size() > 0) {
            MessageContentsList objs = MessageContentsList.getContentsList(message);
            if (objs == null) {
                return endedHeader;
            }
            SoapVersion soapVersion = message.getVersion();
            List<SoapHeaderInfo> headers = bmi.getExtensors(SoapHeaderInfo.class);
            if (headers == null) {
                return endedHeader;
            }           
           

            for (SoapHeaderInfo header : headers) {
                MessagePartInfo part = header.getPart();
                if (wrappedBmi != bmi) {
                    part = wrappedBmi.getMessageInfo().addMessagePart(part.getName());
                }
                if (part.getIndex() >= objs.size()) {
                    // The optional out of band header is not a part of parameters of the method
                    continue;
                }
                Object arg = objs.get(part);
                if (arg == null) {
                    continue;
                }
                objs.remove(part);
                if (!(startedHeader || preexistingHeaders)) {
                    try {
                        xtw.writeStartElement(soapPrefix,
                                              soapVersion.getHeader().getLocalPart(),
                                              soapVersion.getNamespace());
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

    }
   
    private Message createMessage() {
        Message message = new MessageImpl();
        message.put("Content-Type", "text/xml;charset=utf8");
        message.setContent(List.class, new MessageContentsList("<body/>"));
        return message;
    }
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

    protected boolean isChunkingSupported(Message message, String httpMethod) {
        if (HTTP_POST_METHOD.equals(httpMethod)) {
            return true;
        }
        if (HTTP_PUT_METHOD.equals(httpMethod)) {
            MessageContentsList objs = MessageContentsList.getContentsList(message);
            if (objs != null && objs.size() > 0) {
                Object obj = objs.get(0);
                if (obj.getClass() != String.class
                    || (obj.getClass() == String.class && ((String)obj).length() > 0)) {
                    return true;
                }
            }
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

           
            if (!Boolean.TRUE.equals(message.getContextualProperty(NO_VALIDATE_PARTS))) {
                throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION_PATH", LOG, opName,
                                                                       message.get(Message.PATH_INFO)));
            }
            MessageContentsList params = new MessageContentsList();
            params.add(null);
            message.setContent(List.class, params);
            if (op == null) {
                op = findAnyOp(message.getExchange());
            }
            if (op != null) {
                message.getExchange().put(BindingOperationInfo.class, op);
            }
        } else {
            message.getExchange().put(BindingOperationInfo.class, op);
            MessageContentsList params = getParameters(message, op);
            message.setContent(List.class, params);
        }
    }
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

       
        return orderedParameters;
    }
   
    protected MessageContentsList getParameters(Message message, BindingOperationInfo operation) {
        MessageContentsList parameters = new MessageContentsList();
        Map<String, String> queries = getQueries(message);
       
        if (!isFixedParameterOrder(message)) {
            boolean emptyQueries = CollectionUtils.isEmpty(queries.values());           
           
            List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
            queries = keepInOrder(queries,
                                  operation.getOperationInfo(),
                                  names);
            if (!emptyQueries && CollectionUtils.isEmpty(queries.values())) {
                if (operation.isUnwrappedCapable()) {
                    //maybe the wrapper was skipped
                    return getParameters(message, operation.getUnwrappedOperation());
                }
               
               
                throw new Fault(new org.apache.cxf.common.i18n.Message("ORDERED_PARAM_REQUIRED",
                                                                       LOG,
                                                                       names.toString()));
            }
        }
       
        Method method = getMethod(message, operation);       
       
        Class<?>[] types = method.getParameterTypes();       
       
        for (Map.Entry<String, String> ent : queries.entrySet()) {
            String key = ent.getKey();
            MessagePartInfo inf = null;
            for (MessagePartInfo p : operation.getOperationInfo().getInput().getMessageParts()) {
                if (p.getConcreteName().getLocalPart().equals(key)) {
                    inf = p;
                    break;
                }
            }
            if (inf == null && operation.isUnwrappedCapable()) {
                for (MessagePartInfo p
                    : operation.getUnwrappedOperation().getOperationInfo().getInput().getMessageParts()) {
                    if (p.getConcreteName().getLocalPart().equals(key)) {
                        inf = p;
                        break;
                    }
                } 
            }
            int idx = 0;
            if (inf != null) {
                idx = inf.getIndex();
            }
            Class<?> type = types[idx];
           
                      
            if (type == null) {
                LOG.warning("URIMappingInterceptor MessagePartInfo NULL ");
                throw new Fault(new org.apache.cxf.common.i18n.Message("NO_PART_FOUND", LOG,
                                                                       "index: " + idx + " on key " + key));
            }

            // TODO check the parameter name here
            Object param = null;
                       
            String val = ent.getValue();
            if (type.isPrimitive() && val != null) {
                param = PrimitiveUtils.read(val, type);
            } else {
                param = readType(val, type);
            }
            parameters.set(idx, param);
           
            idx = parameters.size();
        }
        return parameters;
    }
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

    protected Form getRequestForm(Message message) {
        Object ct = message.get(Message.CONTENT_TYPE);
        if (ct == null || !MediaType.APPLICATION_FORM_URLENCODED.equalsIgnoreCase(ct.toString())) {
            return null;
        }
        MessageContentsList objs = MessageContentsList.getContentsList(message);
        if (objs != null && objs.size() == 1) {
            Object obj = objs.get(0);
            if (obj instanceof Form) {
                return (Form)obj;
            } else if (obj instanceof MultivaluedMap) {
                return new Form((MultivaluedMap<String, String>)obj);
            }
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

            }
            List<Object> params = null;
            if (o instanceof List) {
                params = CastUtils.cast((List<?>)o);
            } else if (o != null) {
                params = new MessageContentsList(o);
            }
           
            m = adjustMethodAndParams(m, exchange, params, serviceObject.getClass());
           
            //Method m = (Method)bop.getOperationInfo().getProperty(Method.class.getName());
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

           
            if (exchange.isOneWay()) {
                return null;
            }
           
            return new MessageContentsList(res);
        } catch (InvocationTargetException e) {
           
            Throwable t = e.getCause();
           
            if (t == null) {
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

            }
        }
    }

    protected void setParameters(Object[] params, Message message) {
        MessageContentsList contents = new MessageContentsList(params);
        message.setContent(List.class, contents);
    }
View Full Code Here

Examples of org.apache.cxf.message.MessageContentsList

                        outMessage = ep.getBinding().createMessage(outMessage);
                        exchange.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
TOP
Copyright © 2018 www.massapi.com. 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.