Results 1 to 2 of 2

Thread: mvc 3.0 and REST

  1. #1
    Join Date
    Mar 2007
    Posts
    13

    Default 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. #2
    Join Date
    Mar 2007
    Posts
    13

    Default

    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 at 06:07 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •