インターフェース ReactiveVaultClient.ResponseSpec

含まれているインターフェース:
ReactiveVaultClient

public static interface ReactiveVaultClient.ResponseSpec
交換後のレスポンス操作を指定するための契約。
  • メソッドの詳細

    • onStatus

      ReactiveVaultClient.ResponseSpec onStatus(PredicateSE<HttpStatusCode> statusPredicate, FunctionSE<ClientResponse,Mono<? extends ThrowableSE>> exceptionFunction)
      特定のエラーステータスコードをエラーシグナルにマップして、レスポンスではなく下流に伝搬する関数を提供します。

      デフォルトでは、一致するステータスハンドラーがない場合、ステータスコードが 400 以上のレスポンスは、ClientResponse.createException() で作成された VaultClientResponseException にマップされます。

      エラーとしてのステータスコードの処理を抑制し、それを通常のレスポンスとして処理するには、関数から Mono.empty() を返します。その後、レスポンスはダウンストリームに伝搬されて処理されます。

      エラーレスポンスを完全に無視し、レスポンスもエラーも伝播しないようにするには、filter を使用するか、onErrorResume ダウンストリームを追加します。例:

       webClient.get()
         .path("https://abc.com/account/123")
         .retrieve()
         .bodyToMono(Account.class)
         .onErrorResume(VaultClientResponseException.class,
           ex -> ex.getStatusCode().value() == 404 ? Mono.empty() : Mono.error(ex));
       
      パラメーター:
      statusPredicate - レスポンスを一致させる
      exceptionFunction - レスポンスをエラーシグナルにマッピングする
      戻り値:
      このビルダー
      関連事項:
    • wrap

      リクエストされた TTL を持つ cubbyhole トークンでレスポンスをラップします。
      パラメーター:
      ttl - ラップされたレスポンスの存続時間。
      戻り値:
      トークンとラップされたレスポンスのメタデータを提供する cubbyhole WrappedMetadata
      例外:
      VaultClientResponseException - ステータスコードが 4xx または 5xx のレスポンスを受信した場合。
      IllegalStateExceptionSE - レスポンスボディが利用できない場合。
    • body

      ボディをデコードして VaultResponse を取得します。エラーレスポンス(ステータスコードが 4xx または 5xx)の場合、Mono は VaultException を出力します。エラーレスポンスの処理をカスタマイズするには、onStatus(Predicate, Function) を使用します。
      戻り値:
      レスポンスボディ、またはレスポンスボディが利用できない場合は null
      例外:
      VaultClientResponseException - ステータスコードが 4xx または 5xx のレスポンスを受信した場合。
    • bodyToMono

      <T> Mono<T> bodyToMono(ClassSE<T> elementClass)
      本体を指定されたターゲット型にデコードします。エラーレスポンス(ステータスコード 4xx または 5xx)の場合、Mono は VaultClientResponseException を発行します。onStatus(Predicate, Function) を使用して、エラーレスポンス処理をカスタマイズします。
      型パラメーター:
      T - ゴールとする体型。
      パラメーター:
      elementClass - デコード先の型。
      戻り値:
      解読されたボディ。
    • bodyToMono

      <T> Mono<T> bodyToMono(ParameterizedTypeReference<T> elementTypeRef)
      ParameterizedTypeReference を使用した bodyToMono(Class) のバリアント。
      型パラメーター:
      T - 対象の体型
      パラメーター:
      elementTypeRef - デコードする型
      戻り値:
      デコードされた本体
    • bodyToFlux

      <T> Flux<T> bodyToFlux(ClassSE<T> elementClass)
      指定された型の要素を含む Flux にボディをデコードします。エラーレスポンス(ステータスコード 4xx または 5xx)の場合、Mono は VaultClientResponseException を出力します。エラーレスポンスの処理をカスタマイズするには、onStatus(Predicate, Function) を使用します。
      型パラメーター:
      T - the body element type.
      パラメーター:
      elementClass - the type of element to decode to.
      戻り値:
      解読されたボディ。
    • bodyToFlux

      <T> Flux<T> bodyToFlux(ParameterizedTypeReference<T> elementTypeRef)
      ParameterizedTypeReference を使用した bodyToFlux(Class) のバリアント。
      型パラメーター:
      T - the body element type.
      パラメーター:
      elementTypeRef - the type of element to decode to.
      戻り値:
      解読されたボディ。
    • toEntity

      <T> Mono<ResponseEntity<T>> toEntity(ClassSE<T> bodyClass)
      指定された型のオブジェクトにデコードされた本体を持つ ResponseEntity を返します。エラーレスポンス(ステータスコード 4xx または 5xx)の場合、Mono は VaultClientResponseException を発行します。onStatus(Predicate, Function) を使用して、エラーレスポンス処理をカスタマイズします。
      型パラメーター:
      T - response body type.
      パラメーター:
      bodyClass - the expected response body type.
      戻り値:
      復号された本体を持つ ResponseEntity
    • toEntity

      <T> Mono<ResponseEntity<T>> toEntity(ParameterizedTypeReference<T> bodyTypeRef)
      ParameterizedTypeReference を使用した toEntity(Class) のバリアント。
      型パラメーター:
      T - the response body type.
      パラメーター:
      bodyTypeRef - the expected response body type.
      戻り値:
      復号された本体を持つ ResponseEntity
    • toEntityList

      <T> Mono<ResponseEntity<ListSE<T>>> toEntityList(ClassSE<T> elementClass)
      指定された型の要素の List に本体がデコードされた ResponseEntity を返します。エラーレスポンス(ステータスコード 4xx または 5xx)の場合、Mono は VaultClientResponseException を発行します。onStatus(Predicate, Function) を使用して、エラーレスポンス処理をカスタマイズします。
      型パラメーター:
      T - the body element type.
      パラメーター:
      elementClass - the type of element to decode the target Flux to.
      戻り値:
      ResponseEntity
    • toEntityList

      <T> Mono<ResponseEntity<ListSE<T>>> toEntityList(ParameterizedTypeReference<T> elementTypeRef)
      ParameterizedTypeReference を使用した toEntityList(Class) のバリアント。
      型パラメーター:
      T - the body element type.
      パラメーター:
      elementTypeRef - ターゲット Flux をデコードする要素の型
      戻り値:
      ResponseEntity
    • toEntityFlux

      <T> Mono<ResponseEntity<Flux<T>>> toEntityFlux(ClassSE<T> elementType)
      指定された型の要素の Flux に本体がデコードされた ResponseEntity を返します。エラーレスポンス(ステータスコード 4xx または 5xx)の場合、Mono は VaultClientResponseException を発行します。onStatus(Predicate, Function) を使用して、エラーレスポンス処理をカスタマイズします。

      注意 : 本体を表す Flux はサブスクライブする必要があります。サブスクライブしないと、関連するリソースが解放されません。

      型パラメーター:
      T - the body element type.
      パラメーター:
      elementType - the type of element to decode the target Flux to.
      戻り値:
      ResponseEntity
    • toEntityFlux

      <T> Mono<ResponseEntity<Flux<T>>> toEntityFlux(ParameterizedTypeReference<T> elementTypeRef)
      ParameterizedTypeReference を使用した toEntityFlux(Class) のバリアント。
      型パラメーター:
      T - the body element type.
      パラメーター:
      elementTypeRef - the type of element to decode the target Flux to.
      戻り値:
      ResponseEntity
    • toBodilessEntity

      Mono<ResponseEntity<VoidSE>> toBodilessEntity()
      本体なしで ResponseEntity を返します。エラーレスポンス(ステータスコード 4xx または 5xx)の場合、Mono は VaultClientResponseException を発行します。onStatus(Predicate, Function) を使用して、エラーレスポンス処理をカスタマイズします。
      戻り値:
      ResponseEntity