Revision 53932
Added by Alessia Bardi over 5 years ago
HttpListCollectorPlugin.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.collector.plugins.httplist; |
2 | 2 |
|
3 |
import java.util.Iterator; |
|
4 |
|
|
5 | 3 |
import eu.dnetlib.data.collector.plugin.AbstractCollectorPlugin; |
4 |
import eu.dnetlib.data.collector.plugins.HttpConnector; |
|
6 | 5 |
import eu.dnetlib.data.collector.rmi.CollectorServiceException; |
7 | 6 |
import eu.dnetlib.data.collector.rmi.InterfaceDescriptor; |
7 |
import org.springframework.beans.factory.annotation.Autowired; |
|
8 | 8 |
|
9 | 9 |
public class HttpListCollectorPlugin extends AbstractCollectorPlugin { |
10 | 10 |
|
11 |
@Autowired |
|
12 |
private HttpConnector httpConnector; |
|
11 | 13 |
@Override |
12 | 14 |
public Iterable<String> collect(final InterfaceDescriptor interfaceDescriptor, final String fromDate, final String untilDate) |
13 | 15 |
throws CollectorServiceException { |
14 | 16 |
final String baseUrl = interfaceDescriptor.getBaseUrl(); |
15 | 17 |
final String listAddress = interfaceDescriptor.getParams().get("listUrl"); |
16 | 18 |
|
17 |
return new Iterable<String>() { |
|
18 |
|
|
19 |
@Override |
|
20 |
public Iterator<String> iterator() { |
|
21 |
return new HttpListIterator(baseUrl, listAddress); |
|
22 |
} |
|
23 |
}; |
|
19 |
return () -> new HttpListIterator(baseUrl, listAddress, httpConnector); |
|
24 | 20 |
} |
25 | 21 |
} |
Also available in: Unified diff
Upgrade to commons.net:commons.net 3.6 (from 3.3) and commons-httpclient 4.5.6 (from 3.1).
using HttpConnector where needed.
httpConnector can now return an InputStream and not only a string.