I have a Java endpoint like this
@RequestMapping(method = RequestMethod.GET, value = "/{test}", produces = "application/app+json;version=1")
public ResponseEntity<List<Entity>> getEntity(@PathVariable Long test) {
return ........
}
Now am making call to this rest endpoint using restTempate via URIBuilder
String url = UriComponentsBuilder.fromHttpUrl(this.URL)
.path(API_URL)
.path("/{test}")
.buildAndExpand(test).toString(); //How to add Headers??
return Arrays.asList(restTemplate.getForObject(url, Entity[].class));
I am tryng to add the header on the rest endpoint call but not sure what is the right place to add it.
Or is there any other right way of doing it ? please suggest
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…