Record Class DownstreamHttpFailure

java.lang.Object
java.lang.Record
io.leandev.appfuse.http.exception.DownstreamHttpFailure
Record Components:
serviceName - 下游服務名稱
statusCode - 下游 HTTP 狀態碼
target - 已移除 query string 的下游請求路徑
reason - 下游 HTTP reason phrase

public record DownstreamHttpFailure(String serviceName, int statusCode, String target, String reason) extends Record

下游 HTTP 回應失敗的診斷脈絡。

此資訊只供伺服器端政策判斷與日誌使用;REST 錯誤回應不應直接序列化本物件, 以免洩漏下游服務名稱、狀態或端點資訊。

  • Constructor Details

    • DownstreamHttpFailure

      public DownstreamHttpFailure(String serviceName, int statusCode, String target, String reason)
      Creates an instance of a DownstreamHttpFailure record class.
      Parameters:
      serviceName - the value for the serviceName record component
      statusCode - the value for the statusCode record component
      target - the value for the target record component
      reason - the value for the reason record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • serviceName

      public String serviceName()
      Returns the value of the serviceName record component.
      Returns:
      the value of the serviceName record component
    • statusCode

      public int statusCode()
      Returns the value of the statusCode record component.
      Returns:
      the value of the statusCode record component
    • target

      public String target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component