I need to pass a token variable through an HTTP Header, so that I can process it within the method it calls. I am using a wildcard 1 for this:
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, headers = {"Accept=application/json","Token=*"})
public ResponseEntity<String> deleteFromJson(@PathVariable("id") Integer id , @RequestHeader("Token") String token) {
}
It happens that whenever I send any header like "Token: 123", it is ignored by the application and does not enter the method. It only enters it when I send the header "Token: *" just exactly as defined, thus ignoring the wildcard.
Any ideas on what can go wrong? Thanks.
As the javadoc states
Also supports media type wildcards (*), for headers such as Accept and Content-Type.
You can't use it for others.
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.