Changeset 4267
- Timestamp:
- 01/15/14 15:45:54 (10 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java
r4264 r4267 33 33 import eu.dasish.annotation.schema.ResponseBody; 34 34 import eu.dasish.annotation.schema.UserWithPermission; 35 import java.io.BufferedReader; 36 import java.io.FileReader; 35 37 import java.io.IOException; 36 38 import java.net.URI; … … 39 41 import java.util.List; 40 42 import java.util.UUID; 43 import javax.servlet.ServletContext; 41 44 import javax.servlet.http.HttpServletRequest; 42 45 import javax.servlet.http.HttpServletResponse; … … 80 83 @Context 81 84 private Providers providers; 85 @Context 86 private ServletContext context; 87 82 88 final String default_permission = "reader"; 83 89 private final Logger logger = LoggerFactory.getLogger(AnnotationResource.class); … … 104 110 } 105 111 106 @GET 107 @Produces(MediaType.TEXT_XML) 108 @Path("/all/debug") 109 @Transactional(readOnly = true) 110 public JAXBElement<AnnotationInfoList> getAllAnnotations() throws IOException { 111 dbIntegrityService.setServiceURI(uriInfo.getBaseUri().toString()); 112 Number userID = dbIntegrityService.getUserInternalIDFromRemoteID(httpServletRequest.getRemoteUser()); 113 if (userID != null) { 114 String typeOfAccount = dbIntegrityService.getTypeOfUserAccount(userID); 115 if (typeOfAccount.equals(admin) || typeOfAccount.equals(developer)) { 116 final AnnotationInfoList annotationInfoList = dbIntegrityService.getAllAnnotationInfos(); 117 return new ObjectFactory().createAnnotationInfoList(annotationInfoList); 118 } else { 119 httpServletResponse.sendError(HttpServletResponse.SC_FORBIDDEN, "The logged in user is neither developer nor admin, and therefore cannot perform this request."); 120 return null; 121 } 122 } else { 123 httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND, "The logged in user is not found in the database"); 124 return null; 125 } 126 127 } 112 128 113 129 114 @GET -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/JaxbMarshallerFactory.java
r3838 r4267 33 33 private Marshaller marshaller; 34 34 // overwritten by the context.xml's 35 private String schemaLocation = "http://www.dasish.eu/ns/addit file:/Users/olhsha/repositories/DASISH/t5.6/schema/trunk/annotator-schema/src/main/ reTargets/DASISH-schema.xsd";35 private String schemaLocation = "http://www.dasish.eu/ns/addit file:/Users/olhsha/repositories/DASISH/t5.6/schema/trunk/annotator-schema/src/main/target/DASISH-schema.xsd"; 36 36 37 37 public JaxbMarshallerFactory() throws Exception { -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/webapp/WEB-INF/web.xml
r4257 r4267 29 29 <param-name>eu.dasish.annotation.backend.schemaLocation</param-name> 30 30 <param-value>http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd</param-value> 31 </context-param> 32 <context-param> 33 <param-name>eu.dasish.annotation.backend.logLocation</param-name> 34 <param-value>/Library/tomcat/Home/logs/dasishAnnotator.log</param-value> 31 35 </context-param> 32 36 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/webapp/WEB-INF/web_shaa.xml
r4257 r4267 30 30 <param-value>http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd</param-value> 31 31 </context-param> 32 <context-param> 33 <param-name>eu.dasish.annotation.backend.logLocation</param-name> 34 <param-value>/lat/tomcat-webuser/logs/dasishAnnotator.log</param-value> 35 </context-param> 36 32 37 33 38 <listener> -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/webapp/index.jsp
r4264 r4267 23 23 <p><a href="api/myresource">Jersey resource</a> 24 24 <p><a href="https://trac.clarin.eu/wiki/DASISH/SpecificationDocument#RESTAPI">https://trac.clarin.eu/wiki/DASISH/SpecificationDocument#RESTAPI</a></p> 25 <!-- <b>Notebooks</b><br> 26 api/notebooks<br> 27 POST api/annotations and PUT /notebooks/_nid_?annotation=_aid_.<br> 25 <!-- <b>Notebooks</b><br> 26 api/notebooks<br> 27 POST api/annotations and PUT /notebooks/_nid_?annotation=_aid_.<br> 28 <br> 29 GET <a href="api/notebooks">api/notebooks</a> Returns notebook-infos for the notebooks accessible to the current user.<br> 30 GET <a href="api/notebooks/owned">api/notebooks/owned</a> Returns the list of all notebooks owned by the current logged user.<br> 31 GET <a href="api/notebooks/_nid_/readers">api/notebooks/_nid_/readers</a> Returns the list of _uid_ who allowed to read the annotations from notebook.<br> 32 GET <a href="api/notebooks/_nid_/writers">api/notebooks/_nid_/writers</a> Returns the list of _uid_ that can add annotations to the notebook.<br> 33 GET <a href="api/notebooks/_nid_/metadata">api/notebooks/_nid_/metadata</a> Get all metadata about a specified notebook _nid_, including the information if it is private or not.<br> 34 GET <a href="api/notebooks/_nid_?maximumAnnotations=100&startAnnotation=5&orderby=1&orderingMode=0">api/notebooks/_nid_?maximumAnnotations=limit&startAnnotation=offset&orderby=orderby&orderingMode=1|0</a> Get the list of all annotations _aid_-s contained within a Notebook with related metadata. Parameters: _nid_, optional maximumAnnotations specifies the maximum number of annotations to retrieve (default -1, all annotations), optional startAnnotation specifies the starting point from which the annotations will be retrieved (default: -1, start from the first annotation), optional orderby, specifies the RDF property used to order the annotations (default: dc:created ), optional orderingMode specifies if the results should be sorted using a descending order desc=1 or an ascending order desc=0 (default: 0 ).<br> 35 PUT <form action="api/notebooks/_nid_" method="put"><input type="submit" /></form>/notebooks/_nid_ Modify metadata of _nid_. The new notebook?s name must be sent in request?s body.<br> 36 PUT /notebooks/_nid_/_aid_ Adds an annotation _aid_ to the list of annotations of _nid_.<br> 37 -- PUT <form action="api/notebooks/_nid_/setPrivate=true" method="put"><input type="submit" /></form>api/notebooks/_nid_/setPrivate=[true, false] Sets the specified Notebook as private or not private.<br>-- 38 POST api/notebooks/ Creates a new notebook. This API returns the _nid_ of the created Notebook in response?s payload and the full URL of the notebook adding a Location header into the HTTP response. The name of the new notebook can be specified sending a specific payload.<br> 39 POST api/notebooks/_nid_ Creates a new annotation in _nid_. The content of an annotation is given in the request body. In fact this is a short cut of two actions:<br> 40 DELETE <form action="api/notebooks/_nid_" method="DELETE"><input type="submit" /></form>api/notebooks/_nid_ Delete _nid_. Annotations stay, they just lose connection to _nid_.<br> 41 --> 42 <!-- <br> 43 <a href="spring_security_login"> Login</a> <br> 44 <br> 45 <a href="j_spring_security_logout"> Logout</a> <br> --> 46 <br> 47 <b>Test URI-s</b><br> 48 <b>All output xml-s are valid w.r.t. the schema</b><br> 49 GET <a href="api/users/00000000-0000-0000-0000-0000000000112">api/users/00000000-0000-0000-0000-0000000000112</a> <br> 50 GET <a href="api/users/00000000-0000-0000-0000-0000000000112/current">api/users/00000000-0000-0000-0000-0000000000112/current</a> !Problem: how to ask the servlet if the given user is logged in, may be by some other running somewhere client<br> 51 GET <a href="api/users/info?email=twagoo@mpi.nl">api/users/info?email=twagoo@mpi.nl</a> <br> 52 GET <a href="api/annotations?link=Sagrada">api/annotations/info?link=Sagrada</a> !Comment: more tests are necessary to test on all query parameters </br> 53 GET <a href="api/annotations?link=Gaud">api/annotations/info?link=Gaud</a> !Comment: more tests are necessary to test on all query parameters </br> 54 GET <a href="api/annotations/00000000-0000-0000-0000-000000000021">api/annotations/00000000-0000-0000-0000-000000000021</a> </br> 55 GET <a href="api/annotations/00000000-0000-0000-0000-000000000021/targets">api/annotations/00000000-0000-0000-0000-000000000021/targets</a> </br> 56 GET <a href="api/annotations/00000000-0000-0000-0000-000000000021/permissions">api/annotations/00000000-0000-0000-0000-000000000021/permissions</a><br> 57 GET <a href="api/targets/00000000-0000-0000-0000-000000000032">api/targets/00000000-0000-0000-0000-000000000032</a> <br> 58 GET <a href="api/targets/00000000-0000-0000-0000-000000000032/versions">api/targets/00000000-0000-0000-0000-000000000032/versions</a> <br> 59 GET <a href="api/cached/00000000-0000-0000-0000-000000000051/metadata">api/cached/00000000-0000-0000-0000-000000000051/metadata</a><br> 60 GET <a href="api/cached/00000000-0000-0000-0000-000000000051/content">api/cached/00000000-0000-0000-0000-000000000051/content</a> !Problem: works only on image.jpeg, end maps png-blobs to jpegs. 61 <br> 28 62 <br> 29 GET <a href="api/notebooks">api/notebooks</a> Returns notebook-infos for the notebooks accessible to the current user.<br> 30 GET <a href="api/notebooks/owned">api/notebooks/owned</a> Returns the list of all notebooks owned by the current logged user.<br> 31 GET <a href="api/notebooks/_nid_/readers">api/notebooks/_nid_/readers</a> Returns the list of _uid_ who allowed to read the annotations from notebook.<br> 32 GET <a href="api/notebooks/_nid_/writers">api/notebooks/_nid_/writers</a> Returns the list of _uid_ that can add annotations to the notebook.<br> 33 GET <a href="api/notebooks/_nid_/metadata">api/notebooks/_nid_/metadata</a> Get all metadata about a specified notebook _nid_, including the information if it is private or not.<br> 34 GET <a href="api/notebooks/_nid_?maximumAnnotations=100&startAnnotation=5&orderby=1&orderingMode=0">api/notebooks/_nid_?maximumAnnotations=limit&startAnnotation=offset&orderby=orderby&orderingMode=1|0</a> Get the list of all annotations _aid_-s contained within a Notebook with related metadata. Parameters: _nid_, optional maximumAnnotations specifies the maximum number of annotations to retrieve (default -1, all annotations), optional startAnnotation specifies the starting point from which the annotations will be retrieved (default: -1, start from the first annotation), optional orderby, specifies the RDF property used to order the annotations (default: dc:created ), optional orderingMode specifies if the results should be sorted using a descending order desc=1 or an ascending order desc=0 (default: 0 ).<br> 35 PUT <form action="api/notebooks/_nid_" method="put"><input type="submit" /></form>/notebooks/_nid_ Modify metadata of _nid_. The new notebook?s name must be sent in request?s body.<br> 36 PUT /notebooks/_nid_/_aid_ Adds an annotation _aid_ to the list of annotations of _nid_.<br> 37 -- PUT <form action="api/notebooks/_nid_/setPrivate=true" method="put"><input type="submit" /></form>api/notebooks/_nid_/setPrivate=[true, false] Sets the specified Notebook as private or not private.<br>-- 38 POST api/notebooks/ Creates a new notebook. This API returns the _nid_ of the created Notebook in response?s payload and the full URL of the notebook adding a Location header into the HTTP response. The name of the new notebook can be specified sending a specific payload.<br> 39 POST api/notebooks/_nid_ Creates a new annotation in _nid_. The content of an annotation is given in the request body. In fact this is a short cut of two actions:<br> 40 DELETE <form action="api/notebooks/_nid_" method="DELETE"><input type="submit" /></form>api/notebooks/_nid_ Delete _nid_. Annotations stay, they just lose connection to _nid_.<br> 41 --> 42 <!-- <br> 43 <a href="spring_security_login"> Login</a> <br> 44 <br> 45 <a href="j_spring_security_logout"> Logout</a> <br> --> 46 <br> 47 <b>Test URI-s</b><br> 48 <b>All output xml-s are valid w.r.t. the schema</b><br> 49 GET <a href="api/users/00000000-0000-0000-0000-0000000000112">api/users/00000000-0000-0000-0000-0000000000112</a> <br> 50 GET <a href="api/users/00000000-0000-0000-0000-0000000000112/current">api/users/00000000-0000-0000-0000-0000000000112/current</a> !Problem: how to ask the servlet if the given user is logged in, may be by some other running somewhere client<br> 51 GET <a href="api/users/info?email=twagoo@mpi.nl">api/users/info?email=twagoo@mpi.nl</a> <br> 52 GET <a href="api/annotations?link=Sagrada">api/annotations/info?link=Sagrada</a> !Comment: more tests are necessary to test on all query parameters </br> 53 GET <a href="api/annotations?link=Gaud">api/annotations/info?link=Gaud</a> !Comment: more tests are necessary to test on all query parameters </br> 54 GET <a href="api/annotations/00000000-0000-0000-0000-000000000021">api/annotations/00000000-0000-0000-0000-000000000021</a> </br> 55 GET <a href="api/annotations/00000000-0000-0000-0000-000000000021/targets">api/annotations/00000000-0000-0000-0000-000000000021/targets</a> </br> 56 GET <a href="api/annotations/00000000-0000-0000-0000-000000000021/permissions">api/annotations/00000000-0000-0000-0000-000000000021/permissions</a><br> 57 GET <a href="api/targets/00000000-0000-0000-0000-000000000032">api/targets/00000000-0000-0000-0000-000000000032</a> <br> 58 GET <a href="api/targets/00000000-0000-0000-0000-000000000032/versions">api/targets/00000000-0000-0000-0000-000000000032/versions</a> <br> 59 GET <a href="api/cached/00000000-0000-0000-0000-000000000051/metadata">api/cached/00000000-0000-0000-0000-000000000051/metadata</a><br> 60 GET <a href="api/cached/00000000-0000-0000-0000-000000000051/content">api/cached/00000000-0000-0000-0000-000000000051/content</a> !Problem: works only on image.jpeg, end maps png-blobs to jpegs. 61 <br> 62 <br> 63 <b>Debugging URI's (only for developers)</b><br> 64 GET <a href="api/annotations/all/debug">api/annotations/all/debug</a> 65 </body> 66 </html> 63 <b>Debugging URI's (only for developers)</b><br> 64 GET <a href="api/debug/annotations">api/debug/annotations</a> <br> 65 GET <a href="api/debug/log/16">api/debug/log/16</a> <br> 66 </body> 67 </html>
Note: See TracChangeset
for help on using the changeset viewer.