Browse Source

Merge branch '5.3.x'

# Conflicts:
#	gradle.properties
pull/27589/head
Sam Brannen 3 years ago
parent
commit
59beef71df
  1. 10
      spring-web/src/main/java/org/springframework/http/HttpEntity.java

10
spring-web/src/main/java/org/springframework/http/HttpEntity.java

@ -1,5 +1,5 @@ @@ -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; @@ -23,12 +23,12 @@ import org.springframework.util.ObjectUtils;
/**
* Represents an HTTP request or response entity, consisting of headers and body.
*
* <p>Typically used in combination with the {@link org.springframework.web.client.RestTemplate},
* <p>Often used in combination with the {@link org.springframework.web.client.RestTemplate},
* like so:
* <pre class="code">
* HttpHeaders headers = new HttpHeaders();
* headers.setContentType(MediaType.TEXT_PLAIN);
* HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(helloWorld, headers);
* HttpEntity&lt;String&gt; entity = new HttpEntity&lt;&gt;("Hello World", headers);
* URI location = template.postForLocation("https://example.com", entity);
* </pre>
* or
@ -39,11 +39,11 @@ import org.springframework.util.ObjectUtils; @@ -39,11 +39,11 @@ import org.springframework.util.ObjectUtils;
* </pre>
* Can also be used in Spring MVC, as a return value from a @Controller method:
* <pre class="code">
* &#64;RequestMapping("/handle")
* &#64;GetMapping("/handle")
* public HttpEntity&lt;String&gt; handle() {
* HttpHeaders responseHeaders = new HttpHeaders();
* responseHeaders.set("MyResponseHeader", "MyValue");
* return new HttpEntity&lt;String&gt;("Hello World", responseHeaders);
* return new HttpEntity&lt;&gt;("Hello World", responseHeaders);
* }
* </pre>
*

Loading…
Cancel
Save