相关疑难解决方法(0)

HTTP请求+响应的名称

我在rfc 2616中找不到一件事,那就是请求/响应对的"规范"名称.有这样的事吗?

  4.1 Message Types

    HTTP messages consist of requests from client to server and responses
    from server to client.

       HTTP-message   = Request | Response     ; HTTP/1.1 messages

以此为模板,你会在下面的句子中加入哪个单词?

  A single complete HTTP ... consists of one HTTP Request and one HTTP Response

       HTTP-... = Request Response 

往返?周期?

naming http

28
推荐指数
2
解决办法
2860
查看次数

什么是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<MediaType> acceptableMediaTypes = new ArrayList<MediaType>();
    acceptableMediaTypes.add(MediaType.IMAGE_JPEG);

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

    // Send the request as GET
    ResponseEntity<byte[]> 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());
}
Run Code Online (Sandbox Code Playgroud)

rest resttemplate

25
推荐指数
3
解决办法
6万
查看次数

标签 统计

http ×1

naming ×1

rest ×1

resttemplate ×1