Class Headers.Builder

java.lang.Object
org.miaixz.bus.http.Headers.Builder
Enclosing class:
Headers

public static class Headers.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • addLenient

      public Headers.Builder addLenient(String line)
      Add a header line without any validation. Only appropriate for headers from the remote peer or cache.
    • add

      public Headers.Builder add(String line)
      Add an header line containing a field name, a literal colon, and a value.
    • add

      public Headers.Builder add(String name, String value)
      Add a header with the specified name and value. Does validation of header names and values.
    • addUnsafeNonAscii

      public Headers.Builder addUnsafeNonAscii(String name, String value)
      Add a header with the specified name and value. Does validation of header names, allowing non-ASCII values.
    • addAll

      public Headers.Builder addAll(Headers headers)
      Adds all headers from an existing collection.
    • add

      public Headers.Builder add(String name, Date value)
      Add a header with the specified name and formatted date. Does validation of header names and value.
    • add

      public Headers.Builder add(String name, Instant value)
      Add a header with the specified name and formatted instant. Does validation of header names and value.
    • set

      public Headers.Builder set(String name, Date value)
      Set a field with the specified date. If the field is not found, it is added. If the field is found, the existing values are replaced.
    • set

      public Headers.Builder set(String name, Instant value)
      Set a field with the specified instant. If the field is not found, it is added. If the field is found, the existing values are replaced.
    • removeAll

      public Headers.Builder removeAll(String name)
    • set

      public Headers.Builder set(String name, String value)
      Set a field with the specified value. If the field is not found, it is added. If the field is found, the existing values are replaced.
    • get

      public String get(String name)
      Equivalent to build().get(name), but potentially faster.
    • build

      public Headers build()