File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
src/java/main/com/weblyzard/api/client Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .weblyzard .api .client ;
2
+
3
+ import javax .ws .rs .client .Entity ;
4
+ import javax .ws .rs .core .MediaType ;
5
+ import javax .ws .rs .core .Response ;
6
+ import com .weblyzard .api .model .document .Document ;
7
+ import com .weblyzard .api .service .AnnotationService ;
8
+
9
+ /**
10
+ * Provide access to Web services implementing the AnnotationService interface.
11
+ *
12
+ * @see AnnotationService
13
+ *
14
+ * @author Philipp Kuntschik
15
+ * @author Albert Weichselbraun
16
+ */
17
+ public class GenericAnnotatorClient extends BasicClient implements AnnotationService {
18
+
19
+
20
+ private static final String ANNOTATE_DOCUMENT_SERVICE_URL = "/rest/annotate_document" ;
21
+
22
+ public GenericAnnotatorClient (WebserviceClientConfig c ) {
23
+ super (c , "/annotator" );
24
+ }
25
+
26
+ @ Override
27
+ public Document annotateDocument (Document data ) {
28
+
29
+ try (Response response = super .getTarget (ANNOTATE_DOCUMENT_SERVICE_URL )
30
+ .request (MediaType .APPLICATION_JSON_TYPE ).post (Entity .json (data ))) {
31
+
32
+ super .checkResponseStatus (response );
33
+ Document result = response .readEntity (Document .class );
34
+ return result ;
35
+ }
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments