java.lang.Object
org.sentrysoftware.metricshub.engine.client.http.StringBody
All Implemented Interfaces:
Serializable, Body

public class StringBody extends Object implements Body
Represents an HTTP request body with a string content.
See Also:
  • Constructor Details

    • StringBody

      public StringBody()
  • Method Details

    • getContent

      public String getContent(String username, char[] password, String authenticationToken, @NonNull @NonNull String hostname)
      Description copied from interface: Body
      Gets the HTTP body content as a string and performs macro replacements.
      Specified by:
      getContent in interface Body
      Parameters:
      username - The HTTP username
      password - The HTTP password as a character array
      authenticationToken - The HTTP authentication token
      hostname - The remote hostname
      Returns:
      The HTTP body content with resolved and parsed HTTP macros
    • copy

      public Body copy()
      Description copied from interface: Body
      Performs a deep copy of the body.
      Specified by:
      copy in interface Body
      Returns:
      A new Body instance with the same content
    • description

      public String description()
      Description copied from interface: Body
      Gets a string description of the HTTP body.
      Specified by:
      description in interface Body
      Returns:
      The content of the HTTP body as a string
    • update

      public void update(UnaryOperator<String> updater)
      Description copied from interface: Body
      Updates the actual body attributes using the provided updater function.
      Specified by:
      update in interface Body
      Parameters:
      updater - The function to apply to the current body content