changeset 19:a681113fd0eb

PUT returns 303 according to spec now. seems not to work with the client :-(
author casties
date Fri, 23 Mar 2012 14:27:15 +0100
parents 383c0fee2d37
children 6629e8422760
files src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java	Fri Mar 23 12:13:48 2012 +0100
+++ b/src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java	Fri Mar 23 14:27:15 2012 +0100
@@ -14,6 +14,7 @@
 import org.restlet.Context;
 import org.restlet.data.Form;
 import org.restlet.data.MediaType;
+import org.restlet.data.Reference;
 import org.restlet.data.Status;
 import org.restlet.ext.json.JsonRepresentation;
 import org.restlet.representation.Representation;
@@ -291,6 +292,7 @@
     @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");
@@ -328,12 +330,10 @@
             // store Annotation
             storedAnnot = new Convert("file:///annotations").storeAnnotation(annot);
             /* according to https://github.com/okfn/annotator/wiki/Storage
-             * we should return 303: see other.
-             * For now we return the annotation.
-             */
-            jo = createAnnotatorJson(storedAnnot);
-            JsonRepresentation retRep = new JsonRepresentation(jo);
-            return retRep;
+             * we should return 303: see other. */
+            setStatus(Status.REDIRECTION_SEE_OTHER);
+            // go to same URL as this one
+            this.getResponse().setLocationRef(thisUrl);
         } catch (TripleStoreHandlerException e) {
             e.printStackTrace();
             setStatus(Status.SERVER_ERROR_INTERNAL, "TripleStoreHandler Error");