From 5c507edb52ebb5b33fe43a609c89399ad56125fa Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 20 May 2014 13:39:21 +0200 Subject: [PATCH] DATAREST-307 - Fixed handling of root resource on Tomcat. We're now using a single slash to make sure the downstream method mapping works as expected. --- .../data/rest/webmvc/RepositoryRestHandlerMapping.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMapping.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMapping.java index 525b55c24..20e3bfb85 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMapping.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMapping.java @@ -116,10 +116,12 @@ public class RepositoryRestHandlerMapping extends RequestMappingHandlerMapping { return null; } + uri = StringUtils.hasText(uri) ? uri : "/"; + HttpServletRequest request = new DefaultAcceptTypeHttpServletRequest(origRequest, acceptType, uri); // Root request - if (!StringUtils.hasText(uri) || uri.equals("/")) { + if (uri.equals("/")) { return super.lookupHandlerMethod("/", request); }