Announcement Announcement Module
Collapse
No announcement yet.
Controller stealing URL control Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Controller stealing URL control

    Here's the scenario. I want my controller to be able to grab hold of most URLs and process them through a common processor (the application is a directory-display application, so it maps URLs to a database-hosted tree).

    The problem is that my resources directory specification is getting overridden. I have in my application context:


    Code:
    <resources mapping="/resources/**" location="/resources/" />
    
    <annotation-driven />
    and in my controller I have

    Code:
    @RequestMapping(value = "/**/", method = RequestMethod.GET)
    public String directoryListing(Model model, HttpServletRequest httpServletRequest) throws PathNotFoundException {
    Unfortunately, /resources/foo.js etc. gets captured by the directoryListing() method instead of being handled by resources mapping. Any suggestions on how best to handle this? Is there a way to specify that the @RequestMapping should not apply to any URLs with a period in them? Or alternatively, how can I do the resources mapping by Java coding (e.g., having a controller method which takes /resources/** and returns an appropriate file from the resources directory).

    -dh
Working...
X