Class Http
java.lang.Object
io.github.jeemv.springboot.vuejs.utilities.Http
Http class for Http requests
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Sends a delete requeststatic String
Sends a delete requeststatic String
Sends a delete requeststatic String
Sends a delete requeststatic String
Sends a get requeststatic String
Sends a get requeststatic String
Sends a get requeststatic String
Sends a get requeststatic String
Sends a patch requeststatic String
Sends a patch requeststatic String
Sends a patch requeststatic String
Sends a patch requeststatic String
Sends a post requeststatic String
Sends a post requeststatic String
Sends a post requeststatic String
Sends a put requeststatic String
Sends a put requeststatic String
Sends a put requeststatic String
Sends a put requeststatic String
Sends a requeststatic String
Sends a requeststatic String
responseArrayToArray
(String array) Adds response.data array to an array.static String
responseArrayToArray
(String array, String part) Adds response.data.static String
responseToArray
(String array) Adds response.data to an array.static String
responseToArray
(String array, String part) Adds response.data.static String
setRequestHeader
(String key, String value) Defines a request header.static String
setResponseToVariable
(String variable) Sets response.data to a variablestatic String
setResponseToVariable
(String variable, String part) Sets response.data.static String
submitForm
(String formRef, String successCallback) Submits a form (form action must be provided on the html form)static String
submitForm
(String formRef, String action, String successCallback) Submits an existing formstatic String
submitForm
(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:
-