cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1211216 - in /cxf/trunk/rt: frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Date Tue, 06 Dec 2011 22:46:07 GMT
Author: sergeyb
Date: Tue Dec  6 22:46:07 2011
New Revision: 1211216

URL: http://svn.apache.org/viewvc?rev=1211216&view=rev
Log:
[CXF-3952] Adding a check for empty requestURI in AbstractHTTPDestination

Modified:
    cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java

Modified: cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java?rev=1211216&r1=1211215&r2=1211216&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
Tue Dec  6 22:46:07 2011
@@ -104,6 +104,7 @@ public class JAXWSHttpSpiDestinationTest
         expect(exchange.getHttpContext()).andReturn(context).anyTimes();
         expect(exchange.getQueryString()).andReturn(null);
         expect(exchange.getPathInfo()).andReturn(null);
+        expect(exchange.getRequestURI()).andReturn(CONTEXT_PATH);
         expect(exchange.getContextPath()).andReturn(CONTEXT_PATH);
         Map<String, List<String>> reqHeaders = new HashMap<String, List<String>>();
         reqHeaders.put("Content-Type", Collections.singletonList("text/xml"));

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1211216&r1=1211215&r2=1211216&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Tue Dec  6 22:46:07 2011
@@ -269,15 +269,22 @@ public abstract class AbstractHTTPDestin
         }
         String contextServletPath = contextPath + servletPath;
         inMessage.put(Message.PATH_INFO, contextServletPath + req.getPathInfo());
-        int index = requestURL.indexOf(requestURI);
-        if (index > 0) {
-            // Can be useful for referencing resources with URIs not covered by CXFServlet.
-            // For example, if we a have web application name 'app' and CXFServlet listening

-            // on "/services/*" then having HTTP_BASE_PATH pointing to say 
-            // http://localhost:8080/app will make it easy to refer to non CXF resources
-            String schemaInfo = requestURL.substring(0, index);
-            String basePathWithContextOnly = schemaInfo + contextPath;
-            inMessage.put(HTTP_BASE_PATH, basePathWithContextOnly);
+        if (!StringUtils.isEmpty(requestURI)) {
+            int index = requestURL.indexOf(requestURI);
+            if (index > 0) {
+                // Can be useful for referencing resources with URIs not covered by CXFServlet.
+                // For example, if we a have web application name 'app' and CXFServlet listening

+                // on "/services/*" then having HTTP_BASE_PATH pointing to say 
+                // http://localhost:8080/app will make it easy to refer to non CXF resources
+                String schemaInfo = requestURL.substring(0, index);
+                String basePathWithContextOnly = schemaInfo + contextPath;
+                inMessage.put(HTTP_BASE_PATH, basePathWithContextOnly);
+            }
+        } else if (!StringUtils.isEmpty(servletPath) && requestURL.endsWith(servletPath))
{
+            int index = requestURL.lastIndexOf(servletPath);
+            if (index > 0) {
+                inMessage.put(HTTP_BASE_PATH, requestURL.substring(0, index));
+            }
         }
         String contentType = req.getContentType();
         inMessage.put(Message.CONTENT_TYPE, contentType);



Mime
View raw message