changeset 18:383c0fee2d37

PUT returns annotation now.
author casties
date Fri, 23 Mar 2012 12:13:48 +0100
parents b0ef5c860464
children a681113fd0eb
files src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java	Thu Mar 22 21:37:16 2012 +0100
+++ b/src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java	Fri Mar 23 12:13:48 2012 +0100
@@ -150,7 +150,10 @@
             setStatus(Status.SERVER_ERROR_INTERNAL, "TripleStore Error");
             return null;
         }
-        // return stored annotation
+        /* according to https://github.com/okfn/annotator/wiki/Storage
+         * we should return 303: see other.
+         * For now we return the annotation.
+         */
         JSONObject jo = createAnnotatorJson(storedAnnot);
         JsonRepresentation retRep = new JsonRepresentation(jo);
         return retRep;
@@ -325,26 +328,24 @@
             // store Annotation
             storedAnnot = new Convert("file:///annotations").storeAnnotation(annot);
             /* according to https://github.com/okfn/annotator/wiki/Storage
-             * we should return 303: see other
-             * setStatus(Status.REDIRECTION_SEE_OTHER, "go to GET");
+             * we should return 303: see other.
+             * For now we return the annotation.
              */
-            setStatus(Status.SUCCESS_NO_CONTENT);
+            jo = createAnnotatorJson(storedAnnot);
+            JsonRepresentation retRep = new JsonRepresentation(jo);
+            return retRep;
         } catch (TripleStoreHandlerException e) {
             e.printStackTrace();
             setStatus(Status.SERVER_ERROR_INTERNAL, "TripleStoreHandler Error");
-            return null;
         } catch (TripleStoreSearchError e) {
             e.printStackTrace();
             setStatus(Status.SERVER_ERROR_INTERNAL, "TripleStoreSearch Error");
-            return null;
         } catch (JSONException e) {
             e.printStackTrace();
             setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
-            return null;
         } catch (IOException e) {
             e.printStackTrace();
             setStatus(Status.SERVER_ERROR_INTERNAL, "Other Error");
-            return null;
         }
         return null;
     }