spring - Url getting modified after request is received at the server -
i trying develop restful web service using spring framework apache tomcat. added 2 controller classes had 5-6 endpoints working fine. since yesterday when trying add endpoint getting strange error.
@controller @requestmapping("/test") public class textcontroller { @requestmapping(method=requestmethod.post) public void test() { system.out.println("hello world"); } }
when try url browser(using rest client) getting following output:
hello world jun 25, 2014 7:05:55 pm org.springframework.web.servlet.pagenotfound nohandlerfound warning: no mapping found http request uri [/chitchatapp/rest/test/test] in dispatcherservlet name 'chitchat-dispatcher'
the url showing "/test" appended. other apis still working fine. new ones adding giving error.
my web.xml looks this:
<web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="webapp_id" version="2.5"> <display-name>chitchat web service</display-name> <servlet> <servlet-name>chitchat-dispatcher</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet</servlet-class> <!-- creates spring container shared servlets , filters --> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/chitchat-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>chitchat-dispatcher</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> </web-app>
not sure why started happening of sudden. appreciate on this.
from @requestmapping("/test")
seems url should "somprefix/test" send request url "/chitchatapp/rest/test/test", mistake?
Comments
Post a Comment