Package org.gcube.common.gxhttp.request
Class GXHTTPStreamRequest
java.lang.Object
org.gcube.common.gxhttp.request.GXHTTPStreamRequest
- All Implemented Interfaces:
GXHTTP<InputStream,HttpURLConnection>
A context-aware request to a web application.
It supports sending streams 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 GXHTTPStreamRequestnewRequest(String address) Creates a new request.options()patch()patch(InputStream body) Sends the PATCH request to the web application.Adds a path to the request URLpost()post(InputStream body) Sends the POST request to the web application.purge()put()put(InputStream body) Sends the PUT request to the web application.queryParams(Map<String, String> queryParams) Adds query parameters to the requesttrace()
-
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
-
put
Description copied from interface:GXHTTPSends the PUT request to the web application.- Specified by:
putin interfaceGXHTTP<InputStream,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<InputStream,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<InputStream,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 GXHTTPStreamRequest 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.
-