|
final HttpResponse com.griddynamics.jagger.invoker.http.ApacheAbstractHttpInvoker< Q >.invoke |
( |
Q |
query, |
|
|
String |
endpoint |
|
) |
| throws InvocationException |
Executes http request via apache http client.
- Author
- Mairbek Khadikov
- Parameters
-
query | - input data for the invocation |
endpoint | - url of target service |
- Returns
- apache http response
- Exceptions
-
InvocationException | when invocation failed |
64 Preconditions.checkNotNull(query);
65 Preconditions.checkNotNull(endpoint);
67 HttpRequestBase method = null;
68 HttpEntity response = null;
73 org.apache.http.HttpResponse httpResponse = httpClient.execute(method);
74 response = httpResponse.getEntity();
75 return HttpResponse.create(httpResponse.getStatusLine().getStatusCode(), EntityUtils.toString(response));
76 } catch (Exception e) {
78 log.debug( "Error during invocation with URL: " + method.getURI() +
79 ", endpoint: " + endpoint + ", query: " + query, e);
81 log.debug( "Error during invocation with: endpoint: " + endpoint + ", query: " + query, e);
83 throw new InvocationException( "InvocationException : ", e);
85 EntityUtils.consumeQuietly(response);
|