Revision 61307
Added by Andreas Czerniak almost 3 years ago
OaiIterator.java | ||
---|---|---|
89 | 89 |
String url = baseUrl + "?verb=ListRecords&metadataPrefix=" + URLEncoder.encode(mdFormat,"UTF-8"); |
90 | 90 |
if ((set != null) && !set.isEmpty()) { |
91 | 91 |
url += "&set=" + URLEncoder.encode(set,"UTF-8"); |
92 |
} |
|
93 |
if ((fromDate != null) && fromDate.matches("\\d{4}-\\d{2}-\\d{2}")) { |
|
92 |
} |
|
93 |
// http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates , eg. 1957-03-20T20:30:00Z |
|
94 |
if ((fromDate != null) && (fromDate.matches("\\d{4}-\\d{2}-\\d{2}") || fromDate.matches("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z")) ) { |
|
94 | 95 |
url += "&from=" + URLEncoder.encode(fromDate,"UTF-8"); |
95 | 96 |
} |
96 |
if ((untilDate != null) && untilDate.matches("\\d{4}-\\d{2}-\\d{2}")) {
|
|
97 |
if ((untilDate != null) && (untilDate.matches("\\d{4}-\\d{2}-\\d{2}") || untilDate.matches("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z")) ) {
|
|
97 | 98 |
url += "&until=" + URLEncoder.encode(untilDate,"UTF-8"); |
98 | 99 |
} |
99 | 100 |
log.info("Start harvesting using url: " + url); |
... | ... | |
130 | 131 |
private String downloadPage(final String url) throws CollectorServiceException { |
131 | 132 |
|
132 | 133 |
final String xml = httpConnector.getInputSource(url); |
133 |
Document doc;
|
|
134 |
Document doc;
|
|
134 | 135 |
try { |
135 | 136 |
doc = reader.read(new StringReader(xml)); |
136 | 137 |
} catch (DocumentException e) { |
Also available in: Unified diff
adding from/until dates aligned with OAI v2