Class WebUtils

java.lang.Object
me.romvnly.TownyPlus.util.WebUtils

public class WebUtils extends Object
  • Constructor Details

    • WebUtils

      public WebUtils()
  • Method Details

    • getToken

      public static String getToken()
    • getBody

      public static String getBody(String reqURL)
      Makes a web request to the given URL and returns the body as a string
      Parameters:
      reqURL - URL to fetch
      Returns:
      Body contents or error message if the request fails
    • post

      public static String post(String reqURL, String postContent) throws IOException
      Post a string to the given URL
      Parameters:
      reqURL - URL to post to
      postContent - String data to post
      Returns:
      String returned by the server
      Throws:
      IOException
    • postForm

      public static String postForm(String reqURL, Map<String,String> fields) throws IOException
      Post fields to a URL as a form
      Parameters:
      reqURL - URL to post to
      fields - Form data to post
      Returns:
      String returned by the server
      Throws:
      IOException