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 |
torben |
1080 |
|
13 |
torben |
992 |
URL url; |
14 |
|
|
int timeoutMS; |
15 |
|
|
|
16 |
|
|
public JsoupInvocation(URL url, int timeoutMS) { |
17 |
|
|
this.url = url; |
18 |
|
|
this.timeoutMS = timeoutMS; |
19 |
|
|
} |
20 |
|
|
|
21 |
|
|
@Override |
22 |
|
|
public Document proceed() throws Exception { |
23 |
|
|
Document doc = Jsoup.parse(url, timeoutMS); |
24 |
|
|
return doc; |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
} |