You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/10/25 19:10:56 UTC

svn commit: r588283 [11/18] - in /incubator/cxf/branches/jliu: ./ api/ api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/io/ api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/phase/ api/src/main/jav...

Modified: incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Thu Oct 25 10:09:20 2007
@@ -276,32 +276,34 @@
                     new HTTPServerPolicy(), HTTPServerPolicy.class);
         }
     }
-
+    private static List<String> createMutableList(String val) {
+        return new ArrayList<String>(Arrays.asList(new String[] {val}));
+    }
     void setPolicies(Map<String, List<String>> headers) {
         HTTPServerPolicy policy = server; 
         if (policy.isSetCacheControl()) {
             headers.put("Cache-Control",
-                        Arrays.asList(new String[] {policy.getCacheControl().value()}));
+                        createMutableList(policy.getCacheControl().value()));
         }
         if (policy.isSetContentLocation()) {
             headers.put("Content-Location",
-                        Arrays.asList(new String[] {policy.getContentLocation()}));
+                        createMutableList(policy.getContentLocation()));
         }
         if (policy.isSetContentEncoding()) {
             headers.put("Content-Encoding",
-                        Arrays.asList(new String[] {policy.getContentEncoding()}));
+                        createMutableList(policy.getContentEncoding()));
         }
         if (policy.isSetContentType()) {
             headers.put(HttpHeaderHelper.CONTENT_TYPE,
-                        Arrays.asList(new String[] {policy.getContentType()}));
+                        createMutableList(policy.getContentType()));
         }
         if (policy.isSetServerType()) {
             headers.put("Server",
-                        Arrays.asList(new String[] {policy.getServerType()}));
+                        createMutableList(policy.getServerType()));
         }
         if (policy.isSetHonorKeepAlive() && !policy.isHonorKeepAlive()) {
             headers.put("Connection",
-                        Arrays.asList(new String[] {"close"}));
+                        createMutableList("close"));
         }
         
     

Modified: incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java Thu Oct 25 10:09:20 2007
@@ -44,9 +44,6 @@
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.ConduitInitiatorManager;
-import org.apache.cxf.transport.Destination;
-import org.apache.cxf.transport.DestinationFactory;
-import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.transport.https.HttpsURLConnectionFactory;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl11.WSDLEndpointFactory;
@@ -57,13 +54,12 @@
  * As a ConduitInitiator, this class sets up new HTTPConduits for particular
  * endpoints.
  *
- * TODO: Document DestinationFactory
  * TODO: Document WSDLEndpointFactory
  *
  */
 public abstract class AbstractHTTPTransportFactory 
     extends AbstractTransportFactory 
-    implements ConduitInitiator, DestinationFactory, WSDLEndpointFactory {
+    implements ConduitInitiator, WSDLEndpointFactory {
 
     /**
      * This constant holds the prefixes served by this factory.
@@ -78,7 +74,7 @@
      * The CXF Bus which this HTTPTransportFactory
      * is governed.
      */
-    private Bus bus;
+    protected Bus bus;
   
     /**
      * This collection contains "activationNamespaces" which is synominous
@@ -86,7 +82,7 @@
      * AbstractTransportFactory.
      * TODO: Change these to "transportIds"?
      */
-    private Collection<String> activationNamespaces;
+    protected Collection<String> activationNamespaces;
 
     /**
      * This method is used by Spring to inject the bus.
@@ -129,22 +125,17 @@
         
         if (getTransportIds() == null) {
             setTransportIds(new ArrayList<String>(activationNamespaces));
+        } else if (activationNamespaces == null) {
+            activationNamespaces = getTransportIds();
         }
         
         ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
-
         //Note, activationNamespaces can be null
         if (null != cim && null != activationNamespaces) {
             for (String ns : activationNamespaces) {
                 cim.registerConduitInitiator(ns, this);
             }
         }
-        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
-        if (null != dfm && null != activationNamespaces) {
-            for (String ns : activationNamespaces) {
-                dfm.registerDestinationFactory(ns, this);
-            }
-        }
     }
 
     /**
@@ -174,9 +165,6 @@
         conduit.finalizeConfig();
         return conduit;
     }
-
-    public abstract Destination getDestination(EndpointInfo endpointInfo) throws IOException;
-
 
     public EndpointInfo createEndpointInfo(
         ServiceInfo serviceInfo, 

Modified: incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Thu Oct 25 10:09:20 2007
@@ -19,7 +19,6 @@
 package org.apache.cxf.transport.http;
 
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -30,6 +29,7 @@
 import java.net.Proxy;
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -51,7 +51,6 @@
 import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.HttpHeaderHelper;
-import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.AbstractWrappedOutputStream;
 import org.apache.cxf.io.CacheAndWriteOutputStream;
 import org.apache.cxf.message.Exchange;
@@ -336,7 +335,7 @@
      * causes an injection of the Spring configuration properties
      * of this Conduit.
      */
-    void finalizeConfig() {
+    protected void finalizeConfig() {
         // See if not set by configuration, if there are defaults
         // in order from the Endpoint, Service, or Bus.
         
@@ -1061,7 +1060,7 @@
             type += " ";
             type += authPolicy.getAuthorization();
             headers.put("Authorization",
-                        Arrays.asList(new String[] {type}));
+                        createMutableList(type));
         }
         AuthorizationPolicy proxyAuthPolicy = getProxyAuthorization();
         if (proxyAuthPolicy != null && proxyAuthPolicy.isSetUserName()) {
@@ -1078,11 +1077,13 @@
                 type += " ";
                 type += proxyAuthPolicy.getAuthorization();
                 headers.put("Proxy-Authorization",
-                            Arrays.asList(new String[] {type}));
+                            createMutableList(type));
             }
         }
     }
-    
+    private static List<String> createMutableList(String val) {
+        return new ArrayList<String>(Arrays.asList(new String[] {val}));
+    }
     /**
      * This call places HTTP Header strings into the headers that are relevant
      * to the ClientPolicy that is set on this conduit by configuration.
@@ -1099,44 +1100,44 @@
         }
         if (policy.isSetCacheControl()) {
             headers.put("Cache-Control",
-                Arrays.asList(new String[] {policy.getCacheControl().value()}));
+                        createMutableList(policy.getCacheControl().value()));
         }
         if (policy.isSetHost()) {
             headers.put("Host",
-                Arrays.asList(new String[] {policy.getHost()}));
+                        createMutableList(policy.getHost()));
         }
         if (policy.isSetConnection()) {
             headers.put("Connection",
-                Arrays.asList(new String[] {policy.getConnection().value()}));
+                        createMutableList(policy.getConnection().value()));
         }
         if (policy.isSetAccept()) {
             headers.put("Accept",
-                Arrays.asList(new String[] {policy.getAccept()}));
+                        createMutableList(policy.getAccept()));
         } else {
-            headers.put("Accept", Arrays.asList(new String[] {"*"}));
+            headers.put("Accept", createMutableList("*"));
         }
         if (policy.isSetAcceptEncoding()) {
             headers.put("Accept-Encoding",
-                Arrays.asList(new String[] {policy.getAcceptEncoding()}));
+                        createMutableList(policy.getAcceptEncoding()));
         }
         if (policy.isSetAcceptLanguage()) {
             headers.put("Accept-Language",
-                Arrays.asList(new String[] {policy.getAcceptLanguage()}));
+                        createMutableList(policy.getAcceptLanguage()));
         }
         if (policy.isSetContentType()) {
             message.put(Message.CONTENT_TYPE, policy.getContentType());
         }
         if (policy.isSetCookie()) {
             headers.put("Cookie",
-                Arrays.asList(new String[] {policy.getCookie()}));
+                        createMutableList(policy.getCookie()));
         }
         if (policy.isSetBrowserType()) {
             headers.put("BrowserType",
-                Arrays.asList(new String[] {policy.getBrowserType()}));
+                        createMutableList(policy.getBrowserType()));
         }
         if (policy.isSetReferer()) {
             headers.put("Referer",
-                Arrays.asList(new String[] {policy.getReferer()}));
+                        createMutableList(policy.getReferer()));
         }
     }
 
@@ -1580,21 +1581,15 @@
         
         // Trust is okay, write the cached request.
         OutputStream out = connection.getOutputStream();
-        
-        CacheAndWriteOutputStream.copyStream(stream.getInputStream(), out, 2048);
-        out.close();
+        stream.writeCacheTo(out);
         
         if (LOG.isLoggable(Level.FINE)) {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
-            CacheAndWriteOutputStream.copyStream(stream.getInputStream(), 
-                    baos, 2048);
-
             LOG.fine("Conduit \""
                      + getConduitName() 
                      + "\" Retransmit message to: " 
                      + connection.getURL()
                      + ": "
-                     + baos.toString());
+                     + new String(stream.getBytes()));
         }
         return connection;
     }
@@ -1659,7 +1654,7 @@
         }
         String token = Base64Utility.encode(userpass.getBytes());
         headers.put("Authorization",
-                    Arrays.asList(new String[] {"Basic " + token}));
+                    createMutableList("Basic " + token));
     }
 
     /**
@@ -1685,39 +1680,39 @@
         }
         String token = Base64Utility.encode(userpass.getBytes());
         headers.put("Proxy-Authorization",
-                    Arrays.asList(new String[] {"Basic " + token}));
+                    createMutableList("Basic " + token));
     }
     
     /**
      * Wrapper output stream responsible for flushing headers and handling
      * the incoming HTTP-level response (not necessarily the MEP response).
      */
-    private class WrappedOutputStream extends AbstractWrappedOutputStream {
+    protected class WrappedOutputStream extends AbstractWrappedOutputStream {
         /**
          * This field contains the currently active connection.
          */
-        private HttpURLConnection connection;
+        protected HttpURLConnection connection;
         
         /**
          * This boolean is true if the request must be cached.
          */
-        private boolean cachingForRetransmision;
+        protected boolean cachingForRetransmission;
         
         /**
          * If we are going to be chunking, we won't flush till close which causes
          * new chunks, small network packets, etc..
          */
-        private final boolean chunking;
+        protected final boolean chunking;
         
         /**
          * This field contains the output stream with which we cache
          * the request. It maybe null if we are not caching.
          */
-        private CacheAndWriteOutputStream cachedStream;
+        protected CacheAndWriteOutputStream cachedStream;
 
-        private Message outMessage;
+        protected Message outMessage;
         
-        WrappedOutputStream(
+        protected WrappedOutputStream(
                 Message m, 
                 HttpURLConnection c, 
                 boolean possibleRetransmit,
@@ -1726,7 +1721,7 @@
             super();
             this.outMessage = m;
             connection = c;
-            cachingForRetransmision = possibleRetransmit;
+            cachingForRetransmission = possibleRetransmit;
             chunking = isChunking;
         }
 
@@ -1757,13 +1752,13 @@
             
             // If this is a GET method we must not touch the output
             // stream as this automagically turns the reqest into a POST.
-            if (connection.getRequestMethod().equals("GET")) {
+            if ("GET".equals(connection.getRequestMethod())) {
                 return;
             }
             
             // If we need to cache for retransmission, store data in a
             // CacheAndWriteOutputStream. Otherwise write directly to the output stream.
-            if (cachingForRetransmision) {
+            if (cachingForRetransmission) {
                 cachedStream =
                     new CacheAndWriteOutputStream(connection.getOutputStream());
                 wrappedStream = cachedStream;
@@ -1786,8 +1781,19 @@
                 handleHeadersTrustCaching();
             }
             super.flush();
-            super.close();
-            handleResponse();
+            if (!cachingForRetransmission) {
+                super.close();
+            } else {
+                cachedStream.getOut().close();
+                cachedStream.closeFlowthroughStream();
+            }
+            try {
+                handleResponse();
+            } finally {
+                if (cachingForRetransmission) {
+                    cachedStream.close();
+                }
+            }
         }
         
         
@@ -1796,20 +1802,17 @@
          *
          * @throws IOException
          */
-        private void handleRetransmits() throws IOException {
+        protected void handleRetransmits() throws IOException {
             // If we have a cachedStream, we are caching the request.
             if (cachedStream != null) {
 
                 if (LOG.isLoggable(Level.FINE)) {
-                    ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
-                    IOUtils.copy(cachedStream.getInputStream(), baos, 2048);
-
                     LOG.fine("Conduit \""
                              + getConduitName() 
                              + "\" Transmit cached message to: " 
                              + connection.getURL()
                              + ": "
-                             + baos.toString());
+                             + new String(cachedStream.getBytes()));
                 }
 
                 HttpURLConnection oldcon = connection;
@@ -1852,7 +1855,7 @@
          * 
          * @throws IOException
          */
-        private void handleResponse() throws IOException {
+        protected void handleResponse() throws IOException {
             
             // Process retransmits until we fall out.
             handleRetransmits();
@@ -1905,13 +1908,26 @@
             Map<String, List<String>> headers = 
                 new HashMap<String, List<String>>();
             for (String key : connection.getHeaderFields().keySet()) {
-                headers.put(HttpHeaderHelper.getHeaderKey(key), 
+                if (key != null) {
+                    headers.put(HttpHeaderHelper.getHeaderKey(key), 
                         connection.getHeaderFields().get(key));
+                }
             }
+            
             inMessage.put(Message.PROTOCOL_HEADERS, headers);
             inMessage.put(Message.RESPONSE_CODE, responseCode);
-            inMessage.put(Message.CONTENT_TYPE, connection.getContentType());
-            inMessage.put(Message.ENCODING, connection.getContentEncoding());
+            String ct = connection.getContentType();
+            inMessage.put(Message.CONTENT_TYPE, ct);
+            String enc = connection.getContentEncoding();
+            if (enc == null 
+                && ct != null 
+                && ct.indexOf("charset") != -1) {
+                enc = ct.substring(ct.indexOf("charset") + 8);
+                if (enc.indexOf(";") != -1) {
+                    enc = enc.substring(0, enc.indexOf(";"));
+                }
+            }
+            inMessage.put(Message.ENCODING, HttpHeaderHelper.mapCharset(enc));
             
             if (maintainSession) {
                 String cookieStr = connection.getHeaderField("Set-Cookie");

Modified: incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Thu Oct 25 10:09:20 2007
@@ -34,6 +34,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
@@ -131,7 +132,10 @@
                                 out.flush();
                                 return;
                             } catch (Exception e) {
-                                throw new ServletException(e);
+                                //throw new ServletException(e);
+                                LOG.warning(qh.getClass().getName() 
+                                    + " Exception caught writing response: " 
+                                    + e.getMessage());
                             }
                         }   
                     }
@@ -225,7 +229,7 @@
                 enc = enc.substring(0, enc.length() - 1);
             }
             
-            inMessage.put(Message.ENCODING, enc);
+            inMessage.put(Message.ENCODING, HttpHeaderHelper.mapCharset(enc));
             SSLUtils.propogateSecureSession(request, inMessage);
             
             ExchangeImpl exchange = new ExchangeImpl();

Modified: incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java Thu Oct 25 10:09:20 2007
@@ -29,12 +29,14 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.transport.http.AbstractHTTPTransportFactory;
 
 public class ServletTransportFactory extends AbstractHTTPTransportFactory
@@ -63,6 +65,19 @@
     @Resource(name = "bus")
     public void setBus(Bus b) {
         super.setBus(b);
+    }
+    
+    @PostConstruct
+    public void register() {
+        if (null == bus) {
+            return;
+        }
+        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+        if (null != dfm && null != activationNamespaces) {
+            for (String ns : activationNamespaces) {
+                dfm.registerDestinationFactory(ns, this);
+            }
+        }
     }
     
     public void removeDestination(String path) {

Modified: incubator/cxf/branches/jliu/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml (original)
+++ incubator/cxf/branches/jliu/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml Thu Oct 25 10:09:20 2007
@@ -25,5 +25,21 @@
     
     <bean class="org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder"/>
     <bean class="org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder"/>
-
+    
+    
+    <bean class="org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory"
+    	id="org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory" 
+    	lazy-init="true">
+        <property name="bus" ref="cxf"/>
+        <property name="transportIds">
+            <list>
+                <value>http://schemas.xmlsoap.org/soap/http</value>
+                <value>http://schemas.xmlsoap.org/wsdl/http/</value>
+                <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
+ 	            <value>http://www.w3.org/2003/05/soap/bindings/HTTP/</value>
+                <value>http://cxf.apache.org/transports/http/configuration</value>
+                <value>http://cxf.apache.org/bindings/xformat</value>
+            </list>
+        </property>
+    </bean>
 </beans>

Modified: incubator/cxf/branches/jliu/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd (original)
+++ incubator/cxf/branches/jliu/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd Thu Oct 25 10:09:20 2007
@@ -73,7 +73,7 @@
                     </xs:annotation>      
                 </xs:attribute>
 
-                <xs:attribute name="HonorKeepAlive" type="xs:boolean" use="optional" default="false">
+                <xs:attribute name="HonorKeepAlive" type="xs:boolean" use="optional" default="true">
                     <xs:annotation>
                         <xs:documentation>
                         When set to Yes, the request socket will remain open after the reply is 
@@ -249,7 +249,7 @@
                     </xs:annotation>      
                 </xs:attribute>
 
-                <xs:attribute name="Connection" type="http-conf:connectionType" use="optional" default="close">
+                <xs:attribute name="Connection" type="http-conf:connectionType" use="optional" default="Keep-Alive">
                     <xs:annotation>
                         <xs:documentation>
                         The connection disposition.  If close the connection to the server is closed 

Modified: incubator/cxf/branches/jliu/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java Thu Oct 25 10:09:20 2007
@@ -361,6 +361,9 @@
                 EasyMock.expectLastCall().andReturn("POST");
                 connection.setChunkedStreamingMode(-1);
                 EasyMock.expectLastCall();                    
+            } else {
+                connection.getRequestMethod();
+                EasyMock.expectLastCall().andReturn("POST").anyTimes();
             }
 
             connection.setConnectTimeout(303030);
@@ -537,7 +540,7 @@
                    message.getContentFormats().contains(OutputStream.class));
         
         connection.getRequestMethod();
-        EasyMock.expectLastCall().andReturn("POST");
+        EasyMock.expectLastCall().andReturn("POST").anyTimes();
 
         os = EasyMock.createMock(OutputStream.class);
         connection.getOutputStream();
@@ -578,7 +581,7 @@
                                       ResponseDelimiter delimiter,
                                       boolean emptyResponse) throws IOException {
         connection.getHeaderFields();
-        EasyMock.expectLastCall().andReturn(Collections.EMPTY_MAP);
+        EasyMock.expectLastCall().andReturn(Collections.EMPTY_MAP).anyTimes();
         int responseCode = style == ResponseStyle.BACK_CHANNEL
                            ? HttpURLConnection.HTTP_OK
                            : HttpURLConnection.HTTP_ACCEPTED;
@@ -593,7 +596,7 @@
             connection.getContentLength();
             if (delimiter == ResponseDelimiter.CHUNKED 
                 || delimiter == ResponseDelimiter.EOF) {
-                EasyMock.expectLastCall().andReturn(-1);
+                EasyMock.expectLastCall().andReturn(-1).anyTimes();
                 if (delimiter == ResponseDelimiter.CHUNKED) {
                     connection.getHeaderField("Transfer-Encoding");
                     EasyMock.expectLastCall().andReturn("chunked");
@@ -604,7 +607,7 @@
                 is.read();
                 EasyMock.expectLastCall().andReturn(emptyResponse ? -1 : (int)'<');
             } else {
-                EasyMock.expectLastCall().andReturn(123);
+                EasyMock.expectLastCall().andReturn(123).anyTimes();
             }
             if (emptyResponse) {
                 is.close();

Modified: incubator/cxf/branches/jliu/rt/transports/jbi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/jbi/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/jbi/pom.xml (original)
+++ incubator/cxf/branches/jliu/rt/transports/jbi/pom.xml Thu Oct 25 10:09:20 2007
@@ -63,10 +63,8 @@
         <dependency>
             <groupId>org.apache.servicemix</groupId>
             <artifactId>servicemix-jbi</artifactId>
-            <version>${servicemix.version}</version>
+            <scope>provided</scope>
         </dependency>
- 
-     
     </dependencies>
 
     <build>

Modified: incubator/cxf/branches/jliu/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java Thu Oct 25 10:09:20 2007
@@ -19,8 +19,6 @@
 
 package org.apache.cxf.transport.jbi;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Member;
@@ -157,15 +155,16 @@
 
             
 
+        } catch (IOException e) {
+            throw e;
         } catch (Exception e) {
             e.printStackTrace();
-            throw new IOException(e.toString());
+            new IOException(e.toString());
         }
     }
 
-    private Source getMessageContent(Message message2) {
-        ByteArrayOutputStream bos = (ByteArrayOutputStream)getOut();
-        return new StreamSource(new ByteArrayInputStream(bos.toByteArray()));
+    private Source getMessageContent(Message message2) throws IOException {
+        return new StreamSource(this.getInputStream());
         
     }
 

Modified: incubator/cxf/branches/jliu/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java Thu Oct 25 10:09:20 2007
@@ -19,9 +19,8 @@
 
 package org.apache.cxf.transport.jbi;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -73,8 +72,7 @@
                 return;
             } else {
                 
-                ByteArrayOutputStream baos = (ByteArrayOutputStream)getOut();
-                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+                InputStream bais = getInputStream();
                 LOG.finest(new org.apache.cxf.common.i18n.Message(
                     "BUILDING.DOCUMENT", LOG).toString());
                 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();

Modified: incubator/cxf/branches/jliu/rt/transports/jbi/src/test/java/org/apache/cxf/transport/jbi/JBIConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/jbi/src/test/java/org/apache/cxf/transport/jbi/JBIConduitTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/jbi/src/test/java/org/apache/cxf/transport/jbi/JBIConduitTest.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/jbi/src/test/java/org/apache/cxf/transport/jbi/JBIConduitTest.java Thu Oct 25 10:09:20 2007
@@ -34,6 +34,7 @@
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
@@ -45,7 +46,7 @@
 import org.junit.Test;
 
 public class JBIConduitTest extends AbstractJBITest {
-    static final Logger LOG = Logger.getLogger(JBIDestinationTest.class.getName());
+    static final Logger LOG = LogUtils.getLogger(JBIDestinationTest.class);
 
     
     @Test

Modified: incubator/cxf/branches/jliu/rt/transports/jbi/src/test/java/org/apache/cxf/transport/jbi/JBIDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/jbi/src/test/java/org/apache/cxf/transport/jbi/JBIDestinationTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/jbi/src/test/java/org/apache/cxf/transport/jbi/JBIDestinationTest.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/jbi/src/test/java/org/apache/cxf/transport/jbi/JBIDestinationTest.java Thu Oct 25 10:09:20 2007
@@ -21,10 +21,11 @@
 
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.logging.LogUtils;
 import org.junit.Test;
 
 public class JBIDestinationTest extends AbstractJBITest {
-    static final Logger LOG = Logger.getLogger(JBIDestinationTest.class.getName());
+    static final Logger LOG = LogUtils.getLogger(JBIDestinationTest.class);
     @Test
     public void testDestination() throws Exception {
         LOG.info("JBI destination test");

Modified: incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java Thu Oct 25 10:09:20 2007
@@ -21,7 +21,6 @@
 
 
 import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -267,17 +266,7 @@
         }
         
         private void commitOutputMessage() throws JMSException {
-            Object request = null;            
-            
-            if (isTextPayload()) {
-                request = currentStream.toString();
-            } else {
-                request = ((ByteArrayOutputStream)currentStream).toByteArray();
-            }
-            
-            getLogger().log(Level.FINE, "Conduit Request is :[" + request + "]");
             javax.jms.Destination replyTo = pooledSession.destination();
-            
             //TODO setting up the responseExpected
             
             
@@ -288,6 +277,25 @@
                 replyTo = null;
             }
 
+            Object request = null;            
+            try {
+                if (isTextPayload()) {
+                    StringBuilder builder = new StringBuilder(2048);
+                    this.writeCacheTo(builder);
+                    request = builder.toString();
+                } else {
+                    request = getBytes();
+                }
+            } catch (IOException ex) {
+                JMSException ex2 = new JMSException("Error creating request");
+                ex2.setLinkedException(ex);
+                throw ex2;
+            }
+            if (getLogger().isLoggable(Level.FINE)) {
+                getLogger().log(Level.FINE, "Conduit Request is :[" + request + "]");
+            }
+            
+            
             jmsMessage = base.marshal(request, pooledSession.session(), replyTo,
                 getRuntimePolicy().getMessageType().value());
             

Modified: incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java Thu Oct 25 10:09:20 2007
@@ -21,7 +21,6 @@
 
 
 import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -406,34 +405,34 @@
                     replySession = base.sessionFactory.get(false);
                     sender = (QueueSender)replySession.producer();
                     
+                    String msgType = JMSConstants.TEXT_MESSAGE_TYPE;
+                    Object replyObj = null;
+                    
                     if (request instanceof TextMessage) {
-                        reply = base.marshal(currentStream.toString(), 
-                                             replySession.session(), 
-                                             null, 
-                                             JMSConstants.TEXT_MESSAGE_TYPE);
-                        getLogger().log(Level.FINE,
-                                         "The response message is ["
-                                         + currentStream.toString() + "]");
+                        StringBuilder builder = new StringBuilder();
+                        this.writeCacheTo(builder);
+                        replyObj = builder.toString();
+                        msgType = JMSConstants.TEXT_MESSAGE_TYPE;
                     } else if (request instanceof BytesMessage) {
-                        reply = base.marshal(((ByteArrayOutputStream)currentStream).toByteArray(),
-                                             replySession.session(),
-                                             null, 
-                                             JMSConstants.BYTE_MESSAGE_TYPE);
-                        getLogger().log(Level.FINE, "The response message is [" 
-                                             + new String((
-                                                 (ByteArrayOutputStream)currentStream).toByteArray()) 
-                                             + "]");
+                        replyObj = getBytes();
+                        msgType = JMSConstants.BYTE_MESSAGE_TYPE;
                     } else {
-                        reply = base.marshal(((ByteArrayOutputStream)currentStream).toByteArray(),
-                                             replySession.session(),
-                                             null, 
-                                            JMSConstants.BINARY_MESSAGE_TYPE);
-                        getLogger().log(Level.FINE, "The response message is [" 
-                                             + new String((
-                                                 (ByteArrayOutputStream)currentStream).toByteArray()) 
-                                             + "]");
+                        replyObj = getBytes();
+                        msgType = JMSConstants.BINARY_MESSAGE_TYPE;
+                    }
+                    
+                    if (getLogger().isLoggable(Level.FINE)) {
+                        getLogger().log(Level.FINE, "The response message is ["
+                                        + (replyObj instanceof String 
+                                           ? (String)replyObj : new String((byte[])replyObj))
+                                    + "]");
                     }
-                   
+
+                    reply = base.marshal(replyObj, 
+                                         replySession.session(), 
+                                         null, 
+                                         msgType);
+
                     setReplyCorrelationID(request, reply);
                     
                     base.setMessageProperties(headers, reply);

Modified: incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java Thu Oct 25 10:09:20 2007
@@ -89,7 +89,6 @@
         } else if (JMSConstants.BYTE_MESSAGE_TYPE.equals(messageType)) {
             message = session.createBytesMessage();
             ((BytesMessage)message).writeBytes((byte[])payload);
-            
         } else {
             message = session.createObjectMessage();
             ((ObjectMessage)message).setObject((byte[])payload);

Modified: incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java Thu Oct 25 10:09:20 2007
@@ -58,6 +58,11 @@
     public void prepare(final Message message) throws IOException {
         if (!Boolean.TRUE.equals(message.get(DIRECT_DISPATCH))) {
             dispatchViaPipe(message);
+        } else {
+            // prepare the stream here
+            PipedInputStream stream = new PipedInputStream();
+            message.setContent(InputStream.class, stream);
+            message.setContent(OutputStream.class, new PipedOutputStream(stream));
         }
     }
 
@@ -87,6 +92,7 @@
         ExchangeImpl ex = new ExchangeImpl();
         ex.setInMessage(copy);
         ex.put(IN_EXCHANGE, message.getExchange());
+        ex.put(LocalConduit.DIRECT_DISPATCH, true);
         ex.setDestination(destination);
         
         destination.getMessageObserver().onMessage(copy);

Modified: incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java Thu Oct 25 10:09:20 2007
@@ -73,8 +73,8 @@
             this.conduit = conduit;
         }
 
-        public void prepare(final Message message) throws IOException {
-            if (!Boolean.TRUE.equals(message.get(LocalConduit.DIRECT_DISPATCH))) {
+        public void prepare(final Message message) throws IOException {            
+            if (!Boolean.TRUE.equals(message.getExchange().get(LocalConduit.DIRECT_DISPATCH))) {
                 final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE);
                 
                 final PipedInputStream stream = new PipedInputStream();
@@ -90,24 +90,27 @@
                 };
     
                 PipedOutputStream outStream = new PipedOutputStream(stream);
-                message.setContent(OutputStream.class, outStream);
-    
+                message.setContent(OutputStream.class, outStream);    
                 new Thread(receiver).start();
+                
+            } else {
+                PipedInputStream stream = new PipedInputStream();
+                message.setContent(InputStream.class, stream);
+                message.setContent(OutputStream.class, new PipedOutputStream(stream));
             }
         }
 
         @Override
         public void close(Message message) throws IOException {
-            if (Boolean.TRUE.equals(message.get(LocalConduit.DIRECT_DISPATCH))) {
+            if (Boolean.TRUE.equals(message.getExchange().get(LocalConduit.DIRECT_DISPATCH))) {
                 final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE);
                 MessageImpl copy = new MessageImpl();
                 copy.putAll(message);
                 MessageImpl.copyContent(message, copy);
                 
-                if (exchange.getInMessage() == null) {
+                if (exchange != null && exchange.getInMessage() == null) {
                     exchange.setInMessage(copy);
-                }
-                
+                }                
                 conduit.getMessageObserver().onMessage(copy);
                 return;
             }

Modified: incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java Thu Oct 25 10:09:20 2007
@@ -66,7 +66,7 @@
         setTransportIds(ids);
         
         messageFilterProperties = new HashSet<String>();
-        messageFilterProperties.add(Message.REQUESTOR_ROLE);
+        messageFilterProperties.add(Message.REQUESTOR_ROLE);        
     }
     
     @Resource(name = "bus")

Modified: incubator/cxf/branches/jliu/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java (original)
+++ incubator/cxf/branches/jliu/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java Thu Oct 25 10:09:20 2007
@@ -19,18 +19,17 @@
 
 package org.apache.cxf.transport.local;
 
-import java.io.ByteArrayInputStream;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
-
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.Destination;
+
 import org.apache.cxf.transport.MessageObserver;
 import org.junit.Assert;
 import org.junit.Test;
@@ -38,35 +37,16 @@
 
 public class LocalTransportFactoryTest extends Assert {
     @Test
-    public void testTransportFactory() throws Exception {
-        LocalTransportFactory factory = new LocalTransportFactory();
-        
-        EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http");
-        AddressType a = new AddressType();
-        a.setLocation("http://localhost/test");
-        ei.addExtensor(a);
-
-        Destination d = factory.getDestination(ei);
-        d.setMessageObserver(new EchoObserver());
-        
-        
-        Conduit conduit = factory.getConduit(ei);
-        TestMessageObserver obs = new TestMessageObserver();
-        conduit.setMessageObserver(obs);
-        
-        Message m = new MessageImpl();
-        conduit.prepare(m);
-
-        OutputStream out = m.getContent(OutputStream.class);
-        out.write("hello".getBytes());
-        out.close();
-
-        
-        assertEquals("hello", obs.getResponseStream().toString());
+    public void testLocalTransportWithSeparateThread() throws Exception {
+        testInvocation(false);
     }
 
     @Test
-    public void testDirectInvocation() throws Exception {
+    public void testLocalTransportWithDirectDispatch() throws Exception {
+        testInvocation(true);
+    }
+    
+    private void testInvocation(boolean isDirectDispatch) throws Exception {
         LocalTransportFactory factory = new LocalTransportFactory();
         
         EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http");
@@ -83,10 +63,15 @@
         conduit.setMessageObserver(obs);
         
         MessageImpl m = new MessageImpl();
-        m.put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+        if (isDirectDispatch) {
+            m.put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+        }    
         m.setDestination(d);
-        m.setContent(InputStream.class, new ByteArrayInputStream("hello".getBytes()));
         conduit.prepare(m);
+        
+        OutputStream out = m.getContent(OutputStream.class);
+        out.write("hello".getBytes());
+        out.close();
         conduit.close(m);
 
         assertEquals("hello", obs.getResponseStream().toString());
@@ -95,20 +80,19 @@
 
         public void onMessage(Message message) {
             try {
+                message.getExchange().setInMessage(message);
                 Conduit backChannel = message.getDestination().getBackChannel(message, null, null);
-                message.remove(LocalConduit.DIRECT_DISPATCH);
                 
+                InputStream in = message.getContent(InputStream.class);
+                assertNotNull(in);   
                 backChannel.prepare(message);
-
                 OutputStream out = message.getContent(OutputStream.class);
-                assertNotNull(out);
-                InputStream in = message.getContent(InputStream.class);
-                assertNotNull(in);
-                
+                assertNotNull(out);                             
                 copy(in, out, 1024);
-
                 out.close();
-                in.close();
+                in.close();                
+                backChannel.close(message);
+                
             } catch (Exception e) {
                 e.printStackTrace();
             }
@@ -135,6 +119,7 @@
     class TestMessageObserver implements MessageObserver {
         ByteArrayOutputStream response = new ByteArrayOutputStream();
         boolean written;
+        Message inMessage;
         
         public synchronized ByteArrayOutputStream getResponseStream() throws Exception {
             if (!written) {
@@ -148,6 +133,7 @@
             try {
                 message.remove(LocalConduit.DIRECT_DISPATCH);
                 copy(message.getContent(InputStream.class), response, 1024);
+                inMessage = message;
             } catch (IOException e) {
                 e.printStackTrace();
                 fail();

Modified: incubator/cxf/branches/jliu/rt/ws/addr/src/main/resources/schemas/ws-addr-conf.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/addr/src/main/resources/schemas/ws-addr-conf.xsd?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/addr/src/main/resources/schemas/ws-addr-conf.xsd (original)
+++ incubator/cxf/branches/jliu/rt/ws/addr/src/main/resources/schemas/ws-addr-conf.xsd Thu Oct 25 10:09:20 2007
@@ -28,6 +28,7 @@
     <xs:element name="addressing">
         <xs:complexType>
            <xs:attribute name="allowDuplicates" type="xs:boolean"/>
+           <xs:attribute name="usingAddressingAdvisory" type="xs:boolean"/>
         </xs:complexType>
     </xs:element>
     

Modified: incubator/cxf/branches/jliu/rt/ws/policy/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/pom.xml (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/pom.xml Thu Oct 25 10:09:20 2007
@@ -31,13 +31,10 @@
     </parent>
 
     <dependencies>
-        <dependency>
-            <groupId>org.apache.ws.commons.neethi</groupId>
-            <artifactId>neethi</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>javax.xml.ws</groupId>
-            <artifactId>jaxws-api</artifactId>
+        
+    <dependency>
+        <groupId>javax.xml.ws</groupId>
+        <artifactId>jaxws-api</artifactId>
 	</dependency>
 	<dependency>
 	    <groupId>org.apache.geronimo.specs</groupId>

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java Thu Oct 25 10:09:20 2007
@@ -32,6 +32,7 @@
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.spring.MapProvider;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.extension.RegistryImpl;
 import org.apache.neethi.Assertion;
@@ -50,11 +51,14 @@
     private List<QName> ignored = new ArrayList<QName>(IGNORED_CACHE_SIZE);
     
     public AssertionBuilderRegistryImpl() {
-        this(null);
+        super(null);
     }
 
     public AssertionBuilderRegistryImpl(Map<QName, AssertionBuilder> builders) {
         super(builders);
+    }
+    public AssertionBuilderRegistryImpl(MapProvider<QName, AssertionBuilder> builders) {
+        super(builders.createMap());
     }
 
     public Class<?> getRegistrationType() {

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java Thu Oct 25 10:09:20 2007
@@ -26,6 +26,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.configuration.spring.MapProvider;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.extension.RegistryImpl;
 import org.apache.cxf.interceptor.Interceptor;
@@ -39,11 +40,14 @@
     implements PolicyInterceptorProviderRegistry, BusExtension {
 
     public PolicyInterceptorProviderRegistryImpl() {
-        this(null);
+        super(null);
     }
 
     public PolicyInterceptorProviderRegistryImpl(Map<QName, PolicyInterceptorProvider> interceptors) {
         super(interceptors);
+    }    
+    public PolicyInterceptorProviderRegistryImpl(MapProvider<QName, PolicyInterceptorProvider> interceptors) {
+        super(interceptors.createMap());
     }    
 
     public Class<?> getRegistrationType() {

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java Thu Oct 25 10:09:20 2007
@@ -28,6 +28,7 @@
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.configuration.spring.MapProvider;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.extension.RegistryImpl;
 import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
@@ -42,11 +43,14 @@
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AssertionBuilderRegistry.class);
     
     public DomainExpressionBuilderRegistry() {
-        this(null);
+        super(null);
     }
 
     public DomainExpressionBuilderRegistry(Map<QName, DomainExpressionBuilder> builders) {
         super(builders);
+    }
+    public DomainExpressionBuilderRegistry(MapProvider<QName, DomainExpressionBuilder> builders) {
+        super(builders.createMap());
     }
     
     public Class<?> getRegistrationType() {

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/main/resources/META-INF/spring.handlers
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/main/resources/META-INF/spring.handlers?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/main/resources/META-INF/spring.handlers (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/main/resources/META-INF/spring.handlers Thu Oct 25 10:09:20 2007
@@ -19,5 +19,6 @@
 #
 #
 http\://cxf.apache.org/policy=org.apache.cxf.ws.policy.spring.NamespaceHandler
+http\://www.w3.org/ns/ws-policy=org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler
 http\://www.w3.org/2006/07/ws-policy=org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler
-http\://schemas.xmlsoap.org/ws/2004/09/policy=org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler
\ No newline at end of file
+http\://schemas.xmlsoap.org/ws/2004/09/policy=org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/main/resources/META-INF/spring.schemas?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/main/resources/META-INF/spring.schemas (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/main/resources/META-INF/spring.schemas Thu Oct 25 10:09:20 2007
@@ -18,6 +18,7 @@
 #    under the License.
 #
 #
+http\://www.w3.org/2007/02/ws-policy.xsd=schemas/ws-policy-200702.xsd
 http\://www.w3.org/2006/07/ws-policy.xsd=schemas/ws-policy-200607.xsd
 http\://schemas.xmlsoap.org/ws/2004/09/policy/ws-policy.xsd=schemas/ws-policy-200409.xsd
 http\://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd=schemas/oasis-200401-wss-wssecurity-secext-1.0.xsd

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java Thu Oct 25 10:09:20 2007
@@ -53,7 +53,7 @@
     public void testNormalise() throws Exception {
         Bus bus = control.createMock(Bus.class);
         PolicyConstants constants = new PolicyConstants();
-        constants.setNamespace("http://schemas.xmlsoap.org/ws/2004/09/policy");
+        constants.setNamespace(PolicyConstants.NAMESPACE_XMLSOAP_200409);
         EasyMock.expect(bus.getExtension(PolicyConstants.class)).andReturn(constants).anyTimes();
         control.replay();
         PolicyBuilderImpl builder = new PolicyBuilderImpl();

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java Thu Oct 25 10:09:20 2007
@@ -36,6 +36,7 @@
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.ws.policy.PolicyBuilder;
+import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyException;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.neethi.Assertion;
@@ -48,6 +49,7 @@
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.UrlResource;
 
+
 /**
  * 
  */
@@ -187,7 +189,12 @@
     
     @Test
     public void testReadDocumentUnknownDomainExpression() throws MalformedURLException {
+
+        PolicyConstants pc = new PolicyConstants();
+        pc.setNamespace(PolicyConstants.NAMESPACE_W3_200607);
         Bus bus = control.createMock(Bus.class);
+        EasyMock.expect(bus.getExtension(PolicyConstants.class)).andReturn(pc);
+        
         eap = new ExternalAttachmentProvider(bus);
         DomainExpressionBuilderRegistry debr = control.createMock(DomainExpressionBuilderRegistry.class);
         EasyMock.expect(bus.getExtension(DomainExpressionBuilderRegistry.class)).andReturn(debr);
@@ -209,7 +216,9 @@
     
     @Test
     public void testReadDocumentEPRDomainExpression() throws MalformedURLException {
+        
         Bus bus = control.createMock(Bus.class);
+        
         eap = new ExternalAttachmentProvider(bus);
         DomainExpressionBuilderRegistry debr = control.createMock(DomainExpressionBuilderRegistry.class);
         EasyMock.expect(bus.getExtension(DomainExpressionBuilderRegistry.class)).andReturn(debr);

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/attachments4.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/attachments4.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/attachments4.xml (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/attachments4.xml Thu Oct 25 10:09:20 2007
@@ -17,7 +17,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<attachments xmlns:wsp="http://www.w3.org/2006/07/ws-policy" xmlns:test="http://x.y.z/Assertions">
+<attachments xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:test="http://x.y.z/Assertions">
     <wsp:PolicyAttachment>
         <wsp:AppliesTo>
             <wsa:EndpointReferenceType xmlns:wsa="http://www.w3.org/2005/08/addressing">

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java Thu Oct 25 10:09:20 2007
@@ -118,8 +118,19 @@
     }
     
     @Test
-    public void testRemoteReferenceResolver() {
+    public void testRemoteReferenceResolverWithOlderNs() {
         
+        doTestRemoteResolver(PolicyConstants.NAMESPACE_W3_200607);
+    }
+    
+    @Test
+    public void testRemoteReferenceResolverWithDefaultNs() {
+        doTestRemoteResolver(PolicyConstants.NAMESPACE_WS_POLICY);
+    }
+    
+    private void doTestRemoteResolver(String policyNs) {
+        
+        constants.setNamespace(policyNs);
         URL url = ReferenceResolverTest.class.getResource("referring.wsdl");
         String baseURI = url.toString();
         PolicyBuilder builder = control.createMock(PolicyBuilder.class);
@@ -132,6 +143,7 @@
         
         control.replay();
         assertSame(p, resolver.resolveReference("referred.wsdl#PolicyA"));
-        control.verify();   
+        control.verify(); 
+        control.reset();
     }
 }

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/referred.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/referred.wsdl?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/referred.wsdl (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/referred.wsdl Thu Oct 25 10:09:20 2007
@@ -26,8 +26,18 @@
     xmlns:x1="http://apache.org/cxf/calculator/types"
     xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
     xmlns:ta="http://cxf.apache.org/test/assertions"
-    xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
+    xmlns:wsp2006="http://www.w3.org/2006/07/ws-policy"
+    xmlns:wsp="http://www.w3.org/ns/ws-policy"
     xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >
+    
+    <wsp2006:Policy wsu:Id="PolicyA">
+        <ta:A>A</ta:A>
+        <ta:B>B></ta:B>
+    </wsp2006:Policy>
+    
+    <wsp2006:Policy wsu:Id="PolicyC">
+        <ta:C>C</ta:C>
+    </wsp2006:Policy>
     
     <wsp:Policy wsu:Id="PolicyA">
         <ta:A>A</ta:A>

Modified: incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java Thu Oct 25 10:09:20 2007
@@ -53,7 +53,7 @@
         assertEquals(MaximalAlternativeSelector.class.getName(), 
                      pe.getAlternativeSelector().getClass().getName()); 
         
-        assertEquals("http://www.w3.org/ns/ws-policy",
+        assertEquals(PolicyConstants.NAMESPACE_WS_POLICY,
                      bus.getExtension(PolicyConstants.class).getNamespace());
         
         PolicyEngineImpl pei = (PolicyEngineImpl)pe;

Modified: incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Thu Oct 25 10:09:20 2007
@@ -78,7 +78,7 @@
     private SequenceIdentifierGenerator idGenerator;
     private RetransmissionQueue retransmissionQueue;
     private Map<Endpoint, RMEndpoint> reliableEndpoints = new HashMap<Endpoint, RMEndpoint>();
-    private Timer timer = new Timer(true);
+    private Timer timer = new Timer("RMManager-Timer-" + System.identityHashCode(this), true);
     private RMAssertion rmAssertion;
     private DeliveryAssuranceType deliveryAssurance;
     private SourcePolicyType sourcePolicy;
@@ -87,7 +87,7 @@
     // ServerLifeCycleListener
     
     public void startServer(Server server) {
-        recoverReliableEndpoint(server.getEndpoint(), null);
+        recoverReliableEndpoint(server.getEndpoint(), (Conduit)null);
     }
 
     public void stopServer(Server server) {
@@ -97,6 +97,17 @@
     // ClientLifeCycleListener
     
     public void clientCreated(Client client) {
+        if (null == store || null == retransmissionQueue) {
+            return;
+        }        
+        String id = RMUtils.getEndpointIdentifier(client.getEndpoint());
+        
+        Collection<SourceSequence> sss = store.getSourceSequences(id);
+        if (null == sss || 0 == sss.size()) {                        
+            return;
+        }
+        LOG.log(Level.FINE, "Number of source sequences: {0}", sss.size());
+        
         recoverReliableEndpoint(client.getEndpoint(), client.getConduit());
     }
     
@@ -372,7 +383,6 @@
         LOG.log(Level.FINE, "Number of source sequences: {0}", sss.size());
         
         RMEndpoint rme = null;
-        
         for (SourceSequence ss : sss) {            
  
             Collection<RMMessage> ms = store.getMessages(ss.getIdentifier(), true);

Modified: incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMMessageConstants.java Thu Oct 25 10:09:20 2007
@@ -39,8 +39,8 @@
     public static final String ORIGINAL_REQUESTOR_ROLE =
         "org.apache.cxf.client.original";
     
-    public static final String SAVED_OUTPUT_STREAM =
-        "org.apache.cxf.ws.rm.outputstream";
+    public static final String SAVED_CONTENT =
+        "org.apache.cxf.ws.rm.content";
     
     /**
      * Prevents instantiation. 

Modified: incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java Thu Oct 25 10:09:20 2007
@@ -19,8 +19,7 @@
 
 package org.apache.cxf.ws.rm;
 
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
+import java.io.IOException;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
@@ -48,34 +47,36 @@
         manager = mgr;
     }
     public void onClose(CachedOutputStream cos) {
-        OutputStream os = cos.getOut();
    
-        if (os instanceof ByteArrayOutputStream) {
-            ByteArrayOutputStream bos = (ByteArrayOutputStream)os;
-            message.put(RMMessageConstants.SAVED_OUTPUT_STREAM, bos);  
-            manager.getRetransmissionQueue().addUnacknowledged(message);
-            
-            RMStore store = manager.getStore();
-            if (null != store) {
-                Source s = manager.getSource(message);
-                RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
-                Identifier sid = rmps.getSequence().getIdentifier();
-                SourceSequence ss = s.getSequence(sid);
-                RMMessage msg = new RMMessage();
-                msg.setMessageNumber(rmps.getSequence().getMessageNumber());
-                if (!MessageUtils.isRequestor(message)) {
-                    AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, true);
-                    if (null != maps && null != maps.getTo()) {
-                        msg.setTo(maps.getTo().getValue());
-                    }
-                }
-                msg.setContent(bos.toByteArray());
-                store.persistOutgoing(ss, msg); 
-            }
-        } else {
+        //REVISIT - would be nice to keep the cache on disk intead of in-memory 
+        byte bytes[] = null;
+        try {
+            bytes = cos.getBytes();
+        } catch (IOException e) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("NO_CACHED_STREAM", 
                                                                    LOG, 
-                                                                   os.getClass()));
+                                                                   cos.getOut().getClass()));
+        }
+        
+        message.put(RMMessageConstants.SAVED_CONTENT, bytes);            
+        manager.getRetransmissionQueue().addUnacknowledged(message);
+        
+        RMStore store = manager.getStore();
+        if (null != store) {
+            Source s = manager.getSource(message);
+            RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
+            Identifier sid = rmps.getSequence().getIdentifier();
+            SourceSequence ss = s.getSequence(sid);
+            RMMessage msg = new RMMessage();
+            msg.setMessageNumber(rmps.getSequence().getMessageNumber());
+            if (!MessageUtils.isRequestor(message)) {
+                AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, true);
+                if (null != maps && null != maps.getTo()) {
+                    msg.setTo(maps.getTo().getValue());
+                }
+            }
+            msg.setContent(bytes);
+            store.persistOutgoing(ss, msg); 
         }
     }
 

Modified: incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java Thu Oct 25 10:09:20 2007
@@ -20,7 +20,6 @@
 package org.apache.cxf.ws.rm.soap;
 
 import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.math.BigInteger;
@@ -40,6 +39,7 @@
 import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.DeferredConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.io.CachedOutputStreamCallback;
 import org.apache.cxf.message.Message;
@@ -327,20 +327,22 @@
                     }
                 }
             }
-            ByteArrayOutputStream savedOutputStream = (ByteArrayOutputStream)message
-                .get(RMMessageConstants.SAVED_OUTPUT_STREAM);
-            byte[] content = null;
-            if (null == savedOutputStream) {                
+            byte[] content = (byte[])message
+                .get(RMMessageConstants.SAVED_CONTENT);
+            if (null == content) {                
                 content = message.getContent(byte[].class); 
-                LOG.fine("Using saved byte array: " + content);
+                if (LOG.isLoggable(Level.FINE)) {
+                    LOG.fine("Using saved byte array: " + content);
+                }
             } else {
-                content = savedOutputStream.toByteArray();
-                LOG.fine("Using saved output stream: " + savedOutputStream);
+                if (LOG.isLoggable(Level.FINE)) {
+                    LOG.fine("Using saved output stream: " + new String(content));
+                }
             }
             ByteArrayInputStream bis = new ByteArrayInputStream(content);
 
             // copy saved output stream to new output stream in chunks of 1024
-            CachedOutputStream.copyStream(bis, os, 1024);
+            IOUtils.copyAndCloseInput(bis, os);
             os.flush();
             os.close();
         } catch (IOException ex) {

Modified: incubator/cxf/branches/jliu/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java Thu Oct 25 10:09:20 2007
@@ -136,7 +136,7 @@
         Server s = control.createMock(Server.class);
         Endpoint e = control.createMock(Endpoint.class);
         EasyMock.expect(s.getEndpoint()).andReturn(e);
-        manager.recoverReliableEndpoint(e, null);
+        manager.recoverReliableEndpoint(e, (Conduit)null);
         EasyMock.expectLastCall();
         control.replay();
         manager.startServer(s);
@@ -164,12 +164,15 @@
             .getDeclaredMethod("recoverReliableEndpoint", new Class[] {Endpoint.class, Conduit.class});
         manager = control.createMock(RMManager.class, new Method[] {m});
         Client client = control.createMock(Client.class);
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        EasyMock.expect(client.getEndpoint()).andReturn(endpoint);
-        Conduit conduit = control.createMock(Conduit.class);
-        EasyMock.expect(client.getConduit()).andReturn(conduit);
-        manager.recoverReliableEndpoint(endpoint, conduit);
-        EasyMock.expectLastCall();
+        
+        //none of this is called if no store
+        
+        //Endpoint endpoint = control.createMock(Endpoint.class);
+        //EasyMock.expect(client.getEndpoint()).andReturn(endpoint);
+        //Conduit conduit = control.createMock(Conduit.class);
+        //EasyMock.expect(client.getConduit()).andReturn(conduit).anyTimes();
+        //manager.recoverReliableEndpoint(endpoint, conduit);
+        //EasyMock.expectLastCall();
         control.replay();
         manager.clientCreated(client);
         control.verify();

Modified: incubator/cxf/branches/jliu/rt/ws/security/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/security/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/security/pom.xml (original)
+++ incubator/cxf/branches/jliu/rt/ws/security/pom.xml Thu Oct 25 10:09:20 2007
@@ -83,7 +83,6 @@
         <dependency>
             <groupId>bouncycastle</groupId>
             <artifactId>bcprov-jdk14</artifactId>
-            <version>136</version>
             <scope>runtime</scope>
         </dependency>
 

Modified: incubator/cxf/branches/jliu/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java Thu Oct 25 10:09:20 2007
@@ -63,7 +63,10 @@
     public static final String SIGNATURE_RESULT = "wss4j.signature.result";
 
     private static final Logger LOG = LogUtils.getL7dLogger(WSS4JInInterceptor.class);
-    private static final Logger TIME_LOG = Logger.getLogger(WSS4JInInterceptor.class.getName() + "-Time");
+    private static final Logger TIME_LOG = LogUtils.getL7dLogger(WSS4JInInterceptor.class,
+                                                                 null,
+                                                                 WSS4JInInterceptor.class.getName()
+                                                                     + "-Time");
     
     public WSS4JInInterceptor() {
         super();

Modified: incubator/cxf/branches/jliu/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java (original)
+++ incubator/cxf/branches/jliu/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java Thu Oct 25 10:09:20 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.phase.Phase;
 import org.apache.ws.security.WSConstants;
@@ -40,11 +41,13 @@
 import org.apache.ws.security.util.WSSecurityUtil;
 
 public class WSS4JOutInterceptor extends AbstractWSS4JInterceptor {
-    private static final Logger LOG = Logger
-            .getLogger(WSS4JOutInterceptor.class.getName());
+    private static final Logger LOG = LogUtils
+            .getL7dLogger(WSS4JOutInterceptor.class);
 
-    private static final Logger TIME_LOG = Logger
-            .getLogger(WSS4JOutInterceptor.class.getName() + "-Time");
+    private static final Logger TIME_LOG = LogUtils
+            .getL7dLogger(WSS4JOutInterceptor.class,
+                          null,
+                          WSS4JOutInterceptor.class.getName() + "-Time");
 
     public WSS4JOutInterceptor() {
         super();

Modified: incubator/cxf/branches/jliu/rt/ws/security/src/test/java/META-INF/cxf/request.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/security/src/test/java/META-INF/cxf/request.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/security/src/test/java/META-INF/cxf/request.xml (original)
+++ incubator/cxf/branches/jliu/rt/ws/security/src/test/java/META-INF/cxf/request.xml Thu Oct 25 10:09:20 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
 <soapenv:Envelope xmlns="http://somenamespace.pl"
 	xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 	xmlns:xsd="http://www.w3.org/2001/XMLSchema"

Modified: incubator/cxf/branches/jliu/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/in_enc.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/in_enc.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/in_enc.xml (original)
+++ incubator/cxf/branches/jliu/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/in_enc.xml Thu Oct 25 10:09:20 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soap:Header>
 <wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">