Для чего нужен метод restTemplate.exchange ()?

На самом деле, что делаетrestTemplate.exchange() метод сделать?

@RequestMapping(value = "/getphoto", method = RequestMethod.GET)
public void getPhoto(@RequestParam("id") Long id, HttpServletResponse response) {

    logger.debug("Retrieve photo with id: " + id);

    // Prepare acceptable media type
    List acceptableMediaTypes = new ArrayList();
    acceptableMediaTypes.add(MediaType.IMAGE_JPEG);

    // Prepare header
    HttpHeaders headers = new HttpHeaders();
    headers.setAccept(acceptableMediaTypes);
    HttpEntity entity = new HttpEntity(headers);

    // Send the request as GET
    ResponseEntity result = 
        restTemplate.exchange("http://localhost:7070/spring-rest-provider/krams/person/{id}", 
                              HttpMethod.GET, entity, byte[].class, id);

    // Display the image
    Writer.write(response, result.getBody());
}

Ответы на вопрос(3)

Ваш ответ на вопрос