You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2011/12/06 23:49:56 UTC
svn commit: r1211217 - in /cxf/branches/2.4.x-fixes: ./
rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Author: sergeyb
Date: Tue Dec 6 22:49:55 2011
New Revision: 1211217
URL: http://svn.apache.org/viewvc?rev=1211217&view=rev
Log:
Merged revisions 1211216 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1211216 | sergeyb | 2011-12-06 22:46:07 +0000 (Tue, 06 Dec 2011) | 1 line
[CXF-3952] Adding a check for empty requestURI in AbstractHTTPDestination
........
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
svn:mergeinfo = /cxf/trunk:1211216
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java?rev=1211217&r1=1211216&r2=1211217&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java (original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java Tue Dec 6 22:49:55 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/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1211217&r1=1211216&r2=1211217&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Tue Dec 6 22:49:55 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);