1 |
torben |
992 |
package dk.thoerup.traininfoservice.banedk; |
2 |
|
|
|
3 |
|
|
import java.net.URL; |
4 |
|
|
|
5 |
|
|
import org.jsoup.Jsoup; |
6 |
|
|
import org.jsoup.nodes.Document; |
7 |
|
|
|
8 |
|
|
import dk.thoerup.circuitbreaker.CircuitInvocation; |
9 |
|
|
|
10 |
|
|
public class JsoupInvocation implements CircuitInvocation{ |
11 |
|
|
|
12 |
|
|
URL url; |
13 |
|
|
int timeoutMS; |
14 |
|
|
|
15 |
|
|
public JsoupInvocation(URL url, int timeoutMS) { |
16 |
|
|
this.url = url; |
17 |
|
|
this.timeoutMS = timeoutMS; |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
@Override |
21 |
|
|
public Document proceed() throws Exception { |
22 |
|
|
Document doc = Jsoup.parse(url, timeoutMS); |
23 |
|
|
return doc; |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
} |