1

In spring 3.0.x I have a handler method that works perfectly like:

@RequestMapping("/foo/{version:\\d+}/**")
public void handleVersionedResource(@PathVariable("version") Long version, HttpServletRequest request, HttpServletResponse response) {
     String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);

     // rest of the code maps path and version to a real resource and serves 
     // content with extra long cache control / expires headers
 }

In 3.0.x, ff the request url is /foo/12345/some/resource, then path = "some/resource" (the ** part of the request match).

However, in 3.1.x (tried with both 3.1.0.RELEASE and 3.1.1.RELEASE) path = to the full request path match, so "/foo/12345/some/resource" in my previous example.

So the question is, does anyone have the simplest way to replicate the behavior I was getting in 3.0.x? Also, any insight to why this behavior has changed? Was I doing it wrong in the first place?

Update: repeat of Spring 3.1.RC1 and PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE - no good answer was given there either.

Community
  • 1
  • 1

1 Answers1

2

Spring 3.1.RC1 and PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE suggests that HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE is internal to Spring and should not be used in your application

Doing something similar to How to match a Spring @RequestMapping having a @pathVariable containing "/"? would probably be your best bet

Community
  • 1
  • 1
rhollencamp
  • 533
  • 4
  • 13