Is there a way to use the same path but separated based on the value of the header with out spring framework. I'm looking for an equivalent of the below code in JAX-RS
@RequestMapping(value = "/request", headers={"range=include"})
public ResponseEntity<SomeObject> processWithView() {
return processRequestSomeOther();
}
// request handling (no headers specified)
@RequestMapping(value = "/request")
public ResponseEntity<SomeObject> processWithoutView() {
return processRequest();
}
Not exactly like that. But something like:
@Path("/request")
public ResponseEntity<SomeObject> processViews(@HeaderParam("range") String range) {
if( range == null )
return processRequest();
return processRequestSomeOther();
}
will do the same thing. Obviously you can parse the headers directly too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.