Package org.gcube.common.gxhttp.request
Class GXHTTPStringRequest
java.lang.Object
org.gcube.common.gxhttp.request.GXHTTPStringRequest
- All Implemented Interfaces:
GXHTTP<String,HttpURLConnection>
A context-aware request to a web application.
It supports sending strings through Put/Post requests.
- Author:
- Manuele Simi (ISTI CNR), Luca Frosini (ISTI-CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GXHTTPRequestBuilderprotected static final org.slf4j.Logger -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear up the request.connect()delete()Sets the User-Agent for the requestget()head()Adds a header to the requeststatic GXHTTPStringRequestnewRequest(String address) Creates a new request.options()patch()Sends the PATCH request to the web application.Adds a path to the request URLpost()Sends the POST request to the web application.purge()put()Sends the PUT request to the web application.queryParams(Map<String, String> queryParams) Adds query parameters to the requesttrace()Sets the body of the request.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
builder
-
-
Method Details
-
newRequest
Creates a new request.- Parameters:
address- the address of the web app to call- Returns:
- the request
-
withBody
Sets the body of the request.- Parameters:
body- the body- Returns:
- the request
-
put
Description copied from interface:GXHTTPSends the PUT request to the web application.- Specified by:
putin interfaceGXHTTP<String,HttpURLConnection> - Parameters:
body- the body of the request- Returns:
- the response
- Throws:
Exception- if an error occurs
-
post
Description copied from interface:GXHTTPSends the POST request to the web application.- Specified by:
postin interfaceGXHTTP<String,HttpURLConnection> - Parameters:
body- the body of the request- Returns:
- the response
- Throws:
Exception- if an error occurs
-
patch
Description copied from interface:GXHTTPSends the PATCH request to the web application.- Specified by:
patchin interfaceGXHTTP<String,HttpURLConnection> - Parameters:
body- the body of the request- Returns:
- the response
- Throws:
Exception- if an error occurs
-
from
Sets the User-Agent for the request- Parameters:
agent- the agent- Returns:
- the request
-
path
Adds a path to the request URL- Parameters:
path- the path to add- Returns:
- the request
- Throws:
UnsupportedEncodingException- if the encoding is not supported
-
header
Adds a header to the request- Parameters:
name- the name of the headervalue- the value of the header- Returns:
- the request
-
queryParams
public GXHTTPStringRequest queryParams(Map<String, String> queryParams) throws UnsupportedEncodingExceptionAdds query parameters to the request- Parameters:
queryParams- the query parameters- Returns:
- the request
- Throws:
UnsupportedEncodingException- if the encoding is not supported
-
put
- Throws:
Exception
-
delete
- Throws:
Exception
-
purge
- Throws:
Exception
-
head
- Throws:
Exception
-
get
- Throws:
Exception
-
post
- Throws:
Exception
-
trace
- Throws:
Exception
-
patch
- Throws:
Exception
-
options
- Throws:
Exception
-
connect
- Throws:
Exception
-
clear
public void clear()Clear up the request.
-