This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Services and the fly likes Defaulting Request Header in REST service using spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Defaulting Request Header in REST service using spring" Watch "Defaulting Request Header in REST service using spring" New topic

Defaulting Request Header in REST service using spring

Ganesh Kumar C V

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,

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>
<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']]

I agree. Here's the link:
subject: Defaulting Request Header in REST service using spring
Similar Threads
Error is Spring MVC - items should be Map, Array or a collection.
org.springframework.web.HttpSessionRequiredException: Session attribute 'user' required - not found
Not able to render view in Spring 2.5 with Tiles2
Integrating hibernate with spring