From 5809f756cfa419554426a789974d76e01afe17e9 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 23 Aug 2010 23:37:26 +0000 Subject: 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@988356 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/http/provider/HTTPBindingListenerServlet.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk/modules/binding-http-runtime/src') diff --git a/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java b/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java index 0b49ed09e5..e2a3a5cf39 100644 --- a/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java +++ b/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java @@ -75,13 +75,14 @@ public class HTTPBindingListenerServlet 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