クラス RequestEntity<T>
java.lang.ObjectSE
org.springframework.http.HttpEntity<T>
org.springframework.http.RequestEntity<T>
- 型パラメーター:
T- ボディ型
- 既知の直属サブクラス
RequestEntity.UriTemplateRequestEntity
HTTP メソッドとターゲット URL も公開する
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();
}
- 導入:
- 4.1
- 作成者:
- Arjen Poutsma, Sebastien Deleuze, Parviz Rozikov
- 関連事項:
ネストされたクラスの要約
ネストされたクラス修飾子と型クラス説明static interfaceレスポンスエンティティに本文を追加するビルダーを定義します。static interfaceリクエストエンティティにヘッダーを追加するビルダーを定義します。static classURISE の代わりに URI テンプレートと変数で初期化された RequestEntityフィールドのサマリー
クラス HttpEntity から継承されたフィールド
EMPTYコンストラクターの概要
コンストラクターコンストラクター説明RequestEntity(@Nullable T body, @Nullable HttpHeaders headers, @Nullable HttpMethod method, @Nullable URISE url, @Nullable TypeSE type) メソッド、URL、ヘッダー、ボディ、型を持つコンストラクター。RequestEntity(@Nullable T body, @Nullable HttpHeaders headers, @Nullable HttpMethod method, URISE url) メソッド、URL、ヘッダー、本文を含むコンストラクター。RequestEntity(@Nullable T body, HttpMethod method, URISE url) メソッド、URL、ボディはあるがヘッダーはないコンストラクター。RequestEntity(@Nullable T body, HttpMethod method, URISE url, TypeSE type) メソッド、URL、ボディ、型はあるがヘッダーはないコンストラクター。RequestEntity(@Nullable T body, @Nullable MultiValueMap<StringSE, StringSE> headers, @Nullable HttpMethod method, @Nullable URISE url, @Nullable TypeSE type) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。RequestEntity(@Nullable T body, @Nullable MultiValueMap<StringSE, StringSE> headers, @Nullable HttpMethod method, URISE url) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。RequestEntity(HttpHeaders headers, HttpMethod method, URISE url) メソッド、URL、ヘッダーはあるが本文はないコンストラクター。RequestEntity(HttpMethod method, URISE url) メソッドと URL はあるが、本文もヘッダーもないコンストラクター。RequestEntity(MultiValueMap<StringSE, StringSE> headers, HttpMethod method, URISE url) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。メソッドのサマリー
修飾子と型メソッド説明static RequestEntity.HeadersBuilder<?> 指定された文字列ベースの URI テンプレートを使用して HTTP DELETE ビルダーを作成します。static RequestEntity.HeadersBuilder<?> 指定された URL で HTTP DELETE ビルダーを作成します。booleanstatic RequestEntity.HeadersBuilder<?> 指定された文字列ベースの URI テンプレートを使用して HTTP GET ビルダーを作成します。static RequestEntity.HeadersBuilder<?> 指定された URL で HTTP GET ビルダーを作成します。リクエストの HTTP メソッドを返します。getType()リクエストのボディの型を返します。getUrl()ターゲット HTTP エンドポイントのURISE を返します。inthashCode()static RequestEntity.HeadersBuilder<?> 指定された文字列ベースの URI テンプレートを使用して HTTP HEAD ビルダーを作成します。static RequestEntity.HeadersBuilder<?> 指定された URL で HTTP HEAD ビルダーを作成します。static RequestEntity.BodyBuildermethod(HttpMethod method, StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された HTTP メソッド、URI テンプレート、変数を使用してビルダーを作成します。static RequestEntity.BodyBuildermethod(HttpMethod method, StringSE uriTemplate, MapSE<StringSE, ?> uriVariables) 指定された HTTP メソッド、URI テンプレート、変数を使用してビルダーを作成します。static RequestEntity.BodyBuildermethod(HttpMethod method, URISE url) 指定されたメソッドと URL でビルダーを作成します。static RequestEntity.HeadersBuilder<?> 指定された文字列ベースの URI テンプレートを使用して HTTP OPTIONS ビルダーを作成します。static RequestEntity.HeadersBuilder<?> 指定された URL で HTTP OPTIONS ビルダーを作成します。static RequestEntity.BodyBuilder指定された文字列ベースの uri テンプレートを使用して HTTP PATCH ビルダーを作成します。static RequestEntity.BodyBuilder指定された URL で HTTP PATCH ビルダーを作成します。static RequestEntity.BodyBuilder指定された文字列ベースの uri テンプレートを使用して HTTP POST ビルダーを作成します。static RequestEntity.BodyBuilder指定された URL で HTTP POST ビルダーを作成します。static RequestEntity.BodyBuilder指定された文字列ベースの URI テンプレートを使用して HTTP PUT ビルダーを作成します。static RequestEntity.BodyBuilder指定された URL で HTTP PUT ビルダーを作成します。toString()クラス HttpEntity から継承されたメソッド
getBody, getHeaders, hasBody
コンストラクターの詳細
RequestEntity
メソッドと URL はあるが、本文もヘッダーもないコンストラクター。- パラメーター:
method- メソッドurl- URL
RequestEntity
メソッド、URL、ボディはあるがヘッダーはないコンストラクター。- パラメーター:
body- 体method- メソッドurl- URL
RequestEntity
メソッド、URL、ボディ、型はあるがヘッダーはないコンストラクター。- パラメーター:
body- 体method- メソッドurl- URLtype- ジェネリクス型解決に使用される型- 導入:
- 4.3
RequestEntity
メソッド、URL、ヘッダーはあるが本文はないコンストラクター。- パラメーター:
headers- ヘッダーmethod- メソッドurl- URL- 導入:
- 7.0
RequestEntity
public RequestEntity(@Nullable T body, @Nullable HttpHeaders headers, @Nullable HttpMethod method, URISE url) メソッド、URL、ヘッダー、本文を含むコンストラクター。- パラメーター:
body- 体headers- ヘッダーmethod- メソッドurl- URL- 導入:
- 7.0
RequestEntity
public RequestEntity(@Nullable T body, @Nullable HttpHeaders headers, @Nullable HttpMethod method, @Nullable URISE url, @Nullable TypeSE type) メソッド、URL、ヘッダー、ボディ、型を持つコンストラクター。- パラメーター:
body- 体headers- ヘッダーmethod- メソッドurl- URLtype- ジェネリクス型解決に使用される型- 導入:
- 7.0
RequestEntity
@DeprecatedSE(since="7.0", forRemoval=true) public RequestEntity(MultiValueMap<StringSE, StringSE> headers, HttpMethod method, URISE url) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。メソッド、URL、ヘッダーはあるが本文はないコンストラクター。- パラメーター:
headers- ヘッダーmethod- メソッドurl- URL
RequestEntity
@DeprecatedSE(since="7.0", forRemoval=true) public RequestEntity(@Nullable T body, @Nullable MultiValueMap<StringSE, StringSE> headers, @Nullable HttpMethod method, URISE url) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。メソッド、URL、ヘッダー、本文を含むコンストラクター。- パラメーター:
body- 体headers- ヘッダーmethod- メソッドurl- URL
RequestEntity
@DeprecatedSE(since="7.0", forRemoval=true) public RequestEntity(@Nullable T body, @Nullable MultiValueMap<StringSE, StringSE> headers, @Nullable HttpMethod method, @Nullable URISE url, @Nullable TypeSE type) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。メソッド、URL、ヘッダー、ボディ、型を持つコンストラクター。- パラメーター:
body- 体headers- ヘッダーmethod- メソッドurl- URLtype- ジェネリクス型解決に使用される型- 導入:
- 4.3
メソッドの詳細
getMethod
getUrl
ターゲット HTTP エンドポイントのURISE を返します。注意 :
RequestEntityがURISE インスタンスではなく URI テンプレートと変数で作成された場合、このメソッドはUnsupportedOperationExceptionSE を発生させます。これは、テンプレートを展開して URI をエンコードする方法をさらに入力しないと URI を作成できないためです。このような場合、URIは、それが構成されているUriTemplateHandlerの助けを借りて、RestTemplateによって準備されます。getType
equals
- オーバーライド:
- クラス
HttpEntity<T>のequals
hashCode
public int hashCode()- オーバーライド:
- クラス
HttpEntity<T>のhashCode
toString
- オーバーライド:
- クラス
HttpEntity<T>のtoString
method
指定されたメソッドと URL でビルダーを作成します。- パラメーター:
method- HTTP メソッド (GET、POST など)url- URL- 戻り値:
- 作成されたビルダー
method
public static RequestEntity.BodyBuilder method(HttpMethod method, StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された HTTP メソッド、URI テンプレート、変数を使用してビルダーを作成します。- パラメーター:
method- HTTP メソッド (GET、POST など)uriTemplate- 使用する uri テンプレートuriVariables- URI テンプレートを展開する変数- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
method
public static RequestEntity.BodyBuilder method(HttpMethod method, StringSE uriTemplate, MapSE<StringSE, ?> uriVariables) 指定された HTTP メソッド、URI テンプレート、変数を使用してビルダーを作成します。- パラメーター:
method- HTTP メソッド (GET、POST など)uriTemplate- 使用する uri テンプレート- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
get
指定された URL で HTTP GET ビルダーを作成します。- パラメーター:
url- URL- 戻り値:
- 作成されたビルダー
get
public static RequestEntity.HeadersBuilder<?> get(StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP GET ビルダーを作成します。- パラメーター:
uriTemplate- 使用する uri テンプレートuriVariables- URI テンプレートを展開する変数- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
head
指定された URL で HTTP HEAD ビルダーを作成します。- パラメーター:
url- URL- 戻り値:
- 作成されたビルダー
head
public static RequestEntity.HeadersBuilder<?> head(StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP HEAD ビルダーを作成します。- パラメーター:
uriTemplate- 使用する uri テンプレートuriVariables- URI テンプレートを展開する変数- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
post
指定された URL で HTTP POST ビルダーを作成します。- パラメーター:
url- URL- 戻り値:
- 作成されたビルダー
post
public static RequestEntity.BodyBuilder post(StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された文字列ベースの uri テンプレートを使用して HTTP POST ビルダーを作成します。- パラメーター:
uriTemplate- 使用する uri テンプレートuriVariables- URI テンプレートを展開する変数- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
put
指定された URL で HTTP PUT ビルダーを作成します。- パラメーター:
url- URL- 戻り値:
- 作成されたビルダー
put
public static RequestEntity.BodyBuilder put(StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP PUT ビルダーを作成します。- パラメーター:
uriTemplate- 使用する uri テンプレートuriVariables- URI テンプレートを展開する変数- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
patch
指定された URL で HTTP PATCH ビルダーを作成します。- パラメーター:
url- URL- 戻り値:
- 作成されたビルダー
patch
public static RequestEntity.BodyBuilder patch(StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された文字列ベースの uri テンプレートを使用して HTTP PATCH ビルダーを作成します。- パラメーター:
uriTemplate- 使用する uri テンプレートuriVariables- URI テンプレートを展開する変数- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
delete
指定された URL で HTTP DELETE ビルダーを作成します。- パラメーター:
url- URL- 戻り値:
- 作成されたビルダー
delete
public static RequestEntity.HeadersBuilder<?> delete(StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP DELETE ビルダーを作成します。- パラメーター:
uriTemplate- 使用する uri テンプレートuriVariables- URI テンプレートを展開する変数- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
options
指定された URL で HTTP OPTIONS ビルダーを作成します。- パラメーター:
url- URL- 戻り値:
- 作成されたビルダー
options
public static RequestEntity.HeadersBuilder<?> options(StringSE uriTemplate, @Nullable ObjectSE... uriVariables) 指定された文字列ベースの URI テンプレートを使用して HTTP OPTIONS ビルダーを作成します。- パラメーター:
uriTemplate- 使用する uri テンプレートuriVariables- URI テンプレートを展開する変数- 戻り値:
- 作成されたビルダー
- 導入:
- 5.3
RequestEntity(Object, HttpHeaders, HttpMethod, URI, Type)を推奨