Tuesday, 3 September 2013

Querying with RESTful url and .htm URL

Querying with RESTful url and .htm URL

URL with *.htm works fine. But I encounter a problem is when I try to
access RESTful URL without *.htm then the server gives me 404 error. Well
I can solve the problem by replacing *.htm with /. If I do that then I
break my webpages. So the question is how do I go about supporting RESTful
and regular HTTP request through the same Spring Controller? What needs to
be configured in Web.xml? I tried something like /rest/* but that does not
seems to be working either.
<servlet>
<servlet-name>dispatch</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatch</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
Tried
<servlet-mapping>
<servlet-name>dispatch</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

No comments:

Post a Comment