title: How do I get RESTful URLS in Spring 3 MVC?
body: <p>I'm having a frustrating time with Spring 3 MVC trying to build RESTful web services. </p>
  
  <p>I want RESTful URLs, e.g. "my.domain.com/items", not "my.domain.com/items.do" or anything else that includes an extension. My web.xml includes the following. Note the URL pattern:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;addictedWebServices&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;addictedWebServices&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>My addictedWebServices-servlet.xml includes the following view resolvers:</p>
  
  <p>
   </p>
  
  <pre><code>&lt;bean id="viewResolver2" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
   &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/&gt;
   &lt;property name="prefix" value="/WEB-INF/jsp/"/&gt;
   &lt;property name="suffix" value=".jsp"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>And one of my controllers includes the following method:</p>
  
  <pre><code> @RequestMapping(value = "/shoutouts", method = RequestMethod.POST) 
   public String post(@RequestBody ShoutOut shoutOut) {
  
    logger.info("In shout outs controller: post().");
  
    shoutOutDao.save(shoutOut);
  
    return "OK";
  
   }
  </code></pre>
  
  <p>Everything in the method executes fine when I post to this URL, but when Spring goes to display <code>/WEB-INF/jsp/OK.jsp</code>, I get the following warning:</p>
  
  <pre><code> 2010-06-22 18:34:51,993  WARN [http-8080-2] org.springframework.web.servlet.PageNotFound (DispatcherServlet.java:965) - No mapping found for HTTP request with URI [/addicted/WEB-INF/jsp/OK.jsp] in DispatcherServlet with name 'addictedWebServices'
  </code></pre>
  
  <p>And Tomcat throws up a 404. It appears the DispatcherServlet handles the URL because my servlet-mapping's url-pattern is set to /**. How can I get around this? Everything executes fine if I change the servlet-mapping url-pattern to **.do and then make all the related changes to my Spring MVC annotations. </p>
  
  <p>Thanks for your help!</p>