use of org.apache.commons.codec.EncoderException in project OpenAttestation by OpenAttestation.
the class ApiClient method querystring.
private String querystring(MultivaluedMap<String, String> query) {
URLCodec urlsafe = new URLCodec("UTF-8");
String queryString = "";
ArrayList<String> params = new ArrayList<String>();
for (String key : query.keySet()) {
if (query.get(key) == null) {
params.add(key + "=");
} else {
for (String value : query.get(key)) {
try {
// XXX assumes that the keys don't have any special characters
params.add(key + "=" + urlsafe.encode(value));
} catch (EncoderException ex) {
log.error("Cannot encode query parameter: {}", value, ex);
}
}
}
queryString = StringUtils.join(params, "&");
}
return queryString;
}
Aggregations