cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r512641 - in /incubator/cxf/trunk/rt/transports: http/src/main/java/org/apache/cxf/transport/http/ http2/ http2/src/java/ http2/src/main/java/org/apache/cxf/transport/http/ http2/src/main/java/org/apache/cxf/transport/http/spring/ http2/src...
Date Wed, 28 Feb 2007 07:28:30 GMT
Author: ningjiang
Date: Tue Feb 27 23:28:28 2007
New Revision: 512641

URL: http://svn.apache.org/viewvc?view=rev&rev=512641
Log:
[CXF-439] Synchronized the http2 code with latest http module 


Added:
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/spring/
      - copied from r512109, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/spring/
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/spring/HttpConduitBeanDefinitionParser.java
      - copied unchanged from r512626, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/spring/HttpConduitBeanDefinitionParser.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/spring/HttpDestinationBeanDefinitionParser.java
      - copied unchanged from r512626, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/spring/HttpDestinationBeanDefinitionParser.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/spring/NamespaceHandler.java
      - copied unchanged from r512626, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/spring/NamespaceHandler.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/
      - copied from r512555, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
      - copied unchanged from r512626, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/Messages.properties
      - copied unchanged from r512626, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/Messages.properties
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
      - copied unchanged from r512626, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
      - copied unchanged from r512626, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
      - copied unchanged from r512626, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
Removed:
    incubator/cxf/trunk/rt/transports/http2/src/java/
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/http2/pom.xml
    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

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=512641&r1=512640&r2=512641
==============================================================================
--- 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
Tue Feb 27 23:28:28 2007
@@ -151,7 +151,7 @@
                                                Map<String, List<String>> headers);
 
     protected static String getAddressValue(EndpointInfo ei) {       
-        return getAddressValue(ei, false);
+        return getAddressValue(ei, true);
     } 
     
     protected static String getAddressValue(EndpointInfo ei, boolean dp) {       

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=512641&r1=512640&r2=512641
==============================================================================
--- 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
Tue Feb 27 23:28:28 2007
@@ -80,7 +80,7 @@
     private int decoupledDestinationRefCount;
     private EndpointInfo endpointInfo;
     
-    // COnfiguration values
+    // Configuration values
     private HTTPClientPolicy client;
     private AuthorizationPolicy authorization;
     private AuthorizationPolicy proxyAuthorization;

Modified: incubator/cxf/trunk/rt/transports/http2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/pom.xml?view=diff&rev=512641&r1=512640&r2=512641
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/pom.xml (original)
+++ incubator/cxf/trunk/rt/transports/http2/pom.xml Tue Feb 27 23:28:28 2007
@@ -55,6 +55,15 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-testutils</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>

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=512641&r1=512640&r2=512641
==============================================================================
--- 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
Tue Feb 27 23:28:28 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.transport.http;
 
 import java.io.IOException;
+import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -39,43 +40,53 @@
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.AbstractDestination;
 import org.apache.cxf.transport.ConduitInitiator;
-import org.apache.cxf.transport.http.destination.HTTPDestinationConfigBean;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
 /**
  * Common base for HTTP Destination implementations.
  */
-public abstract class AbstractHTTPDestination extends AbstractDestination {
+public abstract class AbstractHTTPDestination extends AbstractDestination implements Configurable
{
     
     private static final long serialVersionUID = 1L;
 
     protected final Bus bus;
     protected final ConduitInitiator conduitInitiator;
-    protected HTTPDestinationConfigBean config;
     protected String name;
     protected URL nurl;
 
+    // Configuration values
+    protected HTTPServerPolicy server;
+    protected AuthorizationPolicy authorization;
+    protected SSLServerPolicy sslServer;
+    protected String contextMatchStrategy = "stem";
+    protected boolean fixedParameterOrder;
+    
     /**
      * Constructor
      * 
      * @param b the associated Bus
      * @param ci the associated conduit initiator
      * @param ei the endpoint info of the destination 
+     * @param dp ture for adding the default port if it is missing
      * @throws IOException
      */    
     public AbstractHTTPDestination(Bus b,
                                    ConduitInitiator ci,
-                                   EndpointInfo ei)
+                                   EndpointInfo ei,
+                                   boolean dp)
         throws IOException {
-        super(getTargetReference(getAddressValue(ei)), ei);  
+        super(getTargetReference(getAddressValue(ei, dp)), ei);  
         bus = b;
         conduitInitiator = ci;
         
         initConfig();
-         
-        nurl = new URL(getAddressValue(ei));
+ 
+        nurl = new URL(getAddressValue(ei, dp));
         name = nurl.getPath();
     }
+    
+    
 
     /**
      * Cache HTTP headers in message.
@@ -140,17 +151,39 @@
                                                Map<String, List<String>> headers);
 
     protected static String getAddressValue(EndpointInfo ei) {       
-        return StringUtils.addDefaultPortIfMissing(ei.getAddress());
-    }        
+        return getAddressValue(ei, true);
+    } 
+    
+    protected static String getAddressValue(EndpointInfo ei, boolean dp) {       
+        if (dp) {
+            return StringUtils.addDefaultPortIfMissing(ei.getAddress());
+        } else {
+            return ei.getAddress();
+        }
+    }  
+    
+    /**
+     * 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;
+    }
 
     private void initConfig() {
-        config = new ConfigBean();
-        config.setServer(endpointInfo.getTraversedExtensor(new HTTPServerPolicy(), HTTPServerPolicy.class));
-        config.setSslServer(endpointInfo.getTraversedExtensor(new SSLServerPolicy(), SSLServerPolicy.class));
+        this.server = endpointInfo.getTraversedExtensor(new HTTPServerPolicy(), HTTPServerPolicy.class);
+        this.sslServer = endpointInfo.getTraversedExtensor(null, SSLServerPolicy.class);
     }
 
     void setPolicies(Map<String, List<String>> headers) {
-        HTTPServerPolicy policy = config.getServer(); 
+        HTTPServerPolicy policy = server; 
         if (policy.isSetCacheControl()) {
             headers.put("Cache-Control",
                         Arrays.asList(new String[] {policy.getCacheControl().value()}));
@@ -184,16 +217,54 @@
     }
 
     boolean contextMatchOnExact() {
-        return "exact".equals(config.getContextMatchStrategy());
+        return "exact".equals(contextMatchStrategy);
     }    
 
-    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;
+    public String getBeanName() {
+        String beanName = null;
+        if (endpointInfo.getName() != null) {
+            beanName = endpointInfo.getName().toString() + ".http-destination";
         }
+        return beanName;
+    }
+
+    public AuthorizationPolicy getAuthorization() {
+        return authorization;
+    }
+
+    public void setAuthorization(AuthorizationPolicy authorization) {
+        this.authorization = authorization;
+    }
+
+    public String getContextMatchStrategy() {
+        return contextMatchStrategy;
+    }
+
+    public void setContextMatchStrategy(String contextMatchStrategy) {
+        this.contextMatchStrategy = contextMatchStrategy;
+    }
+
+    public boolean isFixedParameterOrder() {
+        return fixedParameterOrder;
+    }
+
+    public void setFixedParameterOrder(boolean fixedParameterOrder) {
+        this.fixedParameterOrder = fixedParameterOrder;
+    }
+
+    public HTTPServerPolicy getServer() {
+        return server;
+    }
+
+    public void setServer(HTTPServerPolicy server) {
+        this.server = server;
+    }
+
+    public SSLServerPolicy getSslServer() {
+        return sslServer;
+    }
+
+    public void setSslServer(SSLServerPolicy sslServer) {
+        this.sslServer = sslServer;
     }
 }

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=512641&r1=512640&r2=512641
==============================================================================
--- 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
Tue Feb 27 23:28:28 2007
@@ -40,6 +40,7 @@
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.configuration.Configurable;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.configuration.security.SSLClientPolicy;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.io.AbstractWrappedOutputStream;
@@ -53,7 +54,6 @@
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.transport.MessageObserver;
-import org.apache.cxf.transport.http.conduit.HTTPConduitConfigBean;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
@@ -65,14 +65,13 @@
 /**
  * HTTP Conduit implementation.
  */
-public class HTTPConduit extends AbstractConduit {
+public class HTTPConduit extends AbstractConduit implements Configurable {
     public static final String HTTP_REQUEST = "org.apache.cxf.transport.http.JettyHTTPDestination.REQUEST";
     public static final String HTTP_RESPONSE = "org.apache.cxf.transport.http.JettyHTTPDestination.RESPONSE";
     public static final String HTTP_CONNECTION = "http.connection";
     private static final Logger LOG = LogUtils.getL7dLogger(HTTPConduit.class);
     
-    private final Bus bus;
-    private HTTPConduitConfigBean config;
+    private final Bus bus;    
     private final URLConnectionFactory alternateConnectionFactory;
     private URLConnectionFactory connectionFactory;
     private URL url;
@@ -82,6 +81,12 @@
     private int decoupledDestinationRefCount;
     private EndpointInfo endpointInfo;
     
+    // Configuration values
+    private HTTPClientPolicy client;
+    private AuthorizationPolicy authorization;
+    private AuthorizationPolicy proxyAuthorization;
+    private SSLClientPolicy sslClient;
+    
 
     /**
      * Constructor
@@ -146,16 +151,9 @@
         connectionFactory = alternateConnectionFactory != null
                             ? alternateConnectionFactory
                             : HTTPTransportFactory.getConnectionFactory(
-                                  config.getSslClient());
+                                getSslClient());
     }
-
-    /**
-     * @return the encapsulated config bean
-     */
-    protected HTTPConduitConfigBean getConfig() {
-        return config;
-    }
-
+   
     /**
      * Send an outbound message.
      * 
@@ -168,8 +166,8 @@
             connectionFactory.createConnection(getProxy(), currentURL);
         connection.setDoOutput(true);        
         //TODO using Message context to deceided HTTP send properties        
-        connection.setConnectTimeout((int)config.getClient().getConnectionTimeout());
-        connection.setReadTimeout((int)config.getClient().getReceiveTimeout());
+        connection.setConnectTimeout((int)getClient().getConnectionTimeout());
+        connection.setReadTimeout((int)getClient().getReceiveTimeout());
         connection.setUseCaches(false);
         
         if (connection instanceof HttpURLConnection) {
@@ -180,14 +178,14 @@
             } else {
                 hc.setRequestMethod("POST");
             }
-            if (config.getClient().isAutoRedirect()) {
+            if (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")
-                    && config.getClient().isAllowChunking()) {
+                    && getClient().isAllowChunking()) {
                     hc.setChunkedStreamingMode(2048);
                 }
             }
@@ -223,7 +221,7 @@
      */
     public synchronized Destination getBackChannel() {
         if (decoupledDestination == null
-            &&  config.getClient().getDecoupledEndpoint() != null) {
+            &&  getClient().getDecoupledEndpoint() != null) {
             setUpDecoupledDestination(); 
         }
         return decoupledDestination;
@@ -351,7 +349,7 @@
     private void setUpDecoupledDestination() {        
         EndpointReferenceType reference =
             EndpointReferenceUtils.getEndpointReference(
-                config.getClient().getDecoupledEndpoint());
+                getClient().getDecoupledEndpoint());
         if (reference != null) {
             String decoupledAddress = reference.getAddress().getValue();
             LOG.info("creating decoupled endpoint: " + decoupledAddress);
@@ -423,18 +421,17 @@
     }
 
     private void initConfig() {
-        config = new ConfigBean();
-        // Initialize some default values for the configuration
-        config.setClient(endpointInfo.getTraversedExtensor(new HTTPClientPolicy(), HTTPClientPolicy.class));
-        config.setAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(),

-                                                                  AuthorizationPolicy.class));
-        config.setProxyAuthorization(endpointInfo.getTraversedExtensor(new AuthorizationPolicy(),

-                                                                       AuthorizationPolicy.class));
+        //Initialize some default values for the configuration
+        client = endpointInfo.getTraversedExtensor(new HTTPClientPolicy(), HTTPClientPolicy.class);
+        authorization = endpointInfo.getTraversedExtensor(new AuthorizationPolicy(),
+                                                          AuthorizationPolicy.class);
+        proxyAuthorization = endpointInfo.getTraversedExtensor(new AuthorizationPolicy(),
+                                                               AuthorizationPolicy.class);
     }
 
     private Proxy getProxy() {
         Proxy proxy = null;
-        HTTPClientPolicy policy = config.getClient(); 
+        HTTPClientPolicy policy = getClient(); 
         if (policy.isSetProxyServer()) {
             proxy = new Proxy(Proxy.Type.valueOf(policy.getProxyServerType().toString()),
                               new InetSocketAddress(policy.getProxyServer(),
@@ -444,7 +441,7 @@
     }
 
     private void setPolicies(Message message, Map<String, List<String>> headers)
{
-        AuthorizationPolicy authPolicy = config.getAuthorization();
+        AuthorizationPolicy authPolicy = getAuthorization();
         AuthorizationPolicy newPolicy = message.get(AuthorizationPolicy.class);
         String userName = null;
         String passwd = null;
@@ -473,7 +470,7 @@
             headers.put("Authorization",
                         Arrays.asList(new String[] {type}));
         }
-        AuthorizationPolicy proxyAuthPolicy = config.getProxyAuthorization();
+        AuthorizationPolicy proxyAuthPolicy = getProxyAuthorization();
         if (proxyAuthPolicy.isSetUserName()) {
             userName = proxyAuthPolicy.getUserName();
             if (userName != null) {
@@ -496,7 +493,7 @@
                             Arrays.asList(new String[] {type}));
             }
         }
-        HTTPClientPolicy policy = config.getClient();
+        HTTPClientPolicy policy = getClient();
         if (policy.isSetCacheControl()) {
             headers.put("Cache-Control",
                         Arrays.asList(new String[] {policy.getCacheControl().value()}));
@@ -539,14 +536,44 @@
         }
     }
 
-    private class ConfigBean extends HTTPConduitConfigBean implements Configurable {
-        public String getBeanName() {
-            if (endpointInfo.getName() != null) {
-                return endpointInfo.getName().toString() + ".http-conduit";
-            }
-            return null;
-        }        
+    public String getBeanName() {
+        if (endpointInfo.getName() != null) {
+            return endpointInfo.getName().toString() + ".http-conduit";
+        }
+        return null;
+    }
+
+    public AuthorizationPolicy getAuthorization() {
+        return authorization;
+    }
+
+    public void setAuthorization(AuthorizationPolicy authorization) {
+        this.authorization = authorization;
+    }
+
+    public HTTPClientPolicy getClient() {
+        return client;
+    }
+
+    public void setClient(HTTPClientPolicy client) {
+        this.client = client;
+    }
+
+    public AuthorizationPolicy getProxyAuthorization() {
+        return proxyAuthorization;
     }
+
+    public void setProxyAuthorization(AuthorizationPolicy proxyAuthorization) {
+        this.proxyAuthorization = proxyAuthorization;
+    }
+
+    public SSLClientPolicy getSslClient() {
+        return sslClient;
+    }
+
+    public void setSslClient(SSLClientPolicy sslClient) {
+        this.sslClient = sslClient;
+    }  
     
     /**
      * Wrapper output stream responsible for flushing headers and handling
@@ -654,4 +681,5 @@
             incomingObserver.onMessage(inMessage);
         }
     }
+    
 }

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=512641&r1=512640&r2=512641
==============================================================================
--- 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
Tue Feb 27 23:28:28 2007
@@ -110,15 +110,15 @@
     public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws
IOException {
         HTTPConduit conduit = target == null
             ? new HTTPConduit(bus, endpointInfo) : new HTTPConduit(bus, endpointInfo, target);
-        configure(conduit.getConfig());
+        configure(conduit);
         conduit.retrieveConnectionFactory();
         return conduit;
     }
 
     public Destination getDestination(EndpointInfo endpointInfo) throws IOException {
         JettyHTTPDestination destination = new JettyHTTPDestination(bus, this, endpointInfo);
-        configure(destination.getConfig());
-        destination.retrieveEngine();
+        configure(destination);
+        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=512641&r1=512640&r2=512641
==============================================================================
--- 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
Tue Feb 27 23:28:28 2007
@@ -34,9 +34,6 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
@@ -49,9 +46,8 @@
 import org.apache.cxf.transport.AbstractDestination;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
-import org.apache.cxf.transport.http.destination.HTTPDestinationConfigBean;
-import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+import org.apache.cxf.transports.http.QueryHandler;
+import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.mortbay.jetty.HttpConnection;
 import org.mortbay.jetty.Request;
 import org.mortbay.jetty.handler.AbstractHandler;
@@ -90,7 +86,7 @@
      */
     public JettyHTTPDestination(Bus b, ConduitInitiator ci, EndpointInfo endpointInfo, ServerEngine
eng)
         throws IOException {
-        super(b, ci, endpointInfo);
+        super(b, ci, endpointInfo, true);
         alternateEngine = eng;
     }
 
@@ -107,25 +103,19 @@
                  : JettyHTTPServerEngine.getForPort(bus,
                                                     nurl.getProtocol(),
                                                     nurl.getPort(),
-                                                    config.getSslServer());
+                                                    getSslServer());
     }
 
-    /**
-     * @return the encapsulated config bean
-     */
-    protected HTTPDestinationConfigBean getConfig() {
-        return config;
-    }
-    
+      
     /**
      * Activate receipt of incoming messages.
      */
     protected void activate() {
-        LOG.log(Level.INFO, "Activating receipt of incoming messages");
+        LOG.log(Level.FINE, "Activating receipt of incoming messages");
         try {
             URL url = new URL(getAddressValue(endpointInfo));
             //The handler is bind with the context, 
-            //we need to set the things on on context
+            //TODO we need to set the things on on context
             if (contextMatchOnExact()) {
                 engine.addServant(url, new AbstractHandler() {
                     public void handle(String target, HttpServletRequest req,
@@ -168,22 +158,7 @@
         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
      */
@@ -246,30 +221,24 @@
         Request baseRequest = (req instanceof Request) 
             ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
         
-        if (config.getServer().isSetRedirectURL()) {
-            resp.sendRedirect(config.getServer().getRedirectURL());
+        if (getServer().isSetRedirectURL()) {
+            resp.sendRedirect(getServer().getRedirectURL());
             resp.flushBuffer();
             baseRequest.setHandled(true);
             return;
         }
-
-        if ("GET".equals(req.getMethod()) && "wsdl".equalsIgnoreCase(req.getQueryString()))
{
-            try {
-
-                resp.addHeader(HttpHeaderHelper.CONTENT_TYPE, "text/xml");
-
-                OutputStream os = resp.getOutputStream();
-
-                WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
-                Definition def = new ServiceWSDLBuilder(endpointInfo.getService()).build();
-                wsdlWriter.writeWSDL(def, os);
-                resp.getOutputStream().flush();
-                resp.flushBuffer();
-                baseRequest.setHandled(true);
-                return;
-            } catch (Exception ex) {
-
-                ex.printStackTrace();
+        
+        QueryHandlerRegistry queryHandlerRegistry = bus.getExtension(QueryHandlerRegistry.class);
+        if (queryHandlerRegistry != null) { 
+            for (QueryHandler qh : queryHandlerRegistry.getHandlers()) {
+                String requestURL = req.getPathInfo() + "?" + req.getQueryString();
+                if (qh.isRecognizedQuery(requestURL, endpointInfo)) {
+                    resp.setContentType(qh.getResponseContentType(requestURL));
+                    qh.writeResponse(requestURL, endpointInfo, resp.getOutputStream());
+                    resp.getOutputStream().flush();                     
+                    baseRequest.setHandled(true);
+                    return;
+                }
             }
         }
 
@@ -297,7 +266,7 @@
             if (!StringUtils.isEmpty(getAddressValue(endpointInfo))) {
                 inMessage.put(Message.BASE_PATH, new URL(getAddressValue(endpointInfo)).getPath());
             }
-            inMessage.put(Message.FIXED_PARAMETER_ORDER, config.isFixedParameterOrder());
+            inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder());
             inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE); 
             
             setHeaders(inMessage);

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=512641&r1=512640&r2=512641
==============================================================================
--- 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
Tue Feb 27 23:28:28 2007
@@ -48,7 +48,6 @@
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
 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;
@@ -234,20 +233,20 @@
                                               connectionFactory);
         conduit.retrieveConnectionFactory();
 
-        HTTPConduitConfigBean config = conduit.getConfig();
+        //HTTPConduitConfigBean config = conduit.getConfig();
         if (send) {
-            config.getClient().setConnectionTimeout(303030);
-            config.getClient().setReceiveTimeout(404040);
+            conduit.getClient().setConnectionTimeout(303030);
+            conduit.getClient().setReceiveTimeout(404040);
             if (httpConnection) {
-                conduit.getConfig().getClient().setAutoRedirect(autoRedirect);
+                conduit.getClient().setAutoRedirect(autoRedirect);
                 if (!autoRedirect) {
-                    config.getClient().setAllowChunking(true);
+                    conduit.getClient().setAllowChunking(true);
                 } 
             }
         }
         
         if (decoupled) {
-            config.getClient().setDecoupledEndpoint(decoupledURL.toString());
+            conduit.getClient().setDecoupledEndpoint(decoupledURL.toString());
             assertNotNull("expected back channel", conduit.getBackChannel());
         } else {
             assertNull("unexpected back channel", conduit.getBackChannel());

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=512641&r1=512640&r2=512641
==============================================================================
--- 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
Tue Feb 27 23:28:28 2007
@@ -252,7 +252,7 @@
                                                              conduitInitiator,
                                                              endpointInfo,
                                                              engine);
-        assertEquals(policy, dest.getConfig().getServer());
+        assertEquals(policy, dest.getServer());
     }
     
     private JettyHTTPDestination setUpDestination()



Mime
View raw message