From ee6e0aba9dfeaf594c01ea088a8e31efc6517d49 Mon Sep 17 00:00:00 2001 From: lresende Date: Sun, 29 Aug 2010 08:47:38 +0000 Subject: Merging changes from svn r988356: Test for null or empty servlet path info before redirecting to same URL with trailing /. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@990507 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/rest/provider/RESTBindingListenerServlet.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache') diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingListenerServlet.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingListenerServlet.java index 32abd5ded8..e0a681ed36 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingListenerServlet.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingListenerServlet.java @@ -129,13 +129,14 @@ public class RESTBindingListenerServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Get the request path - String path = URLDecoder.decode(request.getPathInfo(), "UTF-8"); - if (path.length() ==0) { + String pathInfo = request.getPathInfo(); + if (pathInfo == null || pathInfo.length() == 0) { // Redirect to a URL ending with / to make relative hrefs work // relative to the served resource. response.sendRedirect(request.getRequestURL().append('/').toString()); return; } + String path = URLDecoder.decode(pathInfo, "UTF-8"); // Invoke the get operation on the service implementation Message requestMessage = messageFactory.createMessage(); -- cgit v1.2.3