diff src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java @ 21:0cd1e7608d25

works with new JWT-Auth now!
author casties
date Mon, 02 Apr 2012 19:30:46 +0200
parents a681113fd0eb
children
line wrap: on
line diff
--- a/src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java	Fri Mar 23 21:41:53 2012 +0100
+++ b/src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java	Mon Apr 02 19:30:46 2012 +0200
@@ -292,7 +292,6 @@
     @Put("json")
     public Representation doPutJSON(Representation entity) {
         logger.debug("AnnotatorAnnotations doPutJSON!");
-        Reference thisUrl = this.getReference();
         setCorsHeaders();
         // id from URI /annotations/{id}
         String jsonId = (String) getRequest().getAttributes().get("id");
@@ -330,10 +329,16 @@
             // store Annotation
             storedAnnot = new Convert("file:///annotations").storeAnnotation(annot);
             /* according to https://github.com/okfn/annotator/wiki/Storage
-             * we should return 303: see other. */
+             * we should return 303: see other.
+             * but the client doesn't like it
             setStatus(Status.REDIRECTION_SEE_OTHER);
             // go to same URL as this one
-            this.getResponse().setLocationRef(thisUrl);
+            Reference thisUrl = this.getReference();
+            this.getResponse().setLocationRef(thisUrl); */
+            // return new annotation
+            jo = createAnnotatorJson(storedAnnot);
+            JsonRepresentation retRep = new JsonRepresentation(jo);
+            return retRep;
         } catch (TripleStoreHandlerException e) {
             e.printStackTrace();
             setStatus(Status.SERVER_ERROR_INTERNAL, "TripleStoreHandler Error");