-
Bug
-
Resolution: Done
-
Major
-
2.3.0.GA
-
None
We have an application that uses the @ApplicationPath("/") annotation. The annotated class implements the "getSingletons()" method and one of those singletons has a @Path("/") annotation. The idea is having that resource available in the context root, so if the application is deployed to the context root "/api" we want that resource to be available when the user types the "http://whatever/api" URL. Unfortunately this does not work, it only works if the trailing slash is included: "http://whatever/api/".
I think that the cause is in the "extractUriInfo" of the "org.jboss.resteasy.plugins.server.servlet.ServletUtil" class.
The following patch apparently resolves the problem:
— a/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/server/servlet/ServletUtil.java
+++ b/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/server/servlet/ServletUtil.java
@@ -34,7 +34,7 @@ public class ServletUtil
public static UriInfoImpl extractUriInfo(HttpServletRequest request, String servletPrefix)
{
String contextPath = request.getContextPath();
- if (servletPrefix != null && servletPrefix.length() > 0)
+ if (servletPrefix != null && servletPrefix.length() > 0 && !servletPrefix.equals("/"))
{
if (!contextPath.endsWith("/") && !servletPrefix.startsWith("/"))
contextPath += "/";