Yes, I have encountered this issue before. This cause lies in a library the REST module uses (and/or Google using a | character in their URL). I have created a brilliant hack (*cough*). What I did:
* Replace all pipe characters from the URL with ===
* Edit the doRequest() method in the Java file RestConsumer.java, look for the code between //StartByRom andd //EndByRom
private static HttpResponseData doRequest(String method, String url, Map<String, String> requestHeaders,
Map<String, String> params, RequestEntity requestEntity, Predicate<InputStream> onSuccess) throws HttpException, IOException {
if (RestServices.LOGCONSUME.isDebugEnabled())
RestServices.LOGCONSUME.debug("Fetching '" + url + "'..");
HttpMethodBase request = null;
try {
if (params != null && !"POST".equals(method)) {
//append params to url. Do *not* use request.setQueryString; that will override any args already in there
for(Entry<String, String> e : params.entrySet())
url = Utils.appendParamToUrl(url, e.getKey(), e.getValue());
}
if ("GET".equals(method))
request = new GetMethod(url);
else if ("DELETE".equals(method))
request = new DeleteMethod(url);
else if ("POST".equals(method))
request = new PostMethod(url);
else if ("PUT".equals(method))
request = new PutMethod(url);
else
throw new IllegalStateException("Unsupported method: " + method);
request.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
request.setRequestHeader(RestServices.HEADER_ACCEPT, RestServices.CONTENTTYPE_APPLICATIONJSON);
if (requestHeaders != null) for(Entry<String, String> e : requestHeaders.entrySet())
request.addRequestHeader(e.getKey(), e.getValue());
includeHeaders(request);
if (params != null && request instanceof PostMethod)
((PostMethod)request).addParameters(mapToNameValuePairs(params));
if (request instanceof PostMethod && requestEntity != null)
((PostMethod)request).setRequestEntity(requestEntity);
else if (request instanceof PutMethod && requestEntity != null)
((PutMethod)request).setRequestEntity(requestEntity);
//StartByRom
RestServices.LOGCONSUME.debug("Overriding URL");
String newURL = url.replace("===", "|");
request.setURI(new URI(newURL, false));
//EndByRom
int status = client.executeMethod(request);
Header responseEtag = request.getResponseHeader(RestServices.HEADER_ETAG);
HttpResponseData response = new HttpResponseData(method, url, status, responseEtag == null ? null : responseEtag.getValue(), request.getResponseHeaders());
InputStream instream = request.getResponseBodyAsStream();
if (onSuccess != null && status >= 200 && status < 300 && instream != null) //NO CONENT doesnt yield a stream..
onSuccess.apply(instream);
else if (instream != null)
response.setBody(IOUtils.toString(instream));
if (RestServices.LOGCONSUME.isDebugEnabled())
{
RestServices.LOGCONSUME.debug(response);
}
return response;
}
You should probably file a bug report here...