Class BodyParser

java.lang.Object
com.creativityfactory.swiftserver.utils.BodyParser

public class BodyParser extends Object
A utility class that parses the body of an HTTP request.
  • Constructor Details

    • BodyParser

      public BodyParser()
  • Method Details

    • urlEncoded

      public static Map<String,String> urlEncoded(String body, String encoding)
      Parses the URL-encoded body of an HTTP request and returns a map of key-value pairs.
      Parameters:
      body - the URL-encoded body string to be parsed
      encoding - the character encoding to be used for decoding the URL-encoded string
      Returns:
      a map of key-value pairs parsed from the URL-encoded body string
      Throws:
      NullPointerException - if the body or encoding is null
      IllegalArgumentException - if the encoding is not supported