T
- ボディ型 public class RequestEntity<T> extends HttpEntity<T>
HttpEntity
の拡張。RestTemplate
で使用してリクエストを準備し、@Controller
メソッドでリクエスト入力を表します。RestTemplate
での使用例:
MyRequest body = ... RequestEntity<MyRequest> request = RequestEntity .post("https://example.com/{foo}", "bar") .accept(MediaType.APPLICATION_JSON) .body(body); ResponseEntity<MyResponse> response = template.exchange(request, MyResponse.class);
@Controller
での使用例:
@RequestMapping("/handle") public void handle(RequestEntity<String> request) { HttpMethod method = request.getMethod(); URI url = request.getUrl(); String body = request.getBody(); }
getMethod()
, getUrl()
, RestOperations.exchange(RequestEntity, Class)
, ResponseEntity
修飾子と型 | クラスと説明 |
---|---|
static interface | RequestEntity.BodyBuilder レスポンスエンティティに本文を追加するビルダーを定義します。 |
static interface | RequestEntity.HeadersBuilder<B extends RequestEntity.HeadersBuilder<B>> リクエストエンティティにヘッダーを追加するビルダーを定義します。 |
static class | RequestEntity.UriTemplateRequestEntity<T> URI SE の代わりに URI テンプレートと変数で初期化された RequestEntity |
EMPTY
コンストラクターと説明 |
---|
RequestEntity(HttpMethod method, URISE url) メソッドと URL はあるが、本文もヘッダーもないコンストラクター。 |
RequestEntity(MultiValueMap<StringSE, StringSE> headers, HttpMethod method, URISE url) メソッド、URL、ヘッダーはあるが本文はないコンストラクター。 |
RequestEntity(T body, HttpMethod method, URISE url) メソッド、URL、ボディはあるがヘッダーはないコンストラクター。 |
RequestEntity(T body, HttpMethod method, URISE url, TypeSE type) メソッド、URL、ボディ、型はあるがヘッダーはないコンストラクター。 |
RequestEntity(T body, MultiValueMap<StringSE, StringSE> headers, HttpMethod method, URISE url) メソッド、URL、ヘッダー、本文を含むコンストラクター。 |
RequestEntity(T body, MultiValueMap<StringSE, StringSE> headers, HttpMethod method, URISE url, TypeSE type) メソッド、URL、ヘッダー、ボディ、型を持つコンストラクター。 |
修飾子と型 | メソッドと説明 |
---|---|
static RequestEntity.HeadersBuilder<?> | delete(StringSE uriTemplate, ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP DELETE ビルダーを作成します。 |
static RequestEntity.HeadersBuilder<?> | delete(URISE url) 指定された URL で HTTP DELETE ビルダーを作成します。 |
boolean | equals(ObjectSE other) |
static RequestEntity.HeadersBuilder<?> | get(StringSE uriTemplate, ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP GET ビルダーを作成します。 |
static RequestEntity.HeadersBuilder<?> | get(URISE url) 指定された URL で HTTP GET ビルダーを作成します。 |
HttpMethod | getMethod() リクエストの HTTP メソッドを返します。 |
TypeSE | getType() リクエストのボディの型を返します。 |
URISE | getUrl() リクエストの URL を返します。 |
int | hashCode() |
static RequestEntity.HeadersBuilder<?> | head(StringSE uriTemplate, ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP HEAD ビルダーを作成します。 |
static RequestEntity.HeadersBuilder<?> | head(URISE url) 指定された URL で HTTP HEAD ビルダーを作成します。 |
static RequestEntity.BodyBuilder | method(HttpMethod method, StringSE uriTemplate, MapSE<StringSE,?> uriVariables) 指定された HTTP メソッド、URI テンプレート、変数を使用してビルダーを作成します。 |
static RequestEntity.BodyBuilder | method(HttpMethod method, StringSE uriTemplate, ObjectSE... uriVariables) 指定された HTTP メソッド、URI テンプレート、変数を使用してビルダーを作成します。 |
static RequestEntity.BodyBuilder | method(HttpMethod method, URISE url) 指定されたメソッドと URL でビルダーを作成します。 |
static RequestEntity.HeadersBuilder<?> | options(StringSE uriTemplate, ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP OPTIONS ビルダーを作成します。 |
static RequestEntity.HeadersBuilder<?> | options(URISE url) 指定された URL で HTTP OPTIONS ビルダーを作成します。 |
static RequestEntity.BodyBuilder | patch(StringSE uriTemplate, ObjectSE... uriVariables) 指定された文字列ベースの uri テンプレートを使用して HTTP PATCH ビルダーを作成します。 |
static RequestEntity.BodyBuilder | patch(URISE url) 指定された URL で HTTP PATCH ビルダーを作成します。 |
static RequestEntity.BodyBuilder | post(StringSE uriTemplate, ObjectSE... uriVariables) 指定された文字列ベースの uri テンプレートを使用して HTTP POST ビルダーを作成します。 |
static RequestEntity.BodyBuilder | post(URISE url) 指定された URL で HTTP POST ビルダーを作成します。 |
static RequestEntity.BodyBuilder | put(StringSE uriTemplate, ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP PUT ビルダーを作成します。 |
static RequestEntity.BodyBuilder | put(URISE url) 指定された URL で HTTP PUT ビルダーを作成します。 |
StringSE | toString() |
getBody, getHeaders, hasBody
cloneSE, finalizeSE, getClassSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
public RequestEntity(HttpMethod method, URISE url)
method
- メソッド url
- URLpublic RequestEntity(@Nullable T body, HttpMethod method, URISE url)
body
- 体 method
- メソッド url
- URLpublic RequestEntity(@Nullable T body, HttpMethod method, URISE url, TypeSE type)
body
- 体 method
- メソッド url
- URLtype
- ジェネリクス型解決に使用される型 public RequestEntity(MultiValueMap<StringSE,StringSE> headers, HttpMethod method, URISE url)
headers
- ヘッダー method
- メソッド url
- URLpublic RequestEntity(@Nullable T body, @Nullable MultiValueMap<StringSE,StringSE> headers, @Nullable HttpMethod method, URISE url)
body
- 体 headers
- ヘッダー method
- メソッド url
- URL@Nullable public HttpMethod getMethod()
HttpMethod
列挙値としての HTTP メソッド public URISE getUrl()
public boolean equals(@Nullable ObjectSE other)
HttpEntity<T>
の equals
public int hashCode()
HttpEntity<T>
の hashCode
public StringSE toString()
HttpEntity<T>
の toString
public static RequestEntity.BodyBuilder method(HttpMethod method, URISE url)
method
- HTTP メソッド (GET、POST など)url
- URLpublic static RequestEntity.BodyBuilder method(HttpMethod method, StringSE uriTemplate, ObjectSE... uriVariables)
method
- HTTP メソッド (GET、POST など)uriTemplate
- 使用する uri テンプレート uriVariables
- URI テンプレートを展開する変数 public static RequestEntity.BodyBuilder method(HttpMethod method, StringSE uriTemplate, MapSE<StringSE,?> uriVariables)
method
- HTTP メソッド (GET、POST など)uriTemplate
- 使用する uri テンプレート public static RequestEntity.HeadersBuilder<?> get(URISE url)
url
- URLpublic static RequestEntity.HeadersBuilder<?> get(StringSE uriTemplate, ObjectSE... uriVariables)
uriTemplate
- 使用する uri テンプレート uriVariables
- URI テンプレートを展開する変数 public static RequestEntity.HeadersBuilder<?> head(URISE url)
url
- URLpublic static RequestEntity.HeadersBuilder<?> head(StringSE uriTemplate, ObjectSE... uriVariables)
uriTemplate
- 使用する uri テンプレート uriVariables
- URI テンプレートを展開する変数 public static RequestEntity.BodyBuilder post(URISE url)
url
- URLpublic static RequestEntity.BodyBuilder post(StringSE uriTemplate, ObjectSE... uriVariables)
uriTemplate
- 使用する uri テンプレート uriVariables
- URI テンプレートを展開する変数 public static RequestEntity.BodyBuilder put(URISE url)
url
- URLpublic static RequestEntity.BodyBuilder put(StringSE uriTemplate, ObjectSE... uriVariables)
uriTemplate
- 使用する uri テンプレート uriVariables
- URI テンプレートを展開する変数 public static RequestEntity.BodyBuilder patch(URISE url)
url
- URLpublic static RequestEntity.BodyBuilder patch(StringSE uriTemplate, ObjectSE... uriVariables)
uriTemplate
- 使用する uri テンプレート uriVariables
- URI テンプレートを展開する変数 public static RequestEntity.HeadersBuilder<?> delete(URISE url)
url
- URLpublic static RequestEntity.HeadersBuilder<?> delete(StringSE uriTemplate, ObjectSE... uriVariables)
uriTemplate
- 使用する uri テンプレート uriVariables
- URI テンプレートを展開する変数 public static RequestEntity.HeadersBuilder<?> options(URISE url)
url
- URLpublic static RequestEntity.HeadersBuilder<?> options(StringSE uriTemplate, ObjectSE... uriVariables)
uriTemplate
- 使用する uri テンプレート uriVariables
- URI テンプレートを展開する変数