Class OpenUrlServiceImpl
java.lang.Object
org.dspace.statistics.export.service.OpenUrlServiceImpl
- All Implemented Interfaces:
OpenUrlService
Implementation of the OpenUrlService interface
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.http.impl.client.CloseableHttpClientgetHttpClient(org.apache.http.client.config.RequestConfig requestConfig) protected org.apache.http.client.config.RequestConfigprotected intgetResponseCodeFromUrl(String urlStr) Returns the response code from accessing the url.voidLog a failed url in the databasevoidprocessUrl(Context c, String urlStr) Processes the url When the contacting the url fails, the url will be logged in a db tablevoidreprocessFailedQueue(Context context) Reprocess all url trackers present in the databaseprotected voidtryReprocessFailed(Context context, OpenURLTracker tracker) Retry to send a failed url
-
Field Details
-
failedOpenUrlTrackerService
-
-
Constructor Details
-
OpenUrlServiceImpl
public OpenUrlServiceImpl()
-
-
Method Details
-
processUrl
Processes the url When the contacting the url fails, the url will be logged in a db table- Specified by:
processUrlin interfaceOpenUrlService- Parameters:
c- - the contexturlStr- - the url to be processed- Throws:
SQLException
-
getResponseCodeFromUrl
Returns the response code from accessing the url. Returns a http status 408 when the external service doesn't reply in 10 seconds- Parameters:
urlStr-- Returns:
- response code from the url
- Throws:
IOException
-
getHttpClient
protected org.apache.http.impl.client.CloseableHttpClient getHttpClient(org.apache.http.client.config.RequestConfig requestConfig) -
getHttpClientRequestConfig
protected org.apache.http.client.config.RequestConfig getHttpClientRequestConfig() -
tryReprocessFailed
Retry to send a failed url- Parameters:
context-tracker- - db object containing the failed url- Throws:
SQLException
-
reprocessFailedQueue
Reprocess all url trackers present in the database- Specified by:
reprocessFailedQueuein interfaceOpenUrlService- Parameters:
context-- Throws:
SQLException
-
logfailed
Log a failed url in the database- Specified by:
logfailedin interfaceOpenUrlService- Parameters:
context-url-- Throws:
SQLException
-