Mercurial > hg > AnnotationManagerN4J
comparison src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResources.java @ 65:c0dd5314bada
deal with special characters in urls.
author | casties |
---|---|
date | Wed, 05 Dec 2012 15:36:43 +0100 |
parents | b8ef15c8c4a5 |
children | 2b1e6df5e21a |
comparison
equal
deleted
inserted
replaced
64:c48435e7f312 | 65:c0dd5314bada |
---|---|
1 /** | 1 /** |
2 * ReST API for accessing groups in the Annotation store. | 2 * ReST API for accessing groups in the Annotation store. |
3 */ | 3 */ |
4 package de.mpiwg.itgroup.annotations.restlet; | 4 package de.mpiwg.itgroup.annotations.restlet; |
5 | 5 |
6 import java.io.UnsupportedEncodingException; | |
7 import java.net.URLDecoder; | |
6 import java.util.List; | 8 import java.util.List; |
7 | 9 |
8 import org.json.JSONArray; | 10 import org.json.JSONArray; |
9 import org.json.JSONException; | 11 import org.json.JSONException; |
10 import org.json.JSONObject; | 12 import org.json.JSONObject; |
39 public Representation doGetJSON(Representation entity) { | 41 public Representation doGetJSON(Representation entity) { |
40 logger.debug("AnnotatorResources doGetJSON!"); | 42 logger.debug("AnnotatorResources doGetJSON!"); |
41 setCorsHeaders(); | 43 setCorsHeaders(); |
42 | 44 |
43 String jsonId = (String) getRequest().getAttributes().get("id"); | 45 String jsonId = (String) getRequest().getAttributes().get("id"); |
46 if (jsonId != null) { | |
47 // URL decode | |
48 try { | |
49 jsonId = URLDecoder.decode(jsonId, "UTF-8"); | |
50 } catch (UnsupportedEncodingException e) { | |
51 // this shouldn't happen | |
52 } | |
53 } | |
44 String uri = decodeJsonId(jsonId); | 54 String uri = decodeJsonId(jsonId); |
45 | 55 |
46 logger.debug("resources-id=" + uri); | 56 logger.debug("resources-id=" + uri); |
47 | 57 |
48 if (uri == null) { | 58 if (uri == null) { |