Class NativeHTTPDataLoader
java.lang.Object
eu.europa.esig.dss.spi.client.http.NativeHTTPDataLoader
- All Implemented Interfaces:
DataLoader,Serializable
Implementation of native java DataLoader using the java.net.URL class.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumAvailable HTTPMethodsNested classes/interfaces inherited from interface eu.europa.esig.dss.spi.client.http.DataLoader
DataLoader.DataAndUrl -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor instantiating object with null values -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Execute a HTTP GET operation.byte[]Execute a HTTP GET operation with indication concerning the mandatory nature of the operation.Execute a HTTP GET operation.longGets the maximum InputStream sizelongGets timeout valuebyte[]Executes a HTTP POST operationprotected byte[]request(String url, NativeHTTPDataLoader.HttpMethod method, byte[] content, boolean refresh) Execute the requestvoidsetContentType(String contentType) This allows to set the content type.voidsetMaxInputSize(long maxInputSize) Sets the maximum InputStream sizevoidsetTimeout(long timeout) Sets timeout value
-
Constructor Details
-
NativeHTTPDataLoader
public NativeHTTPDataLoader()Default constructor instantiating object with null values
-
-
Method Details
-
request
protected byte[] request(String url, NativeHTTPDataLoader.HttpMethod method, byte[] content, boolean refresh) Execute the request- Parameters:
url-Stringmethod-NativeHTTPDataLoader.HttpMethodcontent- request contentrefresh- if enforce the refresh- Returns:
- response binaries
-
get
Description copied from interface:DataLoaderExecute a HTTP GET operation. This method is used when many URls are available to access the same resource. The operation stops after the first successful download.- Specified by:
getin interfaceDataLoader- Parameters:
urlStrings-ListofStrings representing the URLs to be used in sequential way to obtain the data.- Returns:
DataAndUrlrepresenting the array of obtained data and used url, or null
-
get
Description copied from interface:DataLoaderExecute a HTTP GET operation.- Specified by:
getin interfaceDataLoader- Parameters:
url- the url to access- Returns:
bytearray of obtained data or null
-
get
Description copied from interface:DataLoaderExecute a HTTP GET operation with indication concerning the mandatory nature of the operation.- Specified by:
getin interfaceDataLoader- Parameters:
url- to accessrefresh- if true indicates that the cached data should be refreshed- Returns:
bytearray of obtained data or null
-
post
Description copied from interface:DataLoaderExecutes a HTTP POST operation- Specified by:
postin interfaceDataLoader- Parameters:
url- to accesscontent- the content to post- Returns:
bytearray of obtained data
-
setContentType
Description copied from interface:DataLoaderThis allows to set the content type. Example: Content-Type "application/ocsp-request"- Specified by:
setContentTypein interfaceDataLoader- Parameters:
contentType- to set the Content-Type
-
getMaxInputSize
public long getMaxInputSize()Gets the maximum InputStream size- Returns:
- maximum InputStream size
-
setMaxInputSize
public void setMaxInputSize(long maxInputSize) Sets the maximum InputStream size- Parameters:
maxInputSize- maximum InputStream size
-
getTimeout
public long getTimeout()Gets timeout value- Returns:
- timeout value
-
setTimeout
public void setTimeout(long timeout) Sets timeout value- Parameters:
timeout- timeout value
-