Author: dkulp
Date: Tue Oct 6 21:24:23 2009
New Revision: 822510
URL: http://svn.apache.org/viewvc?rev=822510&view=rev
Log:
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.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=822510&r1=822509&r2=822510&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Tue Oct 6 21:24:23 2009
@@ -103,12 +103,11 @@
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 = getDestination(ei.getAddress());
-
if (d == null) {
if (!isHideServiceList &&
(request.getRequestURI().endsWith(serviceListRelativePath)
||
request.getRequestURI().endsWith(serviceListRelativePath + "/")
@@ -182,7 +181,7 @@
}
protected ServletDestination getDestination(String address) {
- return (ServletDestination)transport.getDestinationForPath(address);
+ return (ServletDestination)transport.getDestinationForPath(address,
true);
}
protected ServletDestination checkRestfulRequest(HttpServletRequest
request) throws IOException {
Modified:
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?rev=822510&r1=822509&r2=822510&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
Tue Oct 6 21:24:23 2009
@@ -104,7 +104,11 @@
@Override
public void shutdown() {
- factory.removeDestination(path);
+ try {
+ factory.removeDestination(path);
+ } catch (IOException ex) {
+ //ignore
+ }
super.shutdown();
}
Modified:
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?rev=822510&r1=822509&r2=822510&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
Tue Oct 6 21:24:23 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) {