Questions tagged [google-http-client]

This refers to the Google HTTP Client Library for Java.

The Google HTTP Client library is a flexible, efficient, and powerful Java client library for accessing any resource on the web via HTTP. It features a pluggable HTTP transport abstraction that allows any low-level library to be used, such as java.net.HttpURLConnection, Apache HTTP Client, or URL Fetch on Google App Engine. It also features efficient JSON and XML data models for parsing and serialization of HTTP response and request content. The JSON and XML libraries are also fully pluggable, including support for Jackson and Android's GSON libraries for JSON.

Supports these Java environments:

  • Java 7 or higher
  • Android 4.4 (Kit Kat)
  • Google App Engine
67 questions
2
votes
1 answer

google-http-java-client json update existing object

i'm trying to use google-http-java-client on android and parse JSON responses from my server. do do that i'm using the following code (provided by the examples of the project) private static final HttpTransport HTTP_TRANSPORT =…
hardysim
  • 2,756
  • 2
  • 25
  • 52
2
votes
3 answers

Parsing nested JSON nodes to POJOs using Google Http Java Client

For example I have a response with the following JSON: { response: { id: 20, name: Stas } } And I want to parse it to the following object: class User { private int id; private String name; } How to skip the…
Stanislav Borzenko
  • 1,431
  • 1
  • 13
  • 9
2
votes
2 answers

POST Request Error with Google HTTP Java Client

I'm using the Google Http Java Client library in my Android project. I have the following basic code for a POST request to the server on an Android app: final GenericUrl url = new GenericUrl(postURL); final HttpContent content = new…
Saad Farooq
  • 13,172
  • 10
  • 68
  • 94
2
votes
1 answer

What's the difference between Apache HTTP Client and Google HTTP Client?

As is said in title Why is Google's http client faster? I want to know it.. If it's lots of words to explain , give me the link please.
karl li
  • 469
  • 1
  • 5
  • 17
1
vote
0 answers

Google HttpResponse - How to update header when using retry logic

I'm trying to protect against a particular error case I'm running into. When I make an HttpResponse to build a request and execute it, I run the risk of hitting some rate limit issues (even using a Google RateLimiter to try and alleviate this). What…
K.Niemczyk
  • 1,130
  • 3
  • 12
  • 26
1
vote
1 answer

Google Http delete with body (Json)

I would like to send this JSON message below, with the HTTP DELETE method. For this project is necessary to use OAuth2. So I use the dependency google-oauth. Foreach HTTP request I use the dependency google client. { "propertie" : true/false, …
Michael
  • 101
  • 2
  • 8
1
vote
1 answer

Parsing xml with google-http-client-xml : parsing xml element content as well as attributes using XmlObjectParser

I cannot seem to parse the value out of the the following xml. What would be the parser class for parsing xml of type if I was using google-http-java client ? Sample xml and parsers below Text 1
1
vote
1 answer

Google HTTP Client Library for Java throws HttpResponseException: 301 Moved Permanently

I have a problem with Google HTTP Client Library for Java (1.22.0). This is my code String url = "http://gazetapraca.pl/ogl/2502758"; GenericUrl genericUrl = new GenericUrl(url); ApacheHttpTransport apacheHttpTransport = new…
1
vote
0 answers

Generic types in array with Google HTTP Client Library

I have base http response which looks like: { "data" : [], "total" : 0, "hasMore" : false } In data can be any object - Users, FeedItems and etc. So i want create base class something like public class BaseDataReponse { @Key public List
Dmitry Nelepov
  • 7,246
  • 8
  • 53
  • 74
1
vote
0 answers

Is there any way I can mark a tasks that "succeeded only after a retry"?

I want to use a backoff retry mechanism to send a list of http requests. Is there any way I can mark (with flag) the requests that succeeded only after re-try? I saw few solutions: 1) https://github.com/rholder/guava-retrying 2)…
Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
1
vote
1 answer

RoboSpice + Google HTTP Client + GSON = failed to parse JSON to object

I'm using RoboSpice with Google HTTP Client & GSON this way: ApiSpiceService: public class ApiSpiceService extends GoogleHttpClientSpiceService { private static final int THREAD_COUNT = 3; @Override public CacheManager…
artem
  • 16,382
  • 34
  • 113
  • 189
1
vote
0 answers

Parsing number as string with Jackson 2 in Google HTTP Java Client

I am using Jackson 2 as parser in google-http-java-client. When a number is mapped to a field of String class I get an IllegalArgumentException. In this case integer 1234 is about to be mapped to Model.b which is a String. However, the a string can…
fikr4n
  • 3,250
  • 1
  • 25
  • 46
1
vote
1 answer

Set HTTP header in Drive request

I want to detect conflict when updating a file to Drive. To accomplish this, it seems I have to set the If-Match header. Currently, I update the doc to Google Drive with this one-liner: mDriveFile = mService.files().update(mDriveFile.getId(),…
Juuso Ohtonen
  • 8,826
  • 9
  • 65
  • 98
1
vote
1 answer

How to use the com.google.api.client.extensions.appengine.http.UrlFetchTransport to get an index.html

I don't know how to use this API to get an index.html Please show me a sample. This is my complete code, HTTP error 500 package com.webrt; import java.io.IOException; import javax.servlet.http.*; import…
1
vote
1 answer