I'm using AndroidAnnotations with Spring for Android. For some reasons, the API needs a specific QueryString-Parameter in every request. So I want to add it via an interceptor.
public class TestInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {
// how to safely add a constant querystring parameter to httpRequest here?
// e.g. http://myapi/test -> http://myapi/test?key=12345
// e.g. http://myapi/test?name=myname -> http://myapi/test?name=myname&key=12345
return clientHttpRequestExecution.execute(httpRequest, bytes);
}}