cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r539316 - in /incubator/cxf/trunk/rt/transports/http-jetty: pom.xml src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
Date Fri, 18 May 2007 08:47:59 GMT
Author: ningjiang
Date: Fri May 18 01:47:58 2007
New Revision: 539316

URL: http://svn.apache.org/viewvc?view=rev&rev=539316
Log:
[CXF-617] update the soap:address with the request url, also removed the unused dependency
of jetty

Modified:
    incubator/cxf/trunk/rt/transports/http-jetty/pom.xml
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java

Modified: incubator/cxf/trunk/rt/transports/http-jetty/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/pom.xml?view=diff&rev=539316&r1=539315&r2=539316
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/pom.xml (original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/pom.xml Fri May 18 01:47:58 2007
@@ -77,12 +77,7 @@
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>jetty</artifactId>
             <version>6.1.2rc0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.mortbay.jetty</groupId>
-            <artifactId>jetty-sslengine</artifactId>
-            <version>6.1.2rc0</version>
-        </dependency>
+        </dependency>       
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-jdk14</artifactId>

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?view=diff&rev=539316&r1=539315&r2=539316
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Fri May 18 01:47:58 2007
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.Principal;
 import java.util.logging.Level;
@@ -129,8 +130,23 @@
     protected ConduitInitiator getConduitInitiator() {
         return conduitInitiator;
     }
+    
+    private String getBasePath(String addr) {
+        try {
+            return new URL(addr).getPath();
+        } catch (MalformedURLException e) {
+            return null;
+        }
+    }
 
-   
+    private synchronized void updateEndpointAddress(String addr) {
+        // only update the EndpointAddress if the base path is equal
+        // make sure we don't broke the get operation?parament query 
+        String address = endpointInfo.getAddress();
+        if (getBasePath(address).equals(getBasePath(addr))) {
+            endpointInfo.setAddress(addr);
+        }
+    }
    
     protected void doService(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
         Request baseRequest = (req instanceof Request) 
@@ -143,11 +159,14 @@
             return;
         }
         QueryHandlerRegistry queryHandlerRegistry = bus.getExtension(QueryHandlerRegistry.class);
-        if (queryHandlerRegistry != null) { 
+        
+        if (null != req.getQueryString() && queryHandlerRegistry != null) {     
  
             String requestURL = req.getRequestURL() + "?" + req.getQueryString();
-            String pathInfo = req.getPathInfo();
+            String pathInfo = req.getPathInfo();                     
             for (QueryHandler qh : queryHandlerRegistry.getHandlers()) {
                 if (qh.isRecognizedQuery(requestURL, pathInfo, endpointInfo)) {
+                    //replace the endpointInfo address with request url only for get wsdl
          
+                    updateEndpointAddress(req.getRequestURL().toString());   
                     resp.setContentType(qh.getResponseContentType(requestURL, pathInfo));
                     qh.writeResponse(requestURL, pathInfo, endpointInfo, resp.getOutputStream());
                     resp.getOutputStream().flush();                     
@@ -175,7 +194,8 @@
             inMessage.put(HTTP_REQUEST, req);
             inMessage.put(HTTP_RESPONSE, resp);
             inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
-            inMessage.put(Message.PATH_INFO, req.getContextPath() + req.getPathInfo()); 
+            inMessage.put(Message.PATH_INFO, req.getContextPath() + req.getPathInfo());
+            
             inMessage.put(Message.QUERY_STRING, req.getQueryString());
             inMessage.put(Message.CONTENT_TYPE, req.getContentType());
             if (!StringUtils.isEmpty(endpointInfo.getAddress())) {

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?view=diff&rev=539316&r1=539315&r2=539316
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
Fri May 18 01:47:58 2007
@@ -506,10 +506,6 @@
         request.getMethod();
         EasyMock.expectLastCall().andReturn(method);
         
-        /*if ("GET".equals(method)) {            
-            request.getQueryString();
-            EasyMock.expectLastCall().andReturn(query);            
-        }*/ 
         
         if (setRedirectURL) {
             policy.setRedirectURL(NOWHERE + "foo/bar");
@@ -519,7 +515,11 @@
             EasyMock.expectLastCall();
             request.setHandled(true);
             EasyMock.expectLastCall();
-        } else {            
+        } else { 
+            //getQueryString for if statement
+            request.getQueryString();
+            EasyMock.expectLastCall().andReturn(query);      
+            
             if ("GET".equals(method) && "?wsdl".equals(query)) {
                 verifyGetWSDLQuery();                
             } else { // test for the post
@@ -616,7 +616,7 @@
         queryHandlerRegistry.getHandlers();
         EasyMock.expectLastCall().andReturn(queryHandlerList);       
         request.getRequestURL();
-        EasyMock.expectLastCall().andReturn(new StringBuffer("http://localhost/bar/foo"));
+        EasyMock.expectLastCall().andReturn(new StringBuffer("http://localhost/bar/foo")).times(2);
         request.getPathInfo();
         EasyMock.expectLastCall().andReturn("/bar/foo");
         request.getQueryString();



Mime
View raw message