Class Http
java.lang.Object
io.github.jeemv.springboot.vuejs.utilities.Http
Http class for Http requests
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringSends a delete requeststatic StringSends a delete requeststatic StringSends a delete requeststatic StringSends a delete requeststatic StringSends a get requeststatic StringSends a get requeststatic StringSends a get requeststatic StringSends a get requeststatic StringSends a patch requeststatic StringSends a patch requeststatic StringSends a patch requeststatic StringSends a patch requeststatic StringSends a post requeststatic StringSends a post requeststatic StringSends a post requeststatic StringSends a put requeststatic StringSends a put requeststatic StringSends a put requeststatic StringSends a put requeststatic StringSends a requeststatic StringSends a requeststatic StringresponseArrayToArray(String array) Adds response.data array to an array.static StringresponseArrayToArray(String array, String part) Adds response.data.static StringresponseToArray(String array) Adds response.data to an array.static StringresponseToArray(String array, String part) Adds response.data.static StringsetRequestHeader(String key, String value) Defines a request header.static StringsetResponseToVariable(String variable) Sets response.data to a variablestatic StringsetResponseToVariable(String variable, String part) Sets response.data.static StringsubmitForm(String formRef, String successCallback) Submits a form (form action must be provided on the html form)static StringsubmitForm(String formRef, String action, String successCallback) Submits an existing formstatic StringsubmitForm(String formRef, String action, String successCallback, String errorCallback) Submits an existing form
-
Field Details
-
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 refaction- 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
Submits an existing form- Parameters:
formRef- the Vuejs form refaction- the action (url for submit)successCallback- the javascript code to execute if success (parameter response)- Returns:
-
submitForm
Submits a form (form action must be provided on the html form)- Parameters:
formRef- the ref attribute of the formsuccessCallback- 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 requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
request
Sends a request- Parameters:
method- the http method (get,post,delete,patch,put,options,head)url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
get
Sends a get request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
get
Sends a get request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
get
Sends a get request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
get
Sends a get request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
delete
Sends a delete request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
delete
Sends a delete request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
delete
Sends a delete request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
delete
Sends a delete request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
put
Sends a put request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
put
Sends a put request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
put
Sends a put request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
put
Sends a put request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
patch
Sends a patch request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
patch
Sends a patch request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
patch
Sends a patch request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
patch
Sends a patch request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
post
Sends a post request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)errorCallback- the javascript code to execute on error (parameter response)- Returns:
-
post
Sends a post request- Parameters:
url- the url to requestdata- the data to send to the requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
post
Sends a post request- Parameters:
url- the url to requestsuccessCallback- the javascript code to execute if success (parameter response)- Returns:
-
setRequestHeader
Defines a request header.- Parameters:
key- the header keyvalue- the header value- Returns:
- the javascript generated
-
responseToArray
Adds response.data to an array.- Parameters:
array- the array to update- Returns:
- the javascript generated
-
responseToArray
Adds response.data.{part} to an array.- Parameters:
array- the array to update- Returns:
- the javascript generated
-
responseArrayToArray
Adds response.data array to an array.- Parameters:
array- the array to update- Returns:
- the javascript generated
-
responseArrayToArray
Adds response.data.{part} array to an array.- Parameters:
array- the array to update- Returns:
- the javascript generated
-
setResponseToVariable
Sets response.data to a variable- Parameters:
variable-- Returns:
-
setResponseToVariable
Sets response.data.{part} to a variable- Parameters:
variable-part-- Returns:
-