java.lang.Object
io.github.jeemv.springboot.vuejs.utilities.Http

public class Http extends Object
Http class for Http requests
  • Field Details

    • RESPONSE_DATA

      public static String RESPONSE_DATA
  • Constructor Details

    • Http

      public Http()
  • Method Details

    • submitForm

      public static String submitForm(String formRef, String action, String successCallback, String errorCallback)
      Submits an existing form
      Parameters:
      formRef - the Vuejs form ref
      action - the action (url for submit)
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • submitForm

      public static String submitForm(String formRef, String action, String successCallback)
      Submits an existing form
      Parameters:
      formRef - the Vuejs form ref
      action - the action (url for submit)
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • submitForm

      public static String submitForm(String formRef, String successCallback)
      Submits a form (form action must be provided on the html form)
      Parameters:
      formRef - the ref attribute of the form
      successCallback - the javascript code to execute if success
      Returns:
      the generated javascript code
    • request

      public static String request(String method, String url, Object data, String successCallback, String errorCallback)
      Sends a request
      Parameters:
      method - the http method (get,post,delete,patch,put,options,head)
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • request

      public static String request(String method, String url, Object data, String successCallback)
      Sends a request
      Parameters:
      method - the http method (get,post,delete,patch,put,options,head)
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • get

      public static String get(String url, Object data, String successCallback, String errorCallback)
      Sends a get request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • get

      public static String get(String url, Object data, String successCallback)
      Sends a get request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • get

      public static String get(String url, String successCallback)
      Sends a get request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • get

      public static String get(String url, String successCallback, String errorCallback)
      Sends a get request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • delete

      public static String delete(String url, Object data, String successCallback, String errorCallback)
      Sends a delete request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • delete

      public static String delete(String url, Object data, String successCallback)
      Sends a delete request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • delete

      public static String delete(String url, String successCallback)
      Sends a delete request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • delete

      public static String delete(String url, String successCallback, String errorCallback)
      Sends a delete request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • put

      public static String put(String url, Object data, String successCallback, String errorCallback)
      Sends a put request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • put

      public static String put(String url, Object data, String successCallback)
      Sends a put request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • put

      public static String put(String url, String successCallback)
      Sends a put request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • put

      public static String put(String url, String successCallback, String errorCallback)
      Sends a put request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • patch

      public static String patch(String url, Object data, String successCallback, String errorCallback)
      Sends a patch request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • patch

      public static String patch(String url, Object data, String successCallback)
      Sends a patch request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • patch

      public static String patch(String url, String successCallback)
      Sends a patch request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • patch

      public static String patch(String url, String successCallback, String errorCallback)
      Sends a patch request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • post

      public static String post(String url, Object data, String successCallback, String errorCallback)
      Sends a post request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      errorCallback - the javascript code to execute on error (parameter response)
      Returns:
    • post

      public static String post(String url, Object data, String successCallback)
      Sends a post request
      Parameters:
      url - the url to request
      data - the data to send to the request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • post

      public static String post(String url, String successCallback)
      Sends a post request
      Parameters:
      url - the url to request
      successCallback - the javascript code to execute if success (parameter response)
      Returns:
    • setRequestHeader

      public static String setRequestHeader(String key, String value)
      Defines a request header.
      Parameters:
      key - the header key
      value - the header value
      Returns:
      the javascript generated
    • responseToArray

      public static String responseToArray(String array)
      Adds response.data to an array.
      Parameters:
      array - the array to update
      Returns:
      the javascript generated
    • responseToArray

      public static String responseToArray(String array, String part)
      Adds response.data.{part} to an array.
      Parameters:
      array - the array to update
      Returns:
      the javascript generated
    • responseArrayToArray

      public static String responseArrayToArray(String array)
      Adds response.data array to an array.
      Parameters:
      array - the array to update
      Returns:
      the javascript generated
    • responseArrayToArray

      public static String responseArrayToArray(String array, String part)
      Adds response.data.{part} array to an array.
      Parameters:
      array - the array to update
      Returns:
      the javascript generated
    • setResponseToVariable

      public static String setResponseToVariable(String variable)
      Sets response.data to a variable
      Parameters:
      variable -
      Returns:
    • setResponseToVariable

      public static String setResponseToVariable(String variable, String part)
      Sets response.data.{part} to a variable
      Parameters:
      variable -
      part -
      Returns: