diff --git a/spring-web/src/main/java/org/springframework/http/HttpEntity.java b/spring-web/src/main/java/org/springframework/http/HttpEntity.java index d6493c4bed0..9b5be7c625a 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpEntity.java +++ b/spring-web/src/main/java/org/springframework/http/HttpEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,12 +23,12 @@ import org.springframework.util.ObjectUtils; /** * Represents an HTTP request or response entity, consisting of headers and body. * - *
Typically used in combination with the {@link org.springframework.web.client.RestTemplate}, + *
Often used in combination with the {@link org.springframework.web.client.RestTemplate}, * like so: *
* HttpHeaders headers = new HttpHeaders();
* headers.setContentType(MediaType.TEXT_PLAIN);
- * HttpEntity<String> entity = new HttpEntity<String>("helloWorld", headers);
+ * HttpEntity<String> entity = new HttpEntity<>("Hello World", headers);
* URI location = template.postForLocation("https://example.com", entity);
*
* or
@@ -39,11 +39,11 @@ import org.springframework.util.ObjectUtils;
*
* Can also be used in Spring MVC, as a return value from a @Controller method:
*
- * @RequestMapping("/handle")
+ * @GetMapping("/handle")
* public HttpEntity<String> handle() {
* HttpHeaders responseHeaders = new HttpHeaders();
* responseHeaders.set("MyResponseHeader", "MyValue");
- * return new HttpEntity<String>("Hello World", responseHeaders);
+ * return new HttpEntity<>("Hello World", responseHeaders);
* }
*
*