Announcement Announcement Module
Collapse
No announcement yet.
Problem with URL resolution in action-servlet.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with URL resolution in action-servlet.xml

    Hi there,

    I need a hint:
    in my action-servlet.xml I have a SimpleUrlHandlerMapping which maps a subclass of AbstractController to /foo/* and /foo/**/*, the controller then parses the path and returns the appropriate ModelAndView. Now the problem is, this only works for files which are mapped in web.xml to the action servlet, e.g.:

    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.html</url-pattern>
    </servlet-mapping>

    Is there a way to map requests to *everything* that matches /foo/* and /foo/**/*, i.e. not only .html files, but also directories like /foo/bar/ and files with other endings? I mean sure, I could just have a <url-pattern>*</url-patter> which would probably solve the issue. However this would mean, that everything served by my servlet container (tomcat5) would have to pass through the servlet engine, even static files like CSS, images and javascript files. Right?

    Any hints are greatly appreciated!

    Thanks in advance,
    jenner

  • #2
    You need to map * in the web.xml for all requests to be even passed to Spring. By mapping just *.html to the Spring servlet, the servlet container will not even pass requests that don't in .html to Spring.

    Rob

    Comment

    Working...
    X