- Timestamp:
- Jun 25, 2010, 2:03:22 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/groovy/dbnp/rest/CommunicationManager.groovy
r615 r621 4 4 import java.util.List 5 5 import java.util.HashMap 6 import java.net.URLEncoder 6 7 import grails.converters.JSON 7 8 import org.codehaus.groovy.grails.web.json.* … … 37 38 def static ServerURL = "http://nbx5.nugo.org/sam" 38 39 def static RestServerURL = ServerURL + "/rest" 40 def static Encoding = "UTF-8" 39 41 40 42 41 43 /* Methods implemented for CleanDataLayer */ 42 43 44 44 45 … … 73 74 */ 74 75 public Object getFeatures() { 75 // return request( "features" )76 // return request( "features" ) 76 77 return getStudiesForKeyword("ldl") 77 78 } … … 150 151 151 152 /** 152 * Convenience method for constructing URLs for SAM that need parameters 153 * Convenience method for constructing URLs for SAM that need parameters. 154 * Note that parameters are first convereted to strings by calling their toString() method 155 * and then Encoded to protect special characters. 153 156 * 154 157 * @params String resource The name of the resource, e.g. importer/pages … … 161 164 params.each { name, value -> 162 165 if(first) { 163 first = false // this needs to be protected, otherwise might break url164 url += '/nil?' + name + "= '" + value.toString() + "'"166 first = false 167 url += '/nil?' + name + "=" + URLEncoder.encode( value.toString(), Encoding ) 165 168 } 166 169 else { 167 url += '&' + name + "= '" + value.toString() + "'"170 url += '&' + name + "=" + URLEncoder.encode( value.toString(), Encoding ) 168 171 } 169 172 } … … 224 227 } 225 228 226 227 229 }
Note: See TracChangeset
for help on using the changeset viewer.