Class AdvancedMemoryDataLoader
java.lang.Object
eu.europa.esig.dss.spi.client.http.AdvancedMemoryDataLoader
- All Implemented Interfaces:
AdvancedDataLoader, DataLoader, Serializable
Defines a map between URL and document to load the response data from offline source
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface DataLoader
DataLoader.DataAndUrl -
Constructor Summary
ConstructorsConstructorDescriptionAdvancedMemoryDataLoader(Map<String, ResponseEnvelope> dataMap) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Execute a HTTP GET operation.Execute a HTTP GET operation.byte[]Executes a HTTP POST operationrequestGet(String url) Executes a GET request and returns anResponseEnvelopeobject.requestGet(String url, boolean includeResponseDetails) Executes a GET request and returns anResponseEnvelopeobject.requestGet(String url, boolean includeResponseDetails, boolean includeResponseBody) Executes a GET request and returns anResponseEnvelopeobject.requestPost(String url, byte[] content) Executes a POST request and returns anResponseEnvelopeobject.requestPost(String url, byte[] content, boolean includeResponseDetails) Executes a POST request and returns anResponseEnvelopeobject.requestPost(String url, byte[] content, boolean includeResponseDetails, boolean includeResponseBody) Executes a POST request and returns anResponseEnvelopeobject.voidsetContentType(String contentType) This allows to set the content type.
-
Constructor Details
-
AdvancedMemoryDataLoader
Default constructor- Parameters:
dataMap- a map between URLs and the corresponding response data content
-
-
Method Details
-
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. 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- Throws:
DSSException
-
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
-
requestGet
Description copied from interface:AdvancedDataLoaderExecutes a GET request and returns anResponseEnvelopeobject. This method included the response message body, context and metadata within the response object.- Specified by:
requestGetin interfaceAdvancedDataLoader- Parameters:
url-StringURL to perform request to- Returns:
ResponseEnvelope
-
requestGet
Description copied from interface:AdvancedDataLoaderExecutes a GET request and returns anResponseEnvelopeobject. This method allows configuration whether the response context (HTTP headers, TLS/SSL certificates, etc.), is to be included within the response object. The response body will be included within the response, when calling this method.- Specified by:
requestGetin interfaceAdvancedDataLoader- Parameters:
url-StringURL to perform request toincludeResponseDetails- defines whether the response context (HTTP headers, metadata) is to be included within the response- Returns:
ResponseEnvelope
-
requestGet
public ResponseEnvelope requestGet(String url, boolean includeResponseDetails, boolean includeResponseBody) Description copied from interface:AdvancedDataLoaderExecutes a GET request and returns anResponseEnvelopeobject. This method allows configuration whether the response context (HTTP headers, TLS/SSL certificates, etc.), as well as the response message body are to be included within the response object. The data which is not included, won't be read by the execution process, thus helping to achieve time-memory efficiency.- Specified by:
requestGetin interfaceAdvancedDataLoader- Parameters:
url-StringURL to perform request toincludeResponseDetails- defines whether the response context (HTTP headers, metadata) is to be included within the responseincludeResponseBody- defines whether the response body is to be included within the response- Returns:
ResponseEnvelope
-
requestPost
Description copied from interface:AdvancedDataLoaderExecutes a POST request and returns anResponseEnvelopeobject. This method included the response message body, context and metadata within the response object.- Specified by:
requestPostin interfaceAdvancedDataLoader- Parameters:
url-StringURL to perform request tocontent- byte array containing request content for the POST call- Returns:
ResponseEnvelope
-
requestPost
Description copied from interface:AdvancedDataLoaderExecutes a POST request and returns anResponseEnvelopeobject. This method allows configuration whether the response context (HTTP headers, TLS/SSL certificates, etc.), is to be included within the response object. The response body will be included within the response, when calling this method.- Specified by:
requestPostin interfaceAdvancedDataLoader- Parameters:
url-StringURL to perform request tocontent- byte array containing request content for the POST callincludeResponseDetails- defines whether the response context (HTTP headers, metadata) is to be included within the response- Returns:
ResponseEnvelope
-
requestPost
public ResponseEnvelope requestPost(String url, byte[] content, boolean includeResponseDetails, boolean includeResponseBody) Description copied from interface:AdvancedDataLoaderExecutes a POST request and returns anResponseEnvelopeobject. This method allows configuration whether the response context (HTTP headers, TLS/SSL certificates, etc.), as well as the response message body are to be included within the response object. The data which is not included, won't be read by the execution process, thus helping to achieve time-memory efficiency.- Specified by:
requestPostin interfaceAdvancedDataLoader- Parameters:
url-StringURL to perform request tocontent- byte array containing request content for the POST callincludeResponseDetails- defines whether the response context (HTTP headers, metadata) is to be included within the responseincludeResponseBody- defines whether the response body is to be included within the response- Returns:
ResponseEnvelope
-