| Author |
Defaulting Request Header in REST service using spring
|
Ganesh Kumar C V
Greenhorn
Joined: May 12, 2011
Posts: 5
|
|
Hi - I have a controller which handles all the requests to a set of REST services. For one of the services, I defined the @RequestMapping like the below and its working fine.
@RequestMapping(value = "NetworkOrder/Note",
method = RequestMethod.GET,
headers="X-YY-Version=1.0")
The issue is that I need to default the value of this header 'X-YY-Version' to some value if the request does not contain this header set. Also the service should not complaint if the value is not available in the request. Right now I am getting the below exception if the header is not available in the request. Any help will be very useful.
<html><head><title>Apache Tomcat/7.0.11 - Error report</title><style>
</u></p><p><b>exception</b>
-----
-----
<pre>org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException: No matching handler method found for servlet request: path '/ServiceDelivery/Order/CustomerOrder/Note', method 'GET', parameters map['serviceOrderVersion' -> array<String>['100'], 'serviceOrderId' -> array<String>['1-HQRGH']]
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:646)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:431)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:575)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
Thanks
Ganesh
|
 |
 |
|
|
subject: Defaulting Request Header in REST service using spring
|
|
|