java.lang.Object
dev.mccue.jdk.httpserver.json.JsonBody
All Implemented Interfaces:
dev.mccue.jdk.httpserver.Body

public final class JsonBody extends Object implements dev.mccue.jdk.httpserver.Body
An implementation of Body which will respond with Json.
  • Method Details

    • of

      public static JsonBody of(dev.mccue.json.JsonEncodable jsonEncodable)
      Creates a JsonBody.
      Parameters:
      jsonEncodable - The JSON to use.
      Returns:
      A JsonBody
    • writeTo

      public void writeTo(OutputStream outputStream) throws IOException
      Specified by:
      writeTo in interface dev.mccue.jdk.httpserver.Body
      Throws:
      IOException
    • responseLength

      public dev.mccue.jdk.httpserver.ResponseLength responseLength()
      Specified by:
      responseLength in interface dev.mccue.jdk.httpserver.Body
    • defaultContentType

      public Optional<String> defaultContentType()
      Specified by:
      defaultContentType in interface dev.mccue.jdk.httpserver.Body
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object