diff src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java @ 65:c0dd5314bada

deal with special characters in urls.
author casties
date Wed, 05 Dec 2012 15:36:43 +0100
parents 64aa756c60cc
children 2b1e6df5e21a
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java	Mon Dec 03 18:42:20 2012 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java	Wed Dec 05 15:36:43 2012 +0100
@@ -3,6 +3,9 @@
  */
 package de.mpiwg.itgroup.annotations.restlet.annotations_ui;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
 import org.apache.log4j.Logger;
 import org.restlet.data.Form;
 import org.restlet.data.MediaType;
@@ -48,6 +51,12 @@
         }
         // get annotation from store
         if (requestId != null) {
+            // URL decode
+            try {
+                requestId = URLDecoder.decode(requestId, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                // this shouldn't happen
+            }
             // the ID in the path is encoded
             String id = Annotation.decodeId(requestId);
             annotation = store.getAnnotationById(id);