cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r501019 - in /incubator/cxf/trunk/rt: transports/http/src/main/java/org/apache/cxf/transport/http/ transports/http/src/test/java/org/apache/cxf/transport/http/ transports/http2/src/main/java/org/apache/cxf/transport/http/ transports/http2/s...
Date Mon, 29 Jan 2007 11:51:42 GMT
Author: eglynn
Date: Mon Jan 29 03:51:40 2007
New Revision: 501019

URL: http://svn.apache.org/viewvc?view=rev&rev=501019
Log:
Factored out common Conduit and Destination logic into abstract base
classes, allowing non-decoupled transports to be written without any
regard for the back-channel or partial response logic.

Modified:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
    incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Mon Jan 29 03:51:40 2007
@@ -25,10 +25,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Logger;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
@@ -37,8 +35,8 @@
 import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.AbstractDestination;
 import org.apache.cxf.transport.ConduitInitiator;
-import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.http.destination.HTTPDestinationConfigBean;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.AttributedURIType;
@@ -48,16 +46,13 @@
 /**
  * Common base for HTTP Destination implementations.
  */
-public abstract class AbstractHTTPDestination extends HTTPDestinationConfigBean 
-    implements Destination, Configurable {
-    static final Logger LOG = LogUtils.getL7dLogger(AbstractHTTPDestination.class);
+public abstract class AbstractHTTPDestination extends AbstractDestination {
     
     private static final long serialVersionUID = 1L;
 
     protected final Bus bus;
     protected final ConduitInitiator conduitInitiator;
-    protected final EndpointInfo endpointInfo;
-    protected final EndpointReferenceType reference;
+    protected HTTPDestinationConfigBean config;
     protected String name;
     protected URL nurl;
 
@@ -73,37 +68,19 @@
                                    ConduitInitiator ci,
                                    EndpointInfo ei)
         throws IOException {
+        super(new EndpointReferenceType(), ei);
         bus = b;
         conduitInitiator = ci;
-        endpointInfo = ei;
-        
-        setServer(endpointInfo.getTraversedExtensor(new HTTPServerPolicy(), HTTPServerPolicy.class));
         
+        initConfig();
+ 
         nurl = new URL(getAddressValue());
         name = nurl.getPath();
 
-        reference = new EndpointReferenceType();
         AttributedURIType address = new AttributedURIType();
         address.setValue(getAddressValue());
         reference.setAddress(address);
     }
-    
-    public String getBeanName() {
-        String beanName = null;
-        if (endpointInfo.getName() != null) {
-            beanName = endpointInfo.getName().toString() + ".http-destination";
-        }
-        return beanName;
-    }
-
-
-
-    /**
-     * @return the reference associated with this Destination
-     */    
-    public EndpointReferenceType getAddress() {
-        return reference;
-    }
 
     /**
      * Cache HTTP headers in message.
@@ -172,8 +149,13 @@
         return StringUtils.addDefaultPortIfMissing(endpointInfo.getAddress());
     }        
 
+    private void initConfig() {
+        config = new ConfigBean();
+        config.setServer(endpointInfo.getTraversedExtensor(new HTTPServerPolicy(), HTTPServerPolicy.class));
+    }
+
     void setPolicies(Map<String, List<String>> headers) {
-        HTTPServerPolicy policy = getServer(); 
+        HTTPServerPolicy policy = config.getServer(); 
         if (policy.isSetCacheControl()) {
             headers.put("Cache-Control",
                         Arrays.asList(new String[] {policy.getCacheControl().value()}));
@@ -207,6 +189,16 @@
     }
 
     boolean contextMatchOnExact() {
-        return "exact".equals(getContextMatchStrategy());
+        return "exact".equals(config.getContextMatchStrategy());
     }    
+
+    private class ConfigBean extends HTTPDestinationConfigBean implements Configurable {
+        public String getBeanName() {
+            String beanName = null;
+            if (endpointInfo.getName() != null) {
+                beanName = endpointInfo.getName().toString() + ".http-destination";
+            }
+            return beanName;
+        }
+    }
 }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Mon Jan 29 03:51:40 2007
@@ -34,7 +34,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
@@ -49,6 +48,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.AbstractConduit;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
@@ -66,24 +66,19 @@
 /**
  * HTTP Conduit implementation.
  */
-public class HTTPConduit extends HTTPConduitConfigBean implements Conduit, Configurable {
+public class HTTPConduit extends AbstractConduit {
+    
+    static {
+        log = LogUtils.getL7dLogger(HTTPConduit.class);
+    }
 
     public static final String HTTP_CONNECTION = "http.connection";
-    
-    /**
-     * REVISIT: temporary mechanism to allow decoupled response endpoint
-     * to be configured, pending the maturation on the real config model
-     */
-    public static final String HTTP_DECOUPLED_ENDPOINT =
-        "http.decoupled.endpoint";
-    
-    private static final Logger LOG = LogUtils.getL7dLogger(HTTPConduit.class);
+        
     private final Bus bus;
+    private HTTPConduitConfigBean config;
     private final URLConnectionFactory alternateConnectionFactory;
     private URLConnectionFactory connectionFactory;
     private URL url;
-    private MessageObserver incomingObserver;
-    private EndpointReferenceType target;
     
     private ServerEngine decoupledEngine;
     private URL decoupledURL;
@@ -136,42 +131,36 @@
                        EndpointReferenceType t,
                        URLConnectionFactory factory,
                        ServerEngine eng) throws IOException {
+        super(getTargetReference(ei, t));
         bus = b;
         endpointInfo = ei;
         alternateConnectionFactory = factory;
-        
-        init();
+
+        initConfig();
         
         decoupledEngine = eng;
         url = t == null
-              ? new URL(getAddress())
+              ? new URL(endpointInfo.getAddress())
               : new URL(t.getAddress().getValue());
-        target = getTargetReference(t);
     }
 
+    /**
+     * Post-configure retreival of connection factory.
+     */
     protected void retrieveConnectionFactory() {
         connectionFactory = alternateConnectionFactory != null
                             ? alternateConnectionFactory
-                            : HTTPTransportFactory.getConnectionFactory(sslClient);
-    }
-    
-    public String getBeanName() {
-        if (endpointInfo.getName() != null) {
-            return endpointInfo.getName().toString() + ".http-conduit";
-        }
-        return null;
+                            : HTTPTransportFactory.getConnectionFactory(
+                                  config.getSslClient());
     }
     
     /**
-     * Register a message observer for incoming messages.
-     * 
-     * @param observer the observer to notify on receipt of incoming
+     * @return the encapsulated config bean
      */
-    public void setMessageObserver(MessageObserver observer) {
-        incomingObserver = observer;
-        LOG.info("registering incoming observer: " + incomingObserver);
+    protected HTTPConduitConfigBean getConfig() {
+        return config;
     }
-
+        
     /**
      * Send an outbound message.
      * 
@@ -184,8 +173,8 @@
             connectionFactory.createConnection(getProxy(), currentURL);
         connection.setDoOutput(true);        
         //TODO using Message context to deceided HTTP send properties        
-        connection.setConnectTimeout((int)getClient().getConnectionTimeout());
-        connection.setReadTimeout((int)getClient().getReceiveTimeout());
+        connection.setConnectTimeout((int)config.getClient().getConnectionTimeout());
+        connection.setReadTimeout((int)config.getClient().getReceiveTimeout());
         connection.setUseCaches(false);
         
         if (connection instanceof HttpURLConnection) {
@@ -196,13 +185,14 @@
             } else {
                 hc.setRequestMethod("POST");
             }
-            if (getClient().isAutoRedirect()) {
+            if (config.getClient().isAutoRedirect()) {
                 //cannot use chunking if autoredirect as the request will need to be
                 //completely cached locally and resent to the redirect target
                 hc.setInstanceFollowRedirects(true);
             } else {
                 hc.setInstanceFollowRedirects(false);
-                if (!hc.getRequestMethod().equals("GET") && client.isAllowChunking()) {
+                if (!hc.getRequestMethod().equals("GET")
+                        && config.getClient().isAllowChunking()) {
                     hc.setChunkedStreamingMode(2048);
                 }
             }
@@ -230,32 +220,21 @@
         return new URL(result);    
     }
     
-   
-    /**
-     * @return the reference associated with the target Destination
-     */    
-    public EndpointReferenceType getTarget() {
-        return target;
-    }
-    
     /**
      * Retreive the back-channel Destination.
      * 
      * @return the backchannel Destination (or null if the backchannel is
      * built-in)
      */
+    @Override
     public synchronized Destination getBackChannel() {
         if (decoupledDestination == null
-            && getConfiguredDecoupledEndpoint() != null) {
+            && config.getClient().getDecoupledEndpoint() != null) {
             decoupledDestination = setUpDecoupledDestination(); 
         }
         return decoupledDestination;
     }
     
-    public void close(Message msg) throws IOException {
-        msg.getContent(OutputStream.class).close();        
-    }
-
     /**
      * Close the conduit
      */
@@ -292,18 +271,19 @@
     }
     
     /**
-     * Get the target reference which may be constructor-provided or 
-     * configured.
+     * Get the target reference .
      * 
+     * @param ei the corresponding EndpointInfo
      * @param t the constructor-provider target
      * @return the actual target
      */
-    private EndpointReferenceType getTargetReference(EndpointReferenceType t) {
+    private static EndpointReferenceType getTargetReference(EndpointInfo ei,
+                                                            EndpointReferenceType t) {
         EndpointReferenceType ref = null;
         if (null == t) {
             ref = new EndpointReferenceType();
             AttributedURIType address = new AttributedURIType();
-            address.setValue(getAddress());
+            address.setValue(ei.getAddress());
             ref.setAddress(address);
         } else {
             ref = t;
@@ -382,10 +362,11 @@
      */
     private DecoupledDestination setUpDecoupledDestination() {        
         EndpointReferenceType reference =
-            EndpointReferenceUtils.getEndpointReference(getConfiguredDecoupledEndpoint());
+            EndpointReferenceUtils.getEndpointReference(
+                config.getClient().getDecoupledEndpoint());
         if (reference != null) {
             String decoupledAddress = reference.getAddress().getValue();
-            LOG.info("creating decoupled endpoint: " + decoupledAddress);
+            log.info("creating decoupled endpoint: " + decoupledAddress);
             try {
                 decoupledURL = new URL(decoupledAddress);
                 if (decoupledEngine == null) {
@@ -403,23 +384,13 @@
                 decoupledHandler.duplicate();
             } catch (Exception e) {
                 // REVISIT move message to localizable Messages.properties
-                LOG.log(Level.WARNING, "decoupled endpoint creation failed: ", e);
+                log.log(Level.WARNING, "decoupled endpoint creation failed: ", e);
             }
         }
         return new DecoupledDestination(reference, incomingObserver);
     }
     
     /**
-     * REVISIT: temporary mechanism to allow decoupled response endpoint
-     * to be configured, pending the maturation on the real config model
-     */
-    private String getConfiguredDecoupledEndpoint() {
-        return getClient().getDecoupledEndpoint() != null
-               ? getClient().getDecoupledEndpoint()
-               : System.getProperty(HTTP_DECOUPLED_ENDPOINT);
-    }
-
-    /**
      * Wrapper output stream responsible for flushing headers and handling
      * the incoming HTTP-level response (not necessarily the MEP response).
      */
@@ -622,22 +593,19 @@
         }
     }    
 
-    private void init() {
+    private void initConfig() {
+        config = new ConfigBean();
         // Initialize some default values for the configuration
-        setClient(endpointInfo.getTraversedExtensor(new HTTPClientPolicy(), HTTPClientPolicy.class));
-        setAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(), 
-                                                           AuthorizationPolicy.class));
-        setProxyAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(), 
-                                                                AuthorizationPolicy.class));
-    }
-
-    private String getAddress() {
-        return endpointInfo.getAddress();
+        config.setClient(endpointInfo.getTraversedExtensor(new HTTPClientPolicy(), HTTPClientPolicy.class));
+        config.setAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(), 
+                                                                  AuthorizationPolicy.class));
+        config.setProxyAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(), 
+                                                                       AuthorizationPolicy.class));
     }
 
     private Proxy getProxy() {
         Proxy proxy = null;
-        HTTPClientPolicy policy = getClient(); 
+        HTTPClientPolicy policy = config.getClient(); 
         if (policy.isSetProxyServer()) {
             proxy = new Proxy(Proxy.Type.valueOf(policy.getProxyServerType().toString()),
                               new InetSocketAddress(policy.getProxyServer(),
@@ -647,7 +615,7 @@
     }
 
     private void setPolicies(Message message, Map<String, List<String>> headers) {
-        AuthorizationPolicy authPolicy = getAuthorization();
+        AuthorizationPolicy authPolicy = config.getAuthorization();
         AuthorizationPolicy newPolicy = message.get(AuthorizationPolicy.class);
         String userName = (String)message.get(Message.USERNAME);
         String passwd = (String)message.get(Message.PASSWORD);
@@ -676,7 +644,7 @@
             headers.put("Authorization",
                         Arrays.asList(new String[] {type}));
         }
-        AuthorizationPolicy proxyAuthPolicy = getProxyAuthorization();
+        AuthorizationPolicy proxyAuthPolicy = config.getProxyAuthorization();
         if (proxyAuthPolicy.isSetUserName()) {
             userName = proxyAuthPolicy.getUserName();
             if (userName != null) {
@@ -699,7 +667,7 @@
                             Arrays.asList(new String[] {type}));
             }
         }
-        HTTPClientPolicy policy = getClient();
+        HTTPClientPolicy policy = config.getClient();
         if (policy.isSetCacheControl()) {
             headers.put("Cache-Control",
                         Arrays.asList(new String[] {policy.getCacheControl().value()}));
@@ -740,5 +708,14 @@
             headers.put("Referer",
                         Arrays.asList(new String[] {policy.getReferer()}));
         }
+    }
+
+    private class ConfigBean extends HTTPConduitConfigBean implements Configurable {
+        public String getBeanName() {
+            if (endpointInfo.getName() != null) {
+                return endpointInfo.getName().toString() + ".http-conduit";
+            }
+            return null;
+        }        
     }
 }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java Mon Jan 29 03:51:40 2007
@@ -109,14 +109,14 @@
     public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws IOException {
         HTTPConduit conduit = target == null
             ? new HTTPConduit(bus, endpointInfo) : new HTTPConduit(bus, endpointInfo, target);
-        configure(conduit);
+        configure(conduit.getConfig());
         conduit.retrieveConnectionFactory();
         return conduit;
     }
 
     public Destination getDestination(EndpointInfo endpointInfo) throws IOException {
         JettyHTTPDestination destination = new JettyHTTPDestination(bus, this, endpointInfo);
-        configure(destination);
+        configure(destination.getConfig());
         destination.retrieveEngine();
         return destination;
     }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java Mon Jan 29 03:51:40 2007
@@ -36,6 +36,7 @@
 import javax.wsdl.xml.WSDLWriter;
 
 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.io.AbstractWrappedOutputStream;
@@ -47,6 +48,7 @@
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.http.destination.HTTPDestinationConfigBean;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
@@ -56,6 +58,10 @@
 
 public class JettyHTTPDestination extends AbstractHTTPDestination {
 
+    static {
+        log = LogUtils.getL7dLogger(JettyHTTPDestination.class);
+    }
+    
     public static final String HTTP_REQUEST = JettyHTTPDestination.class.getName() + ".REQUEST";
     public static final String HTTP_RESPONSE = JettyHTTPDestination.class.getName() + ".RESPONSE";
 
@@ -63,7 +69,6 @@
 
     protected ServerEngine engine;
     protected ServerEngine alternateEngine;
-    protected MessageObserver incomingObserver;
 
     /**
      * Constructor, using Jetty server engine.
@@ -86,56 +91,100 @@
      * @param eng the server engine
      * @throws IOException
      */
-
     public JettyHTTPDestination(Bus b, ConduitInitiator ci, EndpointInfo endpointInfo, ServerEngine eng)
         throws IOException {
         super(b, ci, endpointInfo);
         alternateEngine = eng;
     }
 
+    /**
+     * Post-configure retreival of server engine.
+     */
     protected void retrieveEngine() {
         engine = alternateEngine != null
                  ? alternateEngine
-                 : JettyHTTPServerEngine.getForPort(bus, nurl.getProtocol(), nurl.getPort(), sslServer);
+                 : JettyHTTPServerEngine.getForPort(bus,
+                                                    nurl.getProtocol(),
+                                                    nurl.getPort(),
+                                                    config.getSslServer());
+    }
+    
+    /**
+     * @return the encapsulated config bean
+     */
+    protected HTTPDestinationConfigBean getConfig() {
+        return config;
     }
 
+    
     /**
-     * Register a message observer for incoming messages.
-     * 
-     * @param observer the observer to notify on receipt of incoming
+     * Activate receipt of incoming messages.
      */
-    public synchronized void setMessageObserver(MessageObserver observer) {
-        if (null != observer) {
-            LOG.info("registering incoming observer: " + observer);
-            try {
-                URL url = new URL(getAddressValue());
-                if (contextMatchOnExact()) {
-                    engine.addServant(url, new AbstractHttpHandler() {
-                        public void handle(String pathInContext, String pathParams, HttpRequest req,
-                                           HttpResponse resp) throws IOException {
-                            if (pathInContext.equals(getName())) {
-                                doService(req, resp);
-                            }
+    protected void activateIncoming() {
+        log.log(Level.INFO, "Activating receipt of incoming messages");
+        try {
+            URL url = new URL(getAddressValue());
+            if (contextMatchOnExact()) {
+                engine.addServant(url, new AbstractHttpHandler() {
+                    public void handle(String pathInContext, String pathParams, HttpRequest req,
+                                       HttpResponse resp) throws IOException {
+                        if (pathInContext.equals(getName())) {
+                            doService(req, resp);
                         }
-                    });
-                } else {
-                    engine.addServant(url, new AbstractHttpHandler() {
-                        public void handle(String pathInContext, String pathParams, HttpRequest req,
-                                           HttpResponse resp) throws IOException {                            
-                            if (pathInContext.startsWith(getName())) {
-                                doService(req, resp);
-                            }
+                    }
+                });
+            } else {
+                engine.addServant(url, new AbstractHttpHandler() {
+                    public void handle(String pathInContext, String pathParams, HttpRequest req,
+                                       HttpResponse resp) throws IOException {                            
+                        if (pathInContext.startsWith(getName())) {
+                            doService(req, resp);
                         }
-                    });
-                }
-            } catch (Exception e) {
-                LOG.log(Level.WARNING, "URL creation failed: ", e);
+                    }
+                });
             }
-        } else {
-            LOG.info("unregistering incoming observer: " + incomingObserver);
-            engine.removeServant(nurl);
+        } catch (Exception e) {
+            log.log(Level.WARNING, "URL creation failed: ", e);
         }
-        incomingObserver = observer;
+    }
+
+    /**
+     * Deactivate receipt of incoming messages.
+     */
+    protected void deactivateIncoming() {
+        log.log(Level.INFO, "Deactivating receipt of incoming messages");
+        engine.removeServant(nurl);   
+    }
+    
+    /**
+     * @param inMessage the incoming message
+     * @return the inbuilt backchannel
+     */
+    protected Conduit getInbuiltBackChannel(Message inMessage) {
+        HttpResponse response = (HttpResponse)inMessage.get(HTTP_RESPONSE);
+        return new BackChannelConduit(response);
+    }
+
+    /**
+     * Mark message as a partial message.
+     * 
+     * @param partialResponse the partial response message
+     * @param the decoupled target
+     * @return true iff partial responses are supported
+     */
+    protected boolean markPartialResponse(Message partialResponse,
+                                       EndpointReferenceType decoupledTarget) {
+        // setup the outbound message to for 202 Accepted
+        partialResponse.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_ACCEPTED);
+        partialResponse.getExchange().put(EndpointReferenceType.class, decoupledTarget);
+        return true;
+    }
+
+    /**
+     * @return the associated conduit initiator
+     */
+    protected ConduitInitiator getConduitInitiator() {
+        return conduitInitiator;
     }
 
     /**
@@ -186,12 +235,6 @@
     }
 
     /**
-     * Shutdown the Destination, i.e. stop accepting incoming messages.
-     */
-    public void shutdown() {
-    }
-
-    /**
      * Copy the request headers into the message.
      * 
      * @param message the current message
@@ -237,8 +280,8 @@
     }
 
     protected void doService(HttpRequest req, HttpResponse resp) throws IOException {
-        if (getServer().isSetRedirectURL()) {
-            resp.sendRedirect(getServer().getRedirectURL());
+        if (config.getServer().isSetRedirectURL()) {
+            resp.sendRedirect(config.getServer().getRedirectURL());
             resp.commit();
             req.setHandled(true);
             return;
@@ -271,8 +314,8 @@
     protected void serviceRequest(final HttpRequest req, final HttpResponse resp)
         throws IOException {
         try {
-            if (LOG.isLoggable(Level.INFO)) {
-                LOG.info("Service http request on thread: " + Thread.currentThread());
+            if (log.isLoggable(Level.INFO)) {
+                log.info("Service http request on thread: " + Thread.currentThread());
             }
 
             MessageImpl inMessage = new MessageImpl();
@@ -286,7 +329,7 @@
             if (!StringUtils.isEmpty(getAddressValue())) {
                 inMessage.put(Message.BASE_PATH, new URL(getAddressValue()).getPath());
             }
-            inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder());
+            inMessage.put(Message.FIXED_PARAMETER_ORDER, config.isFixedParameterOrder());
             inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE); 
             
             setHeaders(inMessage);
@@ -298,8 +341,8 @@
             resp.commit();
             req.setHandled(true);
         } finally {
-            if (LOG.isLoggable(Level.INFO)) {
-                LOG.info("Finished servicing http request on thread: " + Thread.currentThread());
+            if (log.isLoggable(Level.INFO)) {
+                log.info("Finished servicing http request on thread: " + Thread.currentThread());
             }
         }
     }
@@ -333,12 +376,12 @@
             }
         } else if (null != responseObj) {
             String m = (new org.apache.cxf.common.i18n.Message("UNEXPECTED_RESPONSE_TYPE_MSG",
-                LOG, responseObj.getClass())).toString();
-            LOG.log(Level.WARNING, m);
+                log, responseObj.getClass())).toString();
+            log.log(Level.WARNING, m);
             throw new IOException(m);   
         } else {
-            String m = (new org.apache.cxf.common.i18n.Message("NULL_RESPONSE_MSG", LOG)).toString();
-            LOG.log(Level.WARNING, m);
+            String m = (new org.apache.cxf.common.i18n.Message("NULL_RESPONSE_MSG", log)).toString();
+            log.log(Level.WARNING, m);
             throw new IOException(m);            
         }
 

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java Mon Jan 29 03:51:40 2007
@@ -43,6 +43,7 @@
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.http.conduit.HTTPConduitConfigBean;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.easymock.classextension.EasyMock;
@@ -218,13 +219,14 @@
                                               decoupledEngine);
         conduit.retrieveConnectionFactory();
 
+        HTTPConduitConfigBean config = conduit.getConfig();
         if (send) {
-            conduit.getClient().setConnectionTimeout(303030);
-            conduit.getClient().setReceiveTimeout(404040);
+            config.getClient().setConnectionTimeout(303030);
+            config.getClient().setReceiveTimeout(404040);
             if (httpConnection) {
-                conduit.getClient().setAutoRedirect(autoRedirect);
+                config.getClient().setAutoRedirect(autoRedirect);
                 if (!autoRedirect) {
-                    conduit.getClient().setAllowChunking(true);
+                    config.getClient().setAllowChunking(true);
                 } 
             }
         }
@@ -233,7 +235,7 @@
             URL decoupledURL = null;
             if (decoupled) {
                 decoupledURL = new URL(NOWHERE + "response");
-                conduit.getClient().setDecoupledEndpoint(decoupledURL.toString());
+                config.getClient().setDecoupledEndpoint(decoupledURL.toString());
             } 
         }
        

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java Mon Jan 29 03:51:40 2007
@@ -260,7 +260,7 @@
                                                              conduitInitiator,
                                                              endpointInfo,
                                                              engine);
-        assertEquals(customPolicy, dest.getServer());
+        assertEquals(customPolicy, dest.getConfig().getServer());
     }
         
     private JettyHTTPDestination setUpDestination()
@@ -288,7 +288,7 @@
                                                              endpointInfo,
                                                              engine);
         dest.retrieveEngine();
-        policy = dest.getServer();
+        policy = dest.getConfig().getServer();
         observer = new MessageObserver() {
             public void onMessage(Message m) {
                 inMessage = m;

Modified: incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Mon Jan 29 03:51:40 2007
@@ -25,10 +25,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Logger;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
@@ -38,8 +36,8 @@
 import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.AbstractDestination;
 import org.apache.cxf.transport.ConduitInitiator;
-import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.http.destination.HTTPDestinationConfigBean;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.AttributedURIType;
@@ -49,16 +47,13 @@
 /**
  * Common base for HTTP Destination implementations.
  */
-public abstract class AbstractHTTPDestination extends HTTPDestinationConfigBean 
-    implements Destination, Configurable {
-    static final Logger LOG = LogUtils.getL7dLogger(AbstractHTTPDestination.class);
+public abstract class AbstractHTTPDestination extends AbstractDestination {
     
     private static final long serialVersionUID = 1L;
 
     protected final Bus bus;
     protected final ConduitInitiator conduitInitiator;
-    protected final EndpointInfo endpointInfo;
-    protected final EndpointReferenceType reference;
+    protected HTTPDestinationConfigBean config;
     protected String name;
     protected URL nurl;
 
@@ -74,38 +69,19 @@
                                    ConduitInitiator ci,
                                    EndpointInfo ei)
         throws IOException {
+        super(new EndpointReferenceType(), ei);
         bus = b;
         conduitInitiator = ci;
-        endpointInfo = ei;
-        
-        setServer(endpointInfo.getTraversedExtensor(new HTTPServerPolicy(), HTTPServerPolicy.class));
-        setSslServer(endpointInfo.getTraversedExtensor(new SSLServerPolicy(), SSLServerPolicy.class));
         
+        initConfig();
+         
         nurl = new URL(getAddressValue());
         name = nurl.getPath();
-
-        reference = new EndpointReferenceType();
+        
         AttributedURIType address = new AttributedURIType();
         address.setValue(getAddressValue());
         reference.setAddress(address);
     }
-    
-    public String getBeanName() {
-        String beanName = null;
-        if (endpointInfo.getName() != null) {
-            beanName = endpointInfo.getName().toString() + ".http-destination";
-        }
-        return beanName;
-    }
-
-
-
-    /**
-     * @return the reference associated with this Destination
-     */    
-    public EndpointReferenceType getAddress() {
-        return reference;
-    }
 
     /**
      * Cache HTTP headers in message.
@@ -174,8 +150,14 @@
         return StringUtils.addDefaultPortIfMissing(endpointInfo.getAddress());
     }        
 
+    private void initConfig() {
+        config = new ConfigBean();
+        config.setServer(endpointInfo.getTraversedExtensor(new HTTPServerPolicy(), HTTPServerPolicy.class));
+        config.setSslServer(endpointInfo.getTraversedExtensor(new SSLServerPolicy(), SSLServerPolicy.class));
+    }
+
     void setPolicies(Map<String, List<String>> headers) {
-        HTTPServerPolicy policy = getServer(); 
+        HTTPServerPolicy policy = config.getServer(); 
         if (policy.isSetCacheControl()) {
             headers.put("Cache-Control",
                         Arrays.asList(new String[] {policy.getCacheControl().value()}));
@@ -209,6 +191,16 @@
     }
 
     boolean contextMatchOnExact() {
-        return "exact".equals(getContextMatchStrategy());
+        return "exact".equals(config.getContextMatchStrategy());
     }    
+
+    private class ConfigBean extends HTTPDestinationConfigBean implements Configurable {
+        public String getBeanName() {
+            String beanName = null;
+            if (endpointInfo.getName() != null) {
+                beanName = endpointInfo.getName().toString() + ".http-destination";
+            }
+            return beanName;
+        }
+    }
 }

Modified: incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Mon Jan 29 03:51:40 2007
@@ -34,7 +34,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -52,6 +51,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.AbstractConduit;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
@@ -68,24 +68,19 @@
 /**
  * HTTP Conduit implementation.
  */
-public class HTTPConduit extends HTTPConduitConfigBean implements Conduit, Configurable {
+public class HTTPConduit extends AbstractConduit {
+
+    static {
+        log = LogUtils.getL7dLogger(HTTPConduit.class);
+    }
 
     public static final String HTTP_CONNECTION = "http.connection";
     
-    /**
-     * REVISIT: temporary mechanism to allow decoupled response endpoint
-     * to be configured, pending the maturation on the real config model
-     */
-    public static final String HTTP_DECOUPLED_ENDPOINT =
-        "http.decoupled.endpoint";
-    
-    private static final Logger LOG = LogUtils.getL7dLogger(HTTPConduit.class);
     private final Bus bus;
+    private HTTPConduitConfigBean config;
     private final URLConnectionFactory alternateConnectionFactory;
     private URLConnectionFactory connectionFactory;
     private URL url;
-    private MessageObserver incomingObserver;
-    private EndpointReferenceType target;
     
     private ServerEngine decoupledEngine;
     private URL decoupledURL;
@@ -138,40 +133,31 @@
                        EndpointReferenceType t,
                        URLConnectionFactory factory,
                        ServerEngine eng) throws IOException {
+        super(getTargetReference(ei, t));
         bus = b;
         endpointInfo = ei;
         alternateConnectionFactory = factory;
-        
-        init();
+
+        initConfig();
         
         decoupledEngine = eng;
         url = t == null
-              ? new URL(getAddress())
+              ? new URL(endpointInfo.getAddress())
               : new URL(t.getAddress().getValue());
-        target = getTargetReference(t);
     }
 
     protected void retrieveConnectionFactory() {
         connectionFactory = alternateConnectionFactory != null
                             ? alternateConnectionFactory
-                            : HTTPTransportFactory.getConnectionFactory(sslClient);
+                            : HTTPTransportFactory.getConnectionFactory(
+                                  config.getSslClient());
     }
-    
-    public String getBeanName() {
-        if (endpointInfo.getName() != null) {
-            return endpointInfo.getName().toString() + ".http-conduit";
-        }
-        return null;
-    }
-    
+
     /**
-     * Register a message observer for incoming messages.
-     * 
-     * @param observer the observer to notify on receipt of incoming
+     * @return the encapsulated config bean
      */
-    public void setMessageObserver(MessageObserver observer) {
-        incomingObserver = observer;
-        LOG.info("registering incoming observer: " + incomingObserver);
+    protected HTTPConduitConfigBean getConfig() {
+        return config;
     }
 
     /**
@@ -186,8 +172,8 @@
             connectionFactory.createConnection(getProxy(), currentURL);
         connection.setDoOutput(true);        
         //TODO using Message context to deceided HTTP send properties        
-        connection.setConnectTimeout((int)getClient().getConnectionTimeout());
-        connection.setReadTimeout((int)getClient().getReceiveTimeout());
+        connection.setConnectTimeout((int)config.getClient().getConnectionTimeout());
+        connection.setReadTimeout((int)config.getClient().getReceiveTimeout());
         connection.setUseCaches(false);
         
         if (connection instanceof HttpURLConnection) {
@@ -198,13 +184,14 @@
             } else {
                 hc.setRequestMethod("POST");
             }
-            if (getClient().isAutoRedirect()) {
+            if (config.getClient().isAutoRedirect()) {
                 //cannot use chunking if autoredirect as the request will need to be
                 //completely cached locally and resent to the redirect target
                 hc.setInstanceFollowRedirects(true);
             } else {
                 hc.setInstanceFollowRedirects(false);
-                if (!hc.getRequestMethod().equals("GET") && client.isAllowChunking()) {
+                if (!hc.getRequestMethod().equals("GET")
+                    && config.getClient().isAllowChunking()) {
                     hc.setChunkedStreamingMode(2048);
                 }
             }
@@ -232,14 +219,6 @@
         return new URL(result);    
     }
     
-   
-    /**
-     * @return the reference associated with the target Destination
-     */    
-    public EndpointReferenceType getTarget() {
-        return target;
-    }
-    
     /**
      * Retreive the back-channel Destination.
      * 
@@ -248,15 +227,11 @@
      */
     public synchronized Destination getBackChannel() {
         if (decoupledDestination == null
-            && getConfiguredDecoupledEndpoint() != null) {
+            &&  config.getClient().getDecoupledEndpoint() != null) {
             decoupledDestination = setUpDecoupledDestination(); 
         }
         return decoupledDestination;
     }
-    
-    public void close(Message msg) throws IOException {
-        msg.getContent(OutputStream.class).close();        
-    }
 
     /**
      * Close the conduit
@@ -294,18 +269,19 @@
     }
     
     /**
-     * Get the target reference which may be constructor-provided or 
-     * configured.
+     * Get the target reference.
      * 
+     * @param ei the corresponding EndpointInfo
      * @param t the constructor-provider target
      * @return the actual target
      */
-    private EndpointReferenceType getTargetReference(EndpointReferenceType t) {
+    private static EndpointReferenceType getTargetReference(EndpointInfo ei,
+                                                            EndpointReferenceType t) {
         EndpointReferenceType ref = null;
         if (null == t) {
             ref = new EndpointReferenceType();
             AttributedURIType address = new AttributedURIType();
-            address.setValue(getAddress());
+            address.setValue(ei.getAddress());
             ref.setAddress(address);
         } else {
             ref = t;
@@ -384,10 +360,11 @@
      */
     private DecoupledDestination setUpDecoupledDestination() {        
         EndpointReferenceType reference =
-            EndpointReferenceUtils.getEndpointReference(getConfiguredDecoupledEndpoint());
+            EndpointReferenceUtils.getEndpointReference(
+                config.getClient().getDecoupledEndpoint());
         if (reference != null) {
             String decoupledAddress = reference.getAddress().getValue();
-            LOG.info("creating decoupled endpoint: " + decoupledAddress);
+            log.info("creating decoupled endpoint: " + decoupledAddress);
             try {
                 decoupledURL = new URL(decoupledAddress);
                 if (decoupledEngine == null) {
@@ -405,21 +382,13 @@
                 decoupledHandler.duplicate();
             } catch (Exception e) {
                 // REVISIT move message to localizable Messages.properties
-                LOG.log(Level.WARNING, "decoupled endpoint creation failed: ", e);
+                log.log(Level.WARNING, "decoupled endpoint creation failed: ", e);
             }
         }
         return new DecoupledDestination(reference, incomingObserver);
     }
     
-    /**
-     * REVISIT: temporary mechanism to allow decoupled response endpoint
-     * to be configured, pending the maturation on the real config model
-     */
-    private String getConfiguredDecoupledEndpoint() {
-        return getClient().getDecoupledEndpoint() != null
-               ? getClient().getDecoupledEndpoint()
-               : System.getProperty(HTTP_DECOUPLED_ENDPOINT);
-    }
+ 
 
     /**
      * Wrapper output stream responsible for flushing headers and handling
@@ -626,22 +595,19 @@
         }
     }    
 
-    private void init() {
+    private void initConfig() {
+        config = new ConfigBean();
         // Initialize some default values for the configuration
-        setClient(endpointInfo.getTraversedExtensor(new HTTPClientPolicy(), HTTPClientPolicy.class));
-        setAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(), 
-                                                           AuthorizationPolicy.class));
-        setProxyAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(), 
-                                                                AuthorizationPolicy.class));
-    }
-
-    private String getAddress() {
-        return endpointInfo.getAddress();
+        config.setClient(endpointInfo.getTraversedExtensor(new HTTPClientPolicy(), HTTPClientPolicy.class));
+        config.setAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(), 
+                                                                  AuthorizationPolicy.class));
+        config.setProxyAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(), 
+                                                                       AuthorizationPolicy.class));
     }
 
     private Proxy getProxy() {
         Proxy proxy = null;
-        HTTPClientPolicy policy = getClient(); 
+        HTTPClientPolicy policy = config.getClient(); 
         if (policy.isSetProxyServer()) {
             proxy = new Proxy(Proxy.Type.valueOf(policy.getProxyServerType().toString()),
                               new InetSocketAddress(policy.getProxyServer(),
@@ -651,7 +617,7 @@
     }
 
     private void setPolicies(Message message, Map<String, List<String>> headers) {
-        AuthorizationPolicy authPolicy = getAuthorization();
+        AuthorizationPolicy authPolicy = config.getAuthorization();
         AuthorizationPolicy newPolicy = message.get(AuthorizationPolicy.class);
         String userName = (String)message.get(Message.USERNAME);
         String passwd = (String)message.get(Message.PASSWORD);
@@ -680,7 +646,7 @@
             headers.put("Authorization",
                         Arrays.asList(new String[] {type}));
         }
-        AuthorizationPolicy proxyAuthPolicy = getProxyAuthorization();
+        AuthorizationPolicy proxyAuthPolicy = config.getProxyAuthorization();
         if (proxyAuthPolicy.isSetUserName()) {
             userName = proxyAuthPolicy.getUserName();
             if (userName != null) {
@@ -703,7 +669,7 @@
                             Arrays.asList(new String[] {type}));
             }
         }
-        HTTPClientPolicy policy = getClient();
+        HTTPClientPolicy policy = config.getClient();
         if (policy.isSetCacheControl()) {
             headers.put("Cache-Control",
                         Arrays.asList(new String[] {policy.getCacheControl().value()}));
@@ -744,5 +710,14 @@
             headers.put("Referer",
                         Arrays.asList(new String[] {policy.getReferer()}));
         }
+    }
+
+    private class ConfigBean extends HTTPConduitConfigBean implements Configurable {
+        public String getBeanName() {
+            if (endpointInfo.getName() != null) {
+                return endpointInfo.getName().toString() + ".http-conduit";
+            }
+            return null;
+        }        
     }
 }

Modified: incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java Mon Jan 29 03:51:40 2007
@@ -110,14 +110,14 @@
     public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws IOException {
         HTTPConduit conduit = target == null
             ? new HTTPConduit(bus, endpointInfo) : new HTTPConduit(bus, endpointInfo, target);
-        configure(conduit);
+        configure(conduit.getConfig());
         conduit.retrieveConnectionFactory();
         return conduit;
     }
 
     public Destination getDestination(EndpointInfo endpointInfo) throws IOException {
         JettyHTTPDestination destination = new JettyHTTPDestination(bus, this, endpointInfo);
-        configure(destination);
+        configure(destination.getConfig());
         destination.retrieveEngine();
         return destination;
     }

Modified: incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java Mon Jan 29 03:51:40 2007
@@ -38,10 +38,10 @@
 import javax.wsdl.xml.WSDLWriter;
 
 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.io.AbstractWrappedOutputStream;
-import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -49,6 +49,7 @@
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.http.destination.HTTPDestinationConfigBean;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
@@ -59,6 +60,10 @@
 
 public class JettyHTTPDestination extends AbstractHTTPDestination {
 
+    static {
+        log = LogUtils.getL7dLogger(JettyHTTPDestination.class);
+    }
+    
     public static final String HTTP_REQUEST = JettyHTTPDestination.class.getName() + ".REQUEST";
     public static final String HTTP_RESPONSE = JettyHTTPDestination.class.getName() + ".RESPONSE";
 
@@ -66,7 +71,6 @@
 
     protected ServerEngine engine;
     protected ServerEngine alternateEngine;
-    protected MessageObserver incomingObserver;
 
     /**
      * Constructor, using Jetty server engine.
@@ -89,111 +93,103 @@
      * @param eng the server engine
      * @throws IOException
      */
-
     public JettyHTTPDestination(Bus b, ConduitInitiator ci, EndpointInfo endpointInfo, ServerEngine eng)
         throws IOException {
         super(b, ci, endpointInfo);
         alternateEngine = eng;
     }
 
+    /**
+     * Post-configure retreival of server engine.
+     */
     protected void retrieveEngine() {
         engine = alternateEngine != null
                  ? alternateEngine
-                 : JettyHTTPServerEngine.getForPort(bus, nurl.getProtocol(), nurl.getPort(), sslServer);
+                 : JettyHTTPServerEngine.getForPort(bus,
+                                                    nurl.getProtocol(),
+                                                    nurl.getPort(),
+                                                    config.getSslServer());
     }
 
     /**
-     * Register a message observer for incoming messages.
-     * 
-     * @param observer the observer to notify on receipt of incoming
+     * @return the encapsulated config bean
      */
-    public synchronized void setMessageObserver(MessageObserver observer) {
-        if (null != observer) {
-            LOG.info("registering incoming observer: " + observer);
-            try {
-                URL url = new URL(getAddressValue());
-                //The handler is bind with the context, 
-                //we need to set the things on on context
-                if (contextMatchOnExact()) {
-                    engine.addServant(url, new AbstractHandler() {
-                        public void handle(String target, HttpServletRequest req,
-                                           HttpServletResponse resp, int dispatch) throws IOException {
-                            //if (target.equals(getName())) {
-                            doService(req, resp);
-                            //}
-                        }
-                    });
-                } else {
-                    engine.addServant(url, new AbstractHandler() {
-                        public void handle(String target,  HttpServletRequest req,
-                                           HttpServletResponse resp, int dispatch) throws IOException {
-                            //if (target.startsWith(getName())) {
-                            doService(req, resp);
-                            //}
-                        }                        
-                    });
-                }
-            } catch (Exception e) {
-                LOG.log(Level.WARNING, "URL creation failed: ", e);
-            }
-        } else {
-            LOG.info("unregistering incoming observer: " + incomingObserver);
-            engine.removeServant(nurl);
-        }
-        incomingObserver = observer;
+    protected HTTPDestinationConfigBean getConfig() {
+        return config;
     }
-
+    
     /**
-     * Retreive a back-channel Conduit, which must be policy-compatible
-     * with the current Message and associated Destination. For example
-     * compatible Quality of Protection must be asserted on the back-channel.
-     * This would generally only be an issue if the back-channel is decoupled.
-     * 
-     * @param inMessage the current inbound message (null to indicate a 
-     * disassociated back-channel)
-     * @param partialResponse in the decoupled case, this is expected to be the
-     * outbound Message to be sent over the in-built back-channel. 
-     * @param address the backchannel address (null to indicate anonymous)
-     * @return a suitable Conduit
+     * Activate receipt of incoming messages.
      */
-    public Conduit getBackChannel(Message inMessage, Message partialResponse, EndpointReferenceType address)
-        throws IOException {
-        HttpServletResponse response = (HttpServletResponse)inMessage.get(HTTP_RESPONSE);
-        Conduit backChannel = null;
-        Exchange ex = inMessage.getExchange();
-        EndpointReferenceType target = address != null ? address : ex.get(EndpointReferenceType.class);
-        if (target == null) {
-            backChannel = new BackChannelConduit(response);
-        } else {
-            if (partialResponse != null) {
-                // setup the outbound message to for 202 Accepted
-                partialResponse.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_ACCEPTED);
-                backChannel = new BackChannelConduit(response);
-                ex.put(EndpointReferenceType.class, target);
-            } else {
-                backChannel = conduitInitiator.getConduit(endpointInfo, target);
-                // ensure decoupled back channel input stream is closed
-                backChannel.setMessageObserver(new MessageObserver() {
-                    public void onMessage(Message m) {
-                        if (m.getContentFormats().contains(InputStream.class)) {
-                            InputStream is = m.getContent(InputStream.class);
-                            try {
-                                is.close();
-                            } catch (Exception e) {
-                                // ignore
-                            }
-                        }
+    protected void activateIncoming() {
+        log.log(Level.INFO, "Activating receipt of incoming messages");
+        try {
+            URL url = new URL(getAddressValue());
+            //The handler is bind with the context, 
+            //we need to set the things on on context
+            if (contextMatchOnExact()) {
+                engine.addServant(url, new AbstractHandler() {
+                    public void handle(String target, HttpServletRequest req,
+                                       HttpServletResponse resp, int dispatch) throws IOException {
+                        //if (target.equals(getName())) {
+                        doService(req, resp);
+                        //}
                     }
                 });
+            } else {
+                engine.addServant(url, new AbstractHandler() {
+                    public void handle(String target,  HttpServletRequest req,
+                                       HttpServletResponse resp, int dispatch) throws IOException {
+                        //if (target.startsWith(getName())) {
+                        doService(req, resp);
+                        //}
+                    }                        
+                });
             }
+        } catch (Exception e) {
+            log.log(Level.WARNING, "URL creation failed: ", e);
         }
-        return backChannel;
+    
+    }
+
+    /**
+     * Deactivate receipt of incoming messages.
+     */
+    protected void deactivateIncoming() {
+        log.log(Level.INFO, "Deactivating receipt of incoming messages");
+        engine.removeServant(nurl);        
+    }
+
+    /**
+     * @param inMessage the incoming message
+     * @return the inbuilt backchannel
+     */
+    protected Conduit getInbuiltBackChannel(Message inMessage) {
+        HttpServletResponse response = (HttpServletResponse)inMessage.get(HTTP_RESPONSE);
+        return new BackChannelConduit(response);
+    }
+
+    /**
+     * Mark message as a partial message.
+     * 
+     * @param partialResponse the partial response message
+     * @param the decoupled target
+     * @return true iff partial responses are supported
+     */
+    protected boolean markPartialResponse(Message partialResponse,
+                                       EndpointReferenceType decoupledTarget) {
+        // setup the outbound message to for 202 Accepted
+        partialResponse.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_ACCEPTED);
+        partialResponse.getExchange().put(EndpointReferenceType.class,
+                                          decoupledTarget);
+        return true;
     }
 
     /**
-     * Shutdown the Destination, i.e. stop accepting incoming messages.
+     * @return the associated conduit initiator
      */
-    public void shutdown() {
+    protected ConduitInitiator getConduitInitiator() {
+        return conduitInitiator;
     }
 
     /**
@@ -246,8 +242,8 @@
         Request baseRequest = (req instanceof Request) 
             ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
         
-        if (getServer().isSetRedirectURL()) {
-            resp.sendRedirect(getServer().getRedirectURL());
+        if (config.getServer().isSetRedirectURL()) {
+            resp.sendRedirect(config.getServer().getRedirectURL());
             resp.flushBuffer();
             baseRequest.setHandled(true);
             return;
@@ -282,8 +278,8 @@
         Request baseRequest = (req instanceof Request) 
             ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
         try {
-            if (LOG.isLoggable(Level.INFO)) {
-                LOG.info("Service http request on thread: " + Thread.currentThread());
+            if (log.isLoggable(Level.INFO)) {
+                log.info("Service http request on thread: " + Thread.currentThread());
             }
 
             MessageImpl inMessage = new MessageImpl();            
@@ -297,7 +293,7 @@
             if (!StringUtils.isEmpty(getAddressValue())) {
                 inMessage.put(Message.BASE_PATH, new URL(getAddressValue()).getPath());
             }
-            inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder());
+            inMessage.put(Message.FIXED_PARAMETER_ORDER, config.isFixedParameterOrder());
             inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE); 
             
             setHeaders(inMessage);
@@ -309,8 +305,8 @@
             resp.flushBuffer();
             baseRequest.setHandled(true);
         } finally {
-            if (LOG.isLoggable(Level.INFO)) {
-                LOG.info("Finished servicing http request on thread: " + Thread.currentThread());
+            if (log.isLoggable(Level.INFO)) {
+                log.info("Finished servicing http request on thread: " + Thread.currentThread());
             }
         }
     }
@@ -339,12 +335,12 @@
             }
         } else if (null != responseObj) {
             String m = (new org.apache.cxf.common.i18n.Message("UNEXPECTED_RESPONSE_TYPE_MSG",
-                LOG, responseObj.getClass())).toString();
-            LOG.log(Level.WARNING, m);
+                log, responseObj.getClass())).toString();
+            log.log(Level.WARNING, m);
             throw new IOException(m);   
         } else {
-            String m = (new org.apache.cxf.common.i18n.Message("NULL_RESPONSE_MSG", LOG)).toString();
-            LOG.log(Level.WARNING, m);
+            String m = (new org.apache.cxf.common.i18n.Message("NULL_RESPONSE_MSG", log)).toString();
+            log.log(Level.WARNING, m);
             throw new IOException(m);
         }
 

Modified: incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java Mon Jan 29 03:51:40 2007
@@ -48,6 +48,7 @@
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.http.conduit.HTTPConduitConfigBean;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.easymock.classextension.EasyMock;
@@ -223,13 +224,14 @@
                                               decoupledEngine);
         conduit.retrieveConnectionFactory();
 
+        HTTPConduitConfigBean config = conduit.getConfig();
         if (send) {
-            conduit.getClient().setConnectionTimeout(303030);
-            conduit.getClient().setReceiveTimeout(404040);
+            config.getClient().setConnectionTimeout(303030);
+            config.getClient().setReceiveTimeout(404040);
             if (httpConnection) {
-                conduit.getClient().setAutoRedirect(autoRedirect);
+                conduit.getConfig().getClient().setAutoRedirect(autoRedirect);
                 if (!autoRedirect) {
-                    conduit.getClient().setAllowChunking(true);
+                    config.getClient().setAllowChunking(true);
                 } 
             }
         }
@@ -238,7 +240,7 @@
             URL decoupledURL = null;
             if (decoupled) {
                 decoupledURL = new URL(NOWHERE + "response");
-                conduit.getClient().setDecoupledEndpoint(decoupledURL.toString());
+                config.getClient().setDecoupledEndpoint(decoupledURL.toString());
             } 
         }
        

Modified: incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java Mon Jan 29 03:51:40 2007
@@ -252,7 +252,7 @@
                                                              conduitInitiator,
                                                              endpointInfo,
                                                              engine);
-        assertEquals(policy, dest.getServer());
+        assertEquals(policy, dest.getConfig().getServer());
     }
     
     private JettyHTTPDestination setUpDestination()

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?view=diff&rev=501019&r1=501018&r2=501019
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Mon Jan 29 03:51:40 2007
@@ -337,13 +337,12 @@
             
             try {
                 Destination target = inMessage.getDestination();
+                exchange.setOutMessage(partialResponse);
                 Conduit backChannel = target.getBackChannel(inMessage,
                                                             partialResponse,
                                                             reference);
                 if (backChannel != null) {
                     // set up interceptor chains and send message
-
-                    exchange.setOutMessage(partialResponse);
                     InterceptorChain chain =
                         fullResponse != null
                         ? fullResponse.getInterceptorChain()



Mime
View raw message