final ResponseHandler<?> handler_) throws ServiceCallException {
final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
try {
HttpRequestFactory requestFactory = HTTP_TRANSPORT
.createRequestFactory(new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest request) {
}
});
GenericUrl url = new GenericUrl(_url);
HttpContent hc = new AbstractHttpContent("text/json") {
String content = serialize(jsonServiceRequest_);
@Override
public void writeTo(OutputStream out_) throws IOException {
String service = _url +jsonServiceRequest_.getService();
if (maxPayloadLengthToLog < 0 || content.length() <= maxPayloadLengthToLog) {
logger.info("calling service {} with payload {}", service, content);
} else {
logger.info("calling service {} with payload of {} chars (full payload in debug)", service, Integer.valueOf(content.length()));
logger.debug("payload {}", content);
}
out_.write(content.getBytes());
}
};
HttpRequest request = requestFactory.buildPostRequest(url, hc);
HttpResponse resp = request.execute();
InputStream is = resp.getContent();
JsonStreamHandler<?> jsh = new JsonStreamHandler(is, handler_);
} catch (IOException e) {