cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r492052 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/endpoint/ common/common/src/main/java/org/apache/cxf/staxutils/ rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ rt/bindings/http/src/main/java/org/apache/cxf/bi...
Date Wed, 03 Jan 2007 05:53:37 GMT
Author: dandiep
Date: Tue Jan  2 21:53:36 2007
New Revision: 492052

URL: http://svn.apache.org/viewvc?view=rev&rev=492052
Log:
o Implement basic HTTP binding client support. 
o Add some convenience methods to the Client interface
o Move HTTP binding interceptors into their own package and rename
  some of them.
o Add a DOMXMLStreamWriter as woodstox doesn't have support for 
  writing to a Document yet it seems.
o DELETE still doesn't work due to problems in the HTTP module and
  trying to open an outputstream which isn't used I think.
o URI encoding still kind of sucks.  I need to review the rules and
  properly implement it.

Added:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java   (with props)
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java   (with props)
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java
      - copied, changed from r491080, incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java   (with props)
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java   (with props)
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java
      - copied, changed from r491080, incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java   (with props)
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/Messages.properties
      - copied unchanged from r491080, incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/Messages.properties
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java   (with props)
    incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java   (with props)
Removed:
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/Messages.properties
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIParameterInterceptor.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIMapper.java
    incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/Messages.properties
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java Tue Jan  2 21:53:36 2007
@@ -21,6 +21,8 @@
 
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.transport.MessageObserver;
@@ -28,7 +30,24 @@
 public interface Client extends InterceptorProvider, MessageObserver {
     String REQUEST_CONTEXT = "RequestContext";
     String RESPONSE_CONTEXT = "ResponseContext";
-    
+    /**
+     * Invokes an operation syncronously
+     * @param oi  The name of the operation to be invoked
+     * @param params  The params that matches the parts of the input message of the operation
+     * @return The return values that matche the parts of the output message of the operation
+     */
+    Object[] invoke(QName operationName,
+                    Object... params) throws Exception;
+
+    /**
+     * Invokes an operation syncronously
+     * @param oi  The operation to be invoked
+     * @param params  The params that matches the parts of the input message of the operation
+     * @return The return values that matche the parts of the output message of the operation
+     */
+    Object[] invoke(BindingOperationInfo oi,
+                    Object... params) throws Exception;
+
     /**
      * Invokes an operation syncronously
      * @param oi  The operation to be invoked

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Tue Jan  2 21:53:36 2007
@@ -31,6 +31,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 
 import org.w3c.dom.*;
@@ -69,6 +70,14 @@
 
         try {
             return getXMLOutputFactory().createXMLStreamWriter(out, encoding);
+        } catch (XMLStreamException e) {
+            throw new RuntimeException("Cant' create XMLStreamWriter", e);
+        }
+    }
+    
+    public static XMLStreamWriter createXMLStreamWriter(Result r) {
+        try {
+            return getXMLOutputFactory().createXMLStreamWriter(r);
         } catch (XMLStreamException e) {
             throw new RuntimeException("Cant' create XMLStreamWriter", e);
         }

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java?view=auto&rev=492052
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java Tue Jan  2 21:53:36 2007
@@ -0,0 +1,225 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.staxutils;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Stack;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class W3CDOMStreamWriter implements XMLStreamWriter {
+    static final String XML_NS = "http://www.w3.org/2000/xmlns/";
+    private Stack<Element> stack = new Stack<Element>();
+    private Document document;
+    private Element currentNode;
+    private NamespaceContext context;
+    private Map properties = Collections.EMPTY_MAP;
+
+    public W3CDOMStreamWriter() throws ParserConfigurationException {
+        this(DocumentBuilderFactory.newInstance().newDocumentBuilder());
+    }
+
+    public W3CDOMStreamWriter(DocumentBuilder builder) {
+        document = builder.newDocument();
+    }
+
+    public W3CDOMStreamWriter(Document document) {
+        this.document = document;
+    }
+
+    public void setProperties(Map properties) {
+        this.properties = properties;
+    }
+
+    public Document getDocument() {
+        return document;
+    }
+
+    public void writeStartElement(String local) throws XMLStreamException {
+        newChild(document.createElement(local));
+    }
+
+    private void newChild(Element element) {
+        if (currentNode != null) {
+            stack.push(currentNode);
+            currentNode.appendChild(element);
+        } else {
+            document.appendChild(element);
+        }
+
+        W3CNamespaceContext newContext = new W3CNamespaceContext();
+        newContext.setElement(element);
+        this.context = newContext;
+
+        currentNode = element;
+    }
+
+    public void writeStartElement(String namespace, String local) throws XMLStreamException {
+        newChild(document.createElementNS(namespace, local));
+    }
+
+    public void writeStartElement(String prefix, String local, String namespace) throws XMLStreamException {
+        if (prefix == null || prefix.equals("")) {
+            writeStartElement(namespace, local);
+        } else {
+            newChild(document.createElementNS(namespace, prefix + ":" + local));
+        }
+    }
+
+    public void writeEmptyElement(String namespace, String local) throws XMLStreamException {
+        writeStartElement(namespace, local);
+    }
+
+    public void writeEmptyElement(String prefix, String namespace, String local) throws XMLStreamException {
+        writeStartElement(prefix, namespace, local);
+    }
+
+    public void writeEmptyElement(String local) throws XMLStreamException {
+        writeStartElement(local);
+    }
+
+    public void writeEndElement() throws XMLStreamException {
+        if (stack.size() > 0) {
+            currentNode = (Element)stack.pop();
+        } else {
+            currentNode = null;
+        }
+        ((W3CNamespaceContext)context).setElement(currentNode);
+    }
+
+    public void writeEndDocument() throws XMLStreamException {
+    }
+
+    public void writeAttribute(String local, String value) throws XMLStreamException {
+        Attr a = document.createAttribute(local);
+        a.setValue(value);
+        currentNode.setAttributeNode(a);
+    }
+
+    public void writeAttribute(String prefix, String namespace, String local, String value)
+        throws XMLStreamException {
+        if (prefix.length() > 0) {
+            local = prefix + ":" + local;
+        }
+        
+        Attr a = document.createAttributeNS(namespace, local);
+        a.setValue(value);
+        currentNode.setAttributeNodeNS(a);
+    }
+
+    public void writeAttribute(String namespace, String local, String value) throws XMLStreamException {
+        Attr a = document.createAttributeNS(namespace, local);
+        a.setValue(value);
+        currentNode.setAttributeNodeNS(a);
+    }
+
+    public void writeNamespace(String prefix, String namespace) throws XMLStreamException {
+        if (prefix.length() == 0) {
+            writeDefaultNamespace(namespace);
+        } else {
+            currentNode.setAttributeNS(XML_NS, "xmlns:" + prefix, namespace);
+        }
+    }
+
+    public void writeDefaultNamespace(String namespace) throws XMLStreamException {
+        currentNode.setAttributeNS(XML_NS, "xmlns", namespace);
+    }
+
+    public void writeComment(String value) throws XMLStreamException {
+        currentNode.appendChild(document.createComment(value));
+    }
+
+    public void writeProcessingInstruction(String target) throws XMLStreamException {
+        currentNode.appendChild(document.createProcessingInstruction(target, null));
+    }
+
+    public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
+        currentNode.appendChild(document.createProcessingInstruction(target, data));
+    }
+
+    public void writeCData(String data) throws XMLStreamException {
+        currentNode.appendChild(document.createCDATASection(data));
+    }
+
+    public void writeDTD(String arg0) throws XMLStreamException {
+        throw new UnsupportedOperationException();
+    }
+
+    public void writeEntityRef(String ref) throws XMLStreamException {
+        currentNode.appendChild(document.createEntityReference(ref));
+    }
+
+    public void writeStartDocument() throws XMLStreamException {
+    }
+
+    public void writeStartDocument(String version) throws XMLStreamException {
+        writeStartDocument();
+    }
+
+    public void writeStartDocument(String encoding, String version) throws XMLStreamException {
+        writeStartDocument();
+    }
+
+    public void writeCharacters(String text) throws XMLStreamException {
+        currentNode.appendChild(document.createTextNode(text));
+    }
+
+    public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
+        writeCharacters(new String(text, start, len));
+    }
+
+    public String getPrefix(String uri) throws XMLStreamException {
+        return context.getPrefix(uri);
+    }
+
+    public void setPrefix(String arg0, String arg1) throws XMLStreamException {
+    }
+
+    public void setDefaultNamespace(String arg0) throws XMLStreamException {
+    }
+
+    public void setNamespaceContext(NamespaceContext ctx) throws XMLStreamException {
+        this.context = ctx;
+    }
+
+    public NamespaceContext getNamespaceContext() {
+        return context;
+    }
+
+    public Object getProperty(String prop) throws IllegalArgumentException {
+        return properties.get(prop);
+    }
+
+    public void close() throws XMLStreamException {
+    }
+
+    public void flush() throws XMLStreamException {
+    }
+    
+}

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java?view=auto&rev=492052
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java Tue Jan  2 21:53:36 2007
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.staxutils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.NamespaceContext;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+public class W3CNamespaceContext implements NamespaceContext {
+    private Element currentNode;
+
+    public String getNamespaceURI(String prefix) {
+        String name = prefix;
+        if (name.length() == 0) {
+            name = "xmlns";
+        } else {
+            name = "xmlns:" + prefix;
+        }
+        
+        return getNamespaceURI(currentNode, name);
+    }
+
+    private String getNamespaceURI(Element e, String name) {
+        Attr attr = e.getAttributeNode(name);
+        if (attr == null) {
+            Node n = e.getParentNode();
+            if (n instanceof Element && n != e) {
+                return getNamespaceURI((Element)n, name);
+            }
+        } else {
+            return attr.getValue();
+        }
+
+        return null;
+    }
+
+    public String getPrefix(String uri) {
+        return getPrefix(currentNode, uri);
+    }
+
+    private String getPrefix(Element e, String uri) {
+        NamedNodeMap attributes = e.getAttributes();
+        if (attributes != null) {
+            for (int i = 0; i < attributes.getLength(); i++) {
+                Attr a = (Attr)attributes.item(i);
+
+                String val = a.getValue();
+                if (val != null && val.equals(uri)) {
+                    String name = a.getNodeName();
+                    if ("xmlns".equals(name)) {
+                        return "";
+                    } else {
+                        return name.substring(6);
+                    }
+                }
+            }
+        }
+
+        Node n = e.getParentNode();
+        if (n instanceof Element && n != e) {
+            return getPrefix((Element)n, uri);
+        }
+
+        return null;
+    }
+
+    public Iterator getPrefixes(String uri) {
+        List<String> prefixes = new ArrayList<String>();
+
+        String prefix = getPrefix(uri);
+        if (prefix != null) {
+            prefixes.add(prefix);
+        }
+        
+        return prefixes.iterator();
+    }
+
+    public Element getElement() {
+        return currentNode;
+    }
+
+    public void setElement(Element node) {
+        this.currentNode = node;
+    }
+}

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java Tue Jan  2 21:53:36 2007
@@ -27,14 +27,15 @@
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.binding.http.interceptor.ContentTypeOutInterceptor;
+import org.apache.cxf.binding.http.interceptor.DatabindingInSetupInterceptor;
+import org.apache.cxf.binding.http.interceptor.DatabindingOutSetupInterceptor;
 import org.apache.cxf.binding.xml.XMLBinding;
 import org.apache.cxf.binding.xml.interceptor.XMLFaultInInterceptor;
 import org.apache.cxf.binding.xml.interceptor.XMLFaultOutInterceptor;
-import org.apache.cxf.binding.xml.interceptor.XMLMessageOutInterceptor;
 import org.apache.cxf.interceptor.AttachmentInInterceptor;
 import org.apache.cxf.interceptor.AttachmentOutInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
-import org.apache.cxf.interceptor.WrappedOutInterceptor;
 import org.apache.cxf.service.model.BindingInfo;
 
 public class HttpBindingFactory extends AbstractBindingFactory {
@@ -70,16 +71,13 @@
         XMLBinding binding = new XMLBinding();
         
         binding.getInInterceptors().add(new AttachmentInInterceptor());
-        binding.getInInterceptors().add(new DispatchInterceptor());
-        binding.getInInterceptors().add(new URIParameterInterceptor());
+        binding.getInInterceptors().add(new DatabindingInSetupInterceptor());
 
         binding.getOutInterceptors().add(new AttachmentOutInterceptor());
-        binding.getOutInterceptors().add(new StaxOutInterceptor());
         binding.getOutInterceptors().add(new ContentTypeOutInterceptor());
-        binding.getOutInterceptors().add(new WrappedOutInterceptor());
-        binding.getOutInterceptors().add(new XMLMessageOutInterceptor());
-        
 
+        binding.getOutInterceptors().add(new DatabindingOutSetupInterceptor());
+        
         binding.getInFaultInterceptors().add(new XMLFaultInInterceptor());
         
         binding.getOutFaultInterceptors().add(new StaxOutInterceptor());

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java Tue Jan  2 21:53:36 2007
@@ -46,7 +46,7 @@
     private IriDecoderHelper() {
         
     }
-    
+
     public static List<Param> decodeIri(String uri, String loc) {
         List<Param> values = new ArrayList<Param>();
         String path = getUriPath(uri);

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIMapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIMapper.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIMapper.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIMapper.java Tue Jan  2 21:53:36 2007
@@ -32,7 +32,9 @@
 
 public class URIMapper {
     private List<ResourceInfo> resources = new ArrayList<ResourceInfo>();
-    private Map<OperationInfo, String> operations = 
+    private Map<OperationInfo, String> locations = 
+        new HashMap<OperationInfo, String>();
+    private Map<OperationInfo, String> verbs = 
         new HashMap<OperationInfo, String>();
     
     public BindingOperationInfo getOperation(String uri, String verb, Message m) {
@@ -60,12 +62,17 @@
         info.setUri(uri);
         info.setVerb(verb);
         info.setOperation(bop);
-        operations.put(bop.getOperationInfo(), uri);
+        locations.put(bop.getOperationInfo(), uri);
+        verbs.put(bop.getOperationInfo(), verb);
         resources.add(info);
     }
     
     public String getLocation(BindingOperationInfo bop) {
-        return operations.get(bop.getOperationInfo());
+        return locations.get(bop.getOperationInfo());
+    }
+    
+    public String getVerb(BindingOperationInfo bop) {
+        return verbs.get(bop.getOperationInfo());
     }
     
     public static class ResourceInfo {
@@ -94,7 +101,7 @@
     }
 
     public List getParameters(MessageInfo msgInfo, String path) {
-        String resource = operations.get(msgInfo.getOperation());
+        String resource = locations.get(msgInfo.getOperation());
         Map<String, String> paramMap = ResourceUtil.getURIParameters(path, resource);
         
         List<Object> params = new ArrayList<Object>(msgInfo.getMessageParts().size());

Copied: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java (from r491080, incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java?view=diff&rev=492052&p1=incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java&r1=491080&p2=incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java Tue Jan  2 21:53:36 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.binding.http;
+package org.apache.cxf.binding.http.interceptor;
 
 import java.util.ArrayList;
 import java.util.HashMap;

Added: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java?view=auto&rev=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java Tue Jan  2 21:53:36 2007
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.http.interceptor;
+
+import org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.interceptor.StaxInInterceptor;
+import org.apache.cxf.interceptor.WrappedInInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class DatabindingInSetupInterceptor extends AbstractPhaseInterceptor<Message> {
+
+    private static final WrappedInInterceptor WRAPPED_IN = new WrappedInInterceptor();
+    private static final XMLMessageInInterceptor XML_IN = new XMLMessageInInterceptor();
+    private static final URIParameterInInterceptor URI_IN = new URIParameterInInterceptor();
+    private static final StaxInInterceptor STAX_IN = new StaxInInterceptor();
+    private static final DispatchInterceptor DISPATCH_IN = new DispatchInterceptor();
+    
+    public DatabindingInSetupInterceptor() {
+        super();
+        setPhase(Phase.RECEIVE);
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        boolean client = Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
+        InterceptorChain chain = message.getInterceptorChain();
+        
+        if (client) {
+            chain.add(WRAPPED_IN);
+            chain.add(XML_IN);
+            chain.add(STAX_IN);
+        } else {
+            chain.add(URI_IN);
+            chain.add(DISPATCH_IN);
+        }
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java?view=auto&rev=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java Tue Jan  2 21:53:36 2007
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.http.interceptor;
+
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.binding.http.HttpConstants;
+import org.apache.cxf.binding.http.URIMapper;
+import org.apache.cxf.binding.xml.interceptor.XMLMessageOutInterceptor;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.interceptor.WrappedOutInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.staxutils.W3CDOMStreamWriter;
+
+public class DatabindingOutSetupInterceptor extends AbstractPhaseInterceptor<Message> {
+
+    private static final WrappedOutInterceptor WRAPPED_OUT = new WrappedOutInterceptor();
+    private static final XMLMessageOutInterceptor XML_OUT = new XMLMessageOutInterceptor();
+    private static final StaxOutInterceptor STAX_OUT = new StaxOutInterceptor();
+    
+    public DatabindingOutSetupInterceptor() {
+        super();
+        setPhase(Phase.PRE_LOGICAL);
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        boolean client = Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
+        
+        InterceptorChain chain = message.getInterceptorChain();
+        
+        if (client) {
+            Document document = DOMUtils.createDocument();
+            message.setContent(Document.class, document);
+            
+            XMLStreamWriter writer = new W3CDOMStreamWriter(document);
+            message.setContent(XMLStreamWriter.class, writer);
+           
+            WrappedOutInterceptor wrappedOut = new WrappedOutInterceptor();
+            wrappedOut.setPhase(Phase.PRE_LOGICAL);
+            wrappedOut.addAfter(getId());
+            chain.add(wrappedOut);
+
+            XMLMessageOutInterceptor xmlOut = new XMLMessageOutInterceptor();
+            xmlOut.setPhase(Phase.PRE_LOGICAL);
+            xmlOut.addAfter(wrappedOut.getId());
+            chain.add(xmlOut);
+            
+            chain.doInterceptInSubChain(message);
+            
+            chain.add(new URIParameterOutInterceptor());
+            
+            Endpoint ep = message.getExchange().get(Endpoint.class);
+            URIMapper mapper = (URIMapper) ep.getService().get(URIMapper.class.getName());
+            BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+            
+            String verb = mapper.getVerb(bop);
+            message.put(Message.HTTP_REQUEST_METHOD, verb);
+            boolean putOrPost = verb.equals(HttpConstants.POST) || verb.equals(HttpConstants.PUT);
+            
+            if (putOrPost) {
+                chain.add(new DocumentWriterInterceptor());
+                chain.add(STAX_OUT);
+            }
+        } else {
+            chain.add(STAX_OUT);
+            chain.add(WRAPPED_OUT);
+            chain.add(XML_OUT);
+        }
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java (from r491080, incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java?view=diff&rev=492052&p1=incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java&r1=491080&p2=incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java Tue Jan  2 21:53:36 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.binding.http;
+package org.apache.cxf.binding.http.interceptor;
 
 import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
+import org.apache.cxf.binding.http.URIMapper;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;

Added: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java?view=auto&rev=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java Tue Jan  2 21:53:36 2007
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.http.interceptor;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.staxutils.StaxUtils;
+
+public class DocumentWriterInterceptor extends AbstractPhaseInterceptor<Message> {
+
+    public DocumentWriterInterceptor() {
+        super();
+        setPhase(Phase.MARSHAL);
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        Document doc = message.getContent(Document.class);
+        XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
+        
+        try {
+            StaxUtils.writeDocument(doc, writer, false);
+        } catch (XMLStreamException e) {
+            throw new Fault(e);
+        }
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java?view=auto&rev=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java Tue Jan  2 21:53:36 2007
@@ -0,0 +1,131 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.http.interceptor;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.binding.http.IriDecoderHelper;
+import org.apache.cxf.binding.http.IriDecoderHelper.Param;
+import org.apache.cxf.binding.http.URIMapper;
+import org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.StaxInInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+
+public class URIParameterInInterceptor extends AbstractPhaseInterceptor<Message> {
+    private static final Logger LOG = Logger.getLogger(URIParameterInInterceptor.class.getName());
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(URIParameterInInterceptor.class);
+
+    public URIParameterInInterceptor() {
+        super();
+        setPhase(Phase.UNMARSHAL);
+        addBefore(XMLMessageInInterceptor.class.getName());
+    }
+
+    public void handleMessage(Message message) {
+        String path = (String)message.get(DispatchInterceptor.RELATIVE_PATH);
+        String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
+        String contentType = (String)message.get(Message.CONTENT_TYPE);
+
+        LOG.info("URIParameterInterceptor handle message on path [" + path 
+                 + "] with content-type ["  + contentType + "]");
+        
+        BindingOperationInfo op = message.getExchange().get(BindingOperationInfo.class);
+
+        URIMapper mapper = (URIMapper)message.getExchange().get(Service.class).get(URIMapper.class.getName());
+        String location = mapper.getLocation(op);
+
+        List<MessagePartInfo> parts = op.getOperationInfo().getInput().getMessageParts();
+
+        if (parts.size() == 0) {
+            message.setContent(Object.class, Collections.EMPTY_LIST);
+            return;
+        }
+
+        if (parts.size() > 1) {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("SINGLE_PART_REQUIRED", BUNDLE));
+        }
+
+        message.getInterceptorChain().add(new XMLMessageInInterceptor());
+
+        MessagePartInfo part = parts.get(0);
+
+        List<Param> params = null;
+        if ("application/x-www-form-urlencoded.".equals(contentType)) {
+            params = IriDecoderHelper.decode(path, location, message.getContent(InputStream.class));
+        } else if ("application/xml".equals(contentType)) {
+            params = IriDecoderHelper.decodeIri(path, location);
+        } else if ("text/xml".equals(contentType)) {
+            params = IriDecoderHelper.decodeIri(path, location);
+        } else if ("multipart/form-data".equals(contentType)) {
+            // TODO
+        } else {
+            params = IriDecoderHelper.decodeIri(path, location);
+        }
+
+        mergeParams(message, path, method, part, params);
+    }
+
+    private void mergeParams(Message message, String path, String method, MessagePartInfo part,
+                             List<Param> params) {
+        // TODO: If its a POST/PUT operation we probably need to merge the
+        // incoming doc
+        Document doc;
+        if ("POST".equals(method) || "PUT".equals(method)) {
+            XMLInputFactory inputFactory = StaxInInterceptor.getXMLInputFactory(message);
+            try {
+                XMLStreamReader reader = 
+                    inputFactory.createXMLStreamReader(message.getContent(InputStream.class));
+                doc = StaxUtils.read(reader);
+            } catch (XMLStreamException e) {
+                throw new Fault(e);
+            }
+            doc = IriDecoderHelper.interopolateParams(doc, (XmlSchemaElement)part.getXmlSchema(), params);
+        } else {
+            doc = IriDecoderHelper.buildDocument((XmlSchemaElement)part.getXmlSchema(), params);
+        }
+
+        XMLStreamReader reader = StaxUtils.createXMLStreamReader(new DOMSource(doc));
+        try {
+            reader.next();
+        } catch (XMLStreamException e) {
+            throw new Fault(e);
+        }
+        message.setContent(XMLStreamReader.class, reader);
+    }
+}

Added: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java?view=auto&rev=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java Tue Jan  2 21:53:36 2007
@@ -0,0 +1,115 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.http.interceptor;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.cxf.binding.http.URIMapper;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingOperationInfo;
+
+/**
+ * Sets up the destination URI for a client invocation.
+ */
+public class URIParameterOutInterceptor extends AbstractPhaseInterceptor<Message> {
+
+    public URIParameterOutInterceptor() {
+        super();
+        setPhase(Phase.PREPARE_SEND);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void handleMessage(Message message) throws Fault {
+        Endpoint ep = message.getExchange().get(Endpoint.class);
+        URIMapper mapper = (URIMapper)ep.getService().get(URIMapper.class.getName());
+        BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+
+        String address = ep.getEndpointInfo().getAddress();
+        String location = mapper.getLocation(bop);
+
+        StringBuilder uri = new StringBuilder();
+        uri.append(address);
+
+        boolean addressSlash = address.charAt(address.length() - 1) == '/';
+        boolean locationSlash = location.charAt(0) == '/';
+        if (!addressSlash && !locationSlash) {
+            uri.append('/');
+            uri.append(location);
+        } else if (addressSlash && locationSlash) {
+            uri.append(location.substring(1));
+        } else {
+            uri.append(location);
+        }
+
+        Document d = message.getContent(Document.class);
+        String encodedUri = encodeIri(uri.toString(), d);
+
+        message.put(Message.ENDPOINT_ADDRESS, encodedUri);
+    }
+
+    public static String encodeIri(String uri, Document doc) {
+        StringBuilder builder = new StringBuilder();
+        String locPath = uri;
+        Element root = doc.getDocumentElement();
+
+        int start = 0;
+        char c;
+        for (int idx1 = 0; idx1 < locPath.length(); idx1++) {
+            c = locPath.charAt(idx1);
+            if (c == '{') {
+                if (locPath.charAt(idx1 + 1) == '{') {
+                    idx1++;
+                } else {
+                    builder.append(locPath.substring(start, idx1));
+
+                    int locEnd = locPath.indexOf('}', idx1);
+                    String name = locPath.substring(idx1 + 1, locEnd);
+                    idx1 = locEnd;
+
+                    NodeList childNodes = root.getChildNodes();
+                    for (int i = 0; i < childNodes.getLength(); i++) {
+                        Node n = childNodes.item(i);
+
+                        if (n.getNodeType() == Node.ELEMENT_NODE && name.equals(n.getLocalName())) {
+                            builder.append(DOMUtils.getContent(n));
+                            break;
+                        }
+                    }
+
+                    start = locEnd + 1;
+                }
+            }
+        }
+
+        if (start == 0) {
+            return uri;
+        }
+
+        return builder.toString();
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java?view=auto&rev=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java (added)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java Tue Jan  2 21:53:36 2007
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.http.bare;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.binding.http.AbstractRestTest;
+import org.apache.cxf.binding.http.Customer;
+import org.apache.cxf.binding.http.Customers;
+import org.apache.cxf.binding.http.HttpBindingFactory;
+import org.apache.cxf.binding.http.HttpBindingInfoFactoryBean;
+import org.apache.cxf.endpoint.ClientImpl;
+import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+
+public class ClientTest extends AbstractRestTest {
+    public void testCreation() throws Exception {
+        BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
+        bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID, new HttpBindingFactory());
+        
+        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
+        sf.setBus(getBus());
+        sf.setServiceClass(CustomerService.class);
+        sf.getServiceFactory().setWrapped(false);
+        sf.setBindingFactory(new HttpBindingInfoFactoryBean());
+        sf.setAddress("http://localhost:9001/foo/");
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("contextMatchStrategy", "stem");
+        sf.setProperties(props);
+        
+        ServerImpl svr = (ServerImpl) sf.create();
+
+        svr.getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
+        
+        ClientImpl client = new ClientImpl(getBus(), svr.getEndpoint());
+        
+        Object[] objects = client.invoke(new QName("http://cxf.apache.org/jra", "getCustomers"), 
+                                         new GetCustomers());
+        assertNotNull(objects);
+        
+        Customers c = (Customers) objects[0];
+        Customer customer = c.getCustomer().iterator().next();
+        assertEquals("Dan Diephouse", customer.getName());
+        
+        GetCustomer getCustomer = new GetCustomer();
+        getCustomer.setId(customer.getId());
+        objects = client.invoke(new QName("http://cxf.apache.org/jra", "getCustomer"), getCustomer);
+        
+        customer = (Customer) objects[0];
+        assertEquals("Dan Diephouse", customer.getName());
+        
+//        objects = client.invoke(new QName("http://cxf.apache.org/jra", "deleteCustomer"), 
+//        customer.getId());
+//        assertTrue(objects == null || objects.length == 0);
+//        
+        svr.stop();
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java Tue Jan  2 21:53:36 2007
@@ -89,8 +89,8 @@
     @Delete
     @HttpResource(location = "/customers/{id}")
     @WebMethod
-    public void deleteCustomer(String id) {
-        customers.remove(new Long(id));
+    public void deleteCustomer(long id) {
+        customers.remove(id);
     }
 
     final Customer createCustomer() {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue Jan  2 21:53:36 2007
@@ -27,9 +27,12 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.Binding;
+import org.apache.cxf.common.i18n.UncheckedException;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.interceptor.ClientOutFaultObserver;
@@ -64,7 +67,7 @@
     protected Endpoint endpoint;
     protected Conduit initedConduit;
     protected ClientOutFaultObserver outFaultObserver; 
-    protected int synchronousTimeout = 1000000; // default 10 second timeout
+    protected int synchronousTimeout = 10000000; // default 10 second timeout
 
     public ClientImpl(Bus b, Endpoint e) {
         this(b, e, null);
@@ -81,6 +84,19 @@
 
     public Endpoint getEndpoint() {
         return this.endpoint;
+    }
+
+    public Object[] invoke(BindingOperationInfo oi, Object... params) throws Exception {
+        return invoke(oi, params, null);
+    }
+
+    public Object[] invoke(QName operationName, Object... params) throws Exception {
+        BindingOperationInfo op = endpoint.getEndpointInfo().getBinding().getOperation(operationName);
+        if (op == null) {
+            throw new UncheckedException(
+                new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
+        }
+        return invoke(op, params);
     }
 
     @SuppressWarnings("unchecked")

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/Messages.properties?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/Messages.properties (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/Messages.properties Tue Jan  2 21:53:36 2007
@@ -20,3 +20,4 @@
 #
 NO_BINDING_FACTORY = Could not find factory for binding URI {0}.
 RESPONSE_TIMEOUT = Timed out waiting for response.
+NO_OPERATION = No operation was found with the name {0}.

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java Tue Jan  2 21:53:36 2007
@@ -51,11 +51,6 @@
             return;
         }
         
-//        if (!Boolean.TRUE.equals(
-//            message.getContextualProperty(org.apache.cxf.message.Message.MTOM_ENABLED))) {
-//            return;
-//        }
-        
         String contentType = (String) message.get(Message.CONTENT_TYPE);
         if (contentType != null && contentType.toLowerCase().indexOf("multipart/related") != -1) {
             AttachmentDeserializer ad = new AttachmentDeserializer(message);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java?view=diff&rev=492052&r1=492051&r2=492052
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java Tue Jan  2 21:53:36 2007
@@ -44,7 +44,8 @@
 
     public StaxOutInterceptor() {
         super();
-        setPhase(Phase.PRE_PROTOCOL);
+        setPhase(Phase.PRE_STREAM);
+        addAfter(AttachmentOutInterceptor.class.getName());
     }
 
     public void handleMessage(Message message) {



Mime
View raw message