You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/10/06 23:32:19 UTC
svn commit: r822520 - in /cxf/branches/2.1.x-fixes: ./
rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/
Author: dkulp
Date: Tue Oct 6 21:32:19 2009
New Revision: 822520
URL: http://svn.apache.org/viewvc?rev=822520&view=rev
Log:
Merged revisions 822510 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes
................
r822510 | dkulp | 2009-10-06 17:24:23 -0400 (Tue, 06 Oct 2009) | 10 lines
Merged revisions 822501 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r822501 | dkulp | 2009-10-06 17:12:40 -0400 (Tue, 06 Oct 2009) | 2 lines
[CXF-2301] Lookup the destination using a decoded URL as well to handle
differenced as to if it is registered encoded or decoded
........
................
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=822520&r1=822519&r2=822520&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Tue Oct 6 21:32:19 2009
@@ -115,11 +115,10 @@
public void invoke(HttpServletRequest request, HttpServletResponse res) throws ServletException {
try {
EndpointInfo ei = new EndpointInfo();
+
String address = request.getPathInfo() == null ? "" : request.getPathInfo();
-
ei.setAddress(address);
- ServletDestination d = (ServletDestination)transport.getDestinationForPath(ei.getAddress());
-
+ ServletDestination d = getDestination(ei.getAddress());
if (d == null) {
if (request.getRequestURI().endsWith("/services")
|| request.getRequestURI().endsWith("/services/")
@@ -186,8 +185,11 @@
}
}
- private ServletDestination checkRestfulRequest(HttpServletRequest request) throws IOException {
-
+ protected ServletDestination getDestination(String address) {
+ return (ServletDestination)transport.getDestinationForPath(address, true);
+ }
+
+ protected ServletDestination checkRestfulRequest(HttpServletRequest request) throws IOException {
String address = request.getPathInfo() == null ? "" : request.getPathInfo();
int len = -1;
Modified: cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?rev=822520&r1=822519&r2=822520&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java Tue Oct 6 21:32:19 2009
@@ -105,7 +105,11 @@
@Override
public void shutdown() {
- factory.removeDestination(path);
+ try {
+ factory.removeDestination(path);
+ } catch (IOException ex) {
+ //ignore
+ }
super.shutdown();
}
Modified: cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?rev=822520&r1=822519&r2=822520&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java Tue Oct 6 21:32:19 2009
@@ -21,6 +21,7 @@
package org.apache.cxf.transport.servlet;
import java.io.IOException;
+import java.net.URLDecoder;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -46,6 +47,8 @@
private Map<String, ServletDestination> destinations =
new ConcurrentHashMap<String, ServletDestination>();
+ private Map<String, ServletDestination> decodedDestinations =
+ new ConcurrentHashMap<String, ServletDestination>();
private ServletController controller;
@@ -90,8 +93,9 @@
}
}
- public void removeDestination(String path) {
+ public void removeDestination(String path) throws IOException {
destinations.remove(path);
+ decodedDestinations.remove(URLDecoder.decode(path, "ISO-8859-1"));
}
public Destination getDestination(EndpointInfo endpointInfo)
@@ -101,6 +105,7 @@
String path = getTrimmedPath(endpointInfo.getAddress());
d = new ServletDestination(getBus(), this, endpointInfo, this, path);
destinations.put(path, d);
+ decodedDestinations.put(URLDecoder.decode(path, "ISO-8859-1"), d);
if (controller != null
&& !StringUtils.isEmpty(controller.getLastBaseURL())) {
@@ -120,8 +125,16 @@
}
public ServletDestination getDestinationForPath(String path) {
+ return getDestinationForPath(path, false);
+ }
+ public ServletDestination getDestinationForPath(String path, boolean tryDecoding) {
// to use the url context match
- return destinations.get(getTrimmedPath(path));
+ String m = getTrimmedPath(path);
+ ServletDestination s = destinations.get(m);
+ if (s == null) {
+ s = decodedDestinations.get(m);
+ }
+ return s;
}
static String getTrimmedPath(String path) {