Announcement Announcement Module
Collapse
No announcement yet.
mvc 3.0 and REST Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • mvc 3.0 and REST

    In spring-web 3.0 they allow for REST and urls like this for example /person/1223 .. So I'm assuming for the servlet mapping we can't do something like this..
    <servlet-mapping>
    <servlet-name>sample</servlet-name>
    <url-pattern>*.html</url-pattern>
    </servlet-mapping>

    and instead have to use something like this.. from examples i've seen.
    <servlet-mapping>
    <servlet-name>sample</servlet-name>
    <url-pattern>/app/*</url-pattern>
    </servlet-mapping>

    I want to avoid having the extra param in the url , and tried setting .. all requests to go through the dispatcher, like so
    <servlet-mapping>
    <servlet-name>sample</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>

    This works except for static files like css, or javascript. Is there any way to tell dispatcher to ignore files with certain extensions ?

  • #2
    The solution In the latest petclinic for Spring 3.0 m2 .. it includes this in the xml

    <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/static/*</url-pattern>
    </servlet-mapping>

    <servlet>
    <servlet-name>petclinic</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>petclinic</servlet-name>
    <url-pattern>/</url-pattern>
    </servlet-mapping>

    For some reason the static mapping, on the google app engine, that uses jetty, would cause continuous redirect loop when retrieving static assets.
    The issue is how tomcat default server maps to path vs jetty.
    For more details go here: http://stackoverflow.com/questions/1...static-content
    Last edited by minalecs; Apr 21st, 2009, 06:07 AM.

    Comment

    Working...
    X