Module bus.vortex

Enum Class Format

java.lang.Object
java.lang.Enum<Format>
org.miaixz.bus.vortex.Format
All Implemented Interfaces:
Serializable, Comparable<Format>, Constable

public enum Format extends Enum<Format>
数据格式枚举,定义支持的响应数据格式及其相关属性,并提供日志记录功能。

该枚举类用于标识响应数据的格式(如 XML、JSON、PDF、文件流),每个格式关联特定的数据提供者和媒体类型。 同时提供静态方法用于记录不同级别的日志(错误、警告、调试等)以及请求的开始和结束日志。

Since:
Java 17+
Author:
Kimi Liu
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    二进制文件流,表示响应数据以文件流形式输出。
    JSON 格式,表示响应数据以 JSON 格式输出。
    PDF 格式,表示响应数据以 PDF 格式输出。
    XML 格式,表示响应数据以 XML 格式输出。
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    debug(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
    记录调试级别的日志。
    static void
    error(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
    记录错误级别的日志。
    static void
    info(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
    记录信息级别的日志。
    static void
    requestEnd(org.springframework.web.server.ServerWebExchange exchange, int statusCode)
    记录请求结束的日志。
    static void
    requestStart(org.springframework.web.server.ServerWebExchange exchange)
    记录请求开始的日志。
    static void
    trace(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
    记录跟踪级别的日志。
    static Format
    Returns the enum constant of this class with the specified name.
    static Format[]
    Returns an array containing the constants of this enum class, in the order they are declared.
    static void
    warn(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
    记录警告级别的日志。

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • XML

      public static final Format XML
      XML 格式,表示响应数据以 XML 格式输出。
    • JSON

      public static final Format JSON
      JSON 格式,表示响应数据以 JSON 格式输出。
    • PDF

      public static final Format PDF
      PDF 格式,表示响应数据以 PDF 格式输出。
    • BINARY

      public static final Format BINARY
      二进制文件流,表示响应数据以文件流形式输出。
  • Method Details

    • values

      public static Format[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Format valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • error

      public static void error(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
      记录错误级别的日志。

      使用 Logger.error(String, Object...) 记录错误日志,包含跟踪 ID、HTTP 方法、请求路径、操作描述和详细信息。

      Parameters:
      exchange - ServerWebExchange 对象,包含请求和响应的上下文信息
      operation - 操作描述,用于标识日志的操作类型
      message - 详细的错误信息
    • warn

      public static void warn(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
      记录警告级别的日志。

      使用 Logger.warn(String, Object...) 记录警告日志,包含跟踪 ID、HTTP 方法、请求路径、操作描述和详细信息。

      Parameters:
      exchange - ServerWebExchange 对象,包含请求和响应的上下文信息
      operation - 操作描述,用于标识日志的操作类型
      message - 详细的警告信息
    • info

      public static void info(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
      记录信息级别的日志。

      使用 Logger.info(String, Object...) 记录信息日志,包含跟踪 ID、HTTP 方法、请求路径、操作描述和详细信息。

      Parameters:
      exchange - ServerWebExchange 对象,包含请求和响应的上下文信息
      operation - 操作描述,用于标识日志的操作类型
      message - 详细的信息
    • debug

      public static void debug(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
      记录调试级别的日志。

      使用 Logger.debug(String, Object...) 记录调试日志,包含跟踪 ID、HTTP 方法、请求路径、操作描述和详细信息。

      Parameters:
      exchange - ServerWebExchange 对象,包含请求和响应的上下文信息
      operation - 操作描述,用于标识日志的操作类型
      message - 详细的调试信息
    • trace

      public static void trace(org.springframework.web.server.ServerWebExchange exchange, String operation, String message)
      记录跟踪级别的日志。

      使用 Logger.trace(String, Object...) 记录跟踪日志,包含跟踪 ID、HTTP 方法、请求路径、操作描述和详细信息。

      Parameters:
      exchange - ServerWebExchange 对象,包含请求和响应的上下文信息
      operation - 操作描述,用于标识日志的操作类型
      message - 详细的跟踪信息
    • requestStart

      public static void requestStart(org.springframework.web.server.ServerWebExchange exchange)
      记录请求开始的日志。

      记录请求的开始信息,包括 HTTP 方法、请求路径和查询参数。 如果 exchange 或上下文为 null,则直接返回,不记录日志。

      Parameters:
      exchange - ServerWebExchange 对象,包含请求和响应的上下文信息
    • requestEnd

      public static void requestEnd(org.springframework.web.server.ServerWebExchange exchange, int statusCode)
      记录请求结束的日志。

      记录请求的结束信息,包括 HTTP 方法、请求路径、响应状态码和执行时间。 如果 exchange 或上下文为 null,则直接返回,不记录日志。

      Parameters:
      exchange - ServerWebExchange 对象,包含请求和响应的上下文信息
      statusCode - 响应状态码