comparison 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
comparison
equal deleted inserted replaced
64:c48435e7f312 65:c0dd5314bada
1 /** 1 /**
2 * 2 *
3 */ 3 */
4 package de.mpiwg.itgroup.annotations.restlet.annotations_ui; 4 package de.mpiwg.itgroup.annotations.restlet.annotations_ui;
5
6 import java.io.UnsupportedEncodingException;
7 import java.net.URLDecoder;
5 8
6 import org.apache.log4j.Logger; 9 import org.apache.log4j.Logger;
7 import org.restlet.data.Form; 10 import org.restlet.data.Form;
8 import org.restlet.data.MediaType; 11 import org.restlet.data.MediaType;
9 import org.restlet.data.Reference; 12 import org.restlet.data.Reference;
46 if (store == null) { 49 if (store == null) {
47 store = ((BaseRestlet) getApplication()).getAnnotationStore(); 50 store = ((BaseRestlet) getApplication()).getAnnotationStore();
48 } 51 }
49 // get annotation from store 52 // get annotation from store
50 if (requestId != null) { 53 if (requestId != null) {
54 // URL decode
55 try {
56 requestId = URLDecoder.decode(requestId, "UTF-8");
57 } catch (UnsupportedEncodingException e) {
58 // this shouldn't happen
59 }
51 // the ID in the path is encoded 60 // the ID in the path is encoded
52 String id = Annotation.decodeId(requestId); 61 String id = Annotation.decodeId(requestId);
53 annotation = store.getAnnotationById(id); 62 annotation = store.getAnnotationById(id);
54 } 63 }
55 } 64 }