Google HTTP Client Library for Java

Overview

Google HTTP Client Library for Java

Maven Stability CI Status

Description

Written by Google, the Google HTTP Client Library for Java is a flexible, efficient, and powerful Java library for accessing any resource on the web via HTTP. The library has the following features:

  • Pluggable HTTP transport abstraction that allows you to use any low-level library such as java.net.HttpURLConnection, Apache HTTP Client, or URL Fetch on Google App Engine.
  • 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, and they include support for Jackson and Android's GSON libraries for JSON.

The library supports the following Java environments:

  • Java 7 or higher
  • Android 4.4 (Kit Kat)
  • GoogleAppEngine Google App Engine

The following related projects are built on the Google HTTP Client Library for Java:

This is an open-source library, and contributions are welcome.

Beta Features

Features marked with the @Beta annotation at the class or method level are subject to change. They might be modified in any way, or even removed, in any major release. You should not use beta features if your code is a library itself (that is, if your code is used on the CLASSPATH of users outside your own control).

Deprecated Features

Deprecated non-beta features will be removed eighteen months after the release in which they are first deprecated. You must fix your usages before this time. If you don't, any type of breakage might result, and you are not guaranteed a compilation error.

Documentation

Comments
  • SocketTimeoutException: Read timed out when executing HTTPS requests

    SocketTimeoutException: Read timed out when executing HTTPS requests

    From [email protected] on July 31, 2012 09:43:21

    Version of google-http-java-client (e.g. 1.5.0-beta)? 1.10.3 Beta Java environment (e.g. Java 6, Android 2.3, App Engine)? Android 4.1 (Google Nexus) Describe the problem. I'm using an HttpTransport got with AndroidHttp.newCompatibleTransport() to perform multiple requests to a server using the HTTPS protocol. Both using WiFi and 3G, I sometimes get this exception when executing a request:

    07-31 17:14:40.659: W/System.err(7558): java.net.SocketTimeoutException: Read timed out 07-31 17:14:40.659: W/System.err(7558): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method) 07-31 17:14:40.659: W/System.err(7558): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:675) 07-31 17:14:40.659: W/System.err(7558): at libcore.io.Streams.readSingleByte(Streams.java:41) 07-31 17:14:40.659: W/System.err(7558): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:659) 07-31 17:14:40.659: W/System.err(7558): at libcore.io.Streams.readAsciiLine(Streams.java:201) 07-31 17:14:40.659: W/System.err(7558): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560) 07-31 17:14:40.659: W/System.err(7558): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813) 07-31 17:14:40.659: W/System.err(7558): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274) 07-31 17:14:40.659: W/System.err(7558): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486) 07-31 17:14:40.659: W/System.err(7558): at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:134) 07-31 17:14:40.659: W/System.err(7558): at com.google.api.client.http.javanet.NetHttpResponse.(NetHttpResponse.java:37) 07-31 17:14:40.667: W/System.err(7558): at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:91) 07-31 17:14:40.667: W/System.err(7558): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:895)

    Note that:

    • Other HTTP requests complete normally in the meantime.
    • My connection and read timeouts are set respectively to 10 and 20 seconds.

    There are other users experiencing this issue with the error reporting library ACRA, which might use google-http-java-client as well. This is the link to the issue: https://code.google.com/p/acra/issues/detail?id=128 How would you expect it to be fixed? No idea, I don't even know if it's a library or system issue.

    Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=146

    type: bug priority: p2 :rotating_light: 
    opened by wonderfly 27
  • Allow GenericUrl.build() to be overridden

    Allow GenericUrl.build() to be overridden

    From [email protected] on August 16, 2011 08:11:27

    Thanks to [email protected] for reporting the problem!

    version: 1.4.1-beta on App Engine 1.5.0.1

    As an example of this issue, according to Google's documentation to retrieve the ACL Feed for a Google Docs List Entry, the link specified requires the form: https://docs.google.com/feeds/default/private/full/document%3Adocument_id/acl The %3A is critical as the following url (with %3A replaced by a colon) returns a 404 for us: https://docs.google.com/feeds/default/private/full/document:document_id/acl That automatic decoding from %3A to : happens within the internals of the GenericUrl class.

    As an attempt to work around this, I replaced the "%" with a "%25" with the hopes that GoogleUrl would properly escape the "%25" back to a "%" and all would be well: https://docs.google.com/feeds/default/private/full/document%253Adocument_id/acl However, this only resulted in the GenericUrl building an unchanged, incorrect url: https://docs.google.com/feeds/default/private/full/document%253Adocument_id/acl Since the methods that encode and decode within GenericUrl are final/private, there does not appear to be a way to properly construct a url to access the Google Docs ACL Feed using the class.

    Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=26

    type: feature request 
    opened by wonderfly 24
  • build(deps): update dependency org.apache.maven.plugins:maven-enforcer-plugin to v3.1.0

    build(deps): update dependency org.apache.maven.plugins:maven-enforcer-plugin to v3.1.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | org.apache.maven.plugins:maven-enforcer-plugin | 3.0.0-M3 -> 3.1.0 | age | adoption | passing | confidence |


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

    kokoro:force-run size: xs 
    opened by renovate-bot 21
  • CloseGuard error after EOFException

    CloseGuard error after EOFException

    From [email protected] on May 19, 2012 07:09:00

    Version of google-http-java-client (e.g. 1.5.0-beta)? 1.9.0-beta Java environment (e.g. Java 6, Android 2.3, App Engine)? Android Describe the problem. Reported by aalbert:

    When this exception is thrown: 05-18 16:18:10.546 895 1825 E App: java.io.EOFException 05-18 16:18:10.546 895 1825 E App: at libcore.io.Streams.readAsciiLine(Streams.java:203) 05-18 16:18:10.546 895 1825 E App: at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:582) 05-18 16:18:10.546 895 1825 E App: at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:836) 05-18 16:18:10.546 895 1825 E App: at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274) 05-18 16:18:10.546 895 1825 E App: at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486) 05-18 16:18:10.546 895 1825 E App: at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:134) 05-18 16:18:10.546 895 1825 E App: at com.google.api.client.http.javanet.NetHttpResponse.(NetHttpResponse.java:37) 05-18 16:18:10.546 895 1825 E App: at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:89) 05-18 16:18:10.546 895 1825 E App: at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:814) 05-18 16:18:10.546 895 1825 E App: at com.google.api.client.googleapis.json.GoogleJsonResponseException.execute(GoogleJsonResponseException.java:182) 05-18 16:18:10.546 895 1825 E App: at com.google.api.client.googleapis.services.GoogleClient.executeUnparsed(GoogleClient.java:115) 05-18 16:18:10.546 895 1825 E App: at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:112)

    The underlying connection is not closed properly and we get a CloseGuard error:

    05-18 16:19:10.343 895 904 E StrictMode: at dalvik.system.CloseGuard.open(CloseGuard.java:184) 05-18 16:19:10.343 895 904 E StrictMode: at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:287) 05-18 16:19:10.343 895 904 E StrictMode: at libcore.net.http.HttpConnection.setupSecureSocket(HttpConnection.java:210) 05-18 16:19:10.343 895 904 E StrictMode: at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:478) 05-18 16:19:10.343 895 904 E StrictMode: at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:433) 05-18 16:19:10.343 895 904 E StrictMode: at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:293) 05-18 16:19:10.343 895 904 E StrictMode: at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:243) 05-18 16:19:10.343 895 904 E StrictMode: at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80) 05-18 16:19:10.343 895 904 E StrictMode: at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:165) 05-18 16:19:10.343 895 904 E StrictMode: at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:88) How would you expect it to be fixed? No CloseGuard error.

    Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=116

    type: bug priority: p2 :rotating_light: 
    opened by wonderfly 21
  • Fix int type transformed as BigDecimal value when parsing as Map

    Fix int type transformed as BigDecimal value when parsing as Map

    Using with Jackson2 parser, a simple parsing of { "data" : 1} gives a BigDecimal instead an integer. In my case, valueClass is Object, but the JSON current token is VALUE_NUMBER_INT not FLOAT.

    I parse as a Map. No problem if I parse as a class with "int" type.

    :rotating_light: cla: yes 
    opened by ebuildy 19
  • There is no proxy authentication

    There is no proxy authentication

    From ogregoire on January 11, 2013 01:56:14

    Version of google-http-java-client (e.g. 1.5.0-beta)? 1.13.1-beta Java environment (e.g. Java 6, Android 2.3, App Engine)? Java 7 Describe the problem. I want my application to be able to access APIs behind a proxy that requires an authentication, but no proxy authentication is available. It is possible to set the proxy, but not to authenticate to it. How would you expect it to be fixed? Some parameters in the (Apache|Net)HttpTransport.Builder class should be set so we can use a proxy with authentication along with the proxy setting.

    Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=190

    type: feature request priority: p1 
    opened by wonderfly 17
  • build(deps): update dependency org.apache.maven.plugins:maven-dependency-plugin to v3.2.0

    build(deps): update dependency org.apache.maven.plugins:maven-dependency-plugin to v3.2.0

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | org.apache.maven.plugins:maven-dependency-plugin | 3.1.2 -> 3.2.0 | age | adoption | passing | confidence |


    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Renovate will not automatically rebase this PR, because other commits have been found.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    kokoro:force-run 
    opened by renovate-bot 16
  • Surface rawToken for JWT wrapper

    Surface rawToken for JWT wrapper

    Adds ability to recall the raw JWT encoded token from JsonWebSignature and JsonWebToken.

    The current .toString() method for both classes returns a JSON object. Its useful to have access to the raw token directly to be used in an http client (as Authorization: Bearer <rawToken>, for example)

    ref: https://github.com/googleapis/google-auth-library-java/pull/303#pullrequestreview-269723158

    cla: yes 
    opened by salrashid123 16
  • Asynchronous requests

    Asynchronous requests

    From [email protected] on May 11, 2011 08:33:21

    Copied from previous project from: https://code.google.com/p/google-api-java-client/issues/detail?id=151 Please describe the feature requested. It would be nice to provide an executeAsync method in HttpRequest that started a new thread to execute the request and when it got the final response would call an implementation of an HttpAsyncCallback interface similar to the one in GWT: http://google-web-toolkit.googlecode.com/svn/javadoc/2.2/com/google/gwt/user/client/rpc/AsyncCallback.html Sample usage:

    public static void run(HttpRequest request) { request.executeAsync(new HttpAsyncCallback() { public void onSuccess(HttpResponse response) { if (response.isSuccessStatusCode) { // server sent a success response } else { // server sent an error response } }

       public void onFailure(Throwable caught) {
         // Convenient way to find out which exception was thrown.
         try {
           throw caught;
         } catch (IOException e) {
           // some networking problem?
         } catch (Throwable e) {
           // last resort -- a very unexpected exception
         }
       }
    });
    

    }

    Comment 1 by [email protected], Mar 19, 2011

    +1 on the feature, I think it would be nice to provide this.

    A couple comments on the sample usage as it is:

    1.) onSuccess() gives you a response, which you then have to check for whether or not it was actually a success? Maybe it should be called onResponse() if it's not actually going to be a sign of success.

    2.) I would argue that re-throwing the Throwable and catching it to find out what it was is not very convenient. Try/catch blocks should not be a control flow mechanism, they should be an error handling mechanism. It might be better to have instanceof check, but even that feels a little gross.

    Also, for brevity, it might be nice to provide an abstract class, DefaultCallback, that implements onFailure() in a default way, so that developers don't have to write both branches for every request. This may be a recommendation for samples more than a recommendation for the library itself, since "the default way" might depend a lot on the environment, but either way I thought I'd mention it.

    Also (also), for App Engine, since you can't spawn threads, you could use an asynchronous urlfetch as described here: http://ikaisays.com/2010/06/29/using-asynchronous-urlfetch-on-java-app-engine/ Comment 2 by project member [email protected], Mar 19, 2011

    Thanks for the feedback!

    I agree with the onResponse() name. That makes more sense.

    The most interesting question is what to do about this for App Engine. executeAsync as outlined here just wouldn't work with fetchAsync since that uses a Future. I suppose we could still have executeAsync but throw an exception on App Engine.

    Alternatively, we could use a Future-style interface like App Engine has, e.g.:

    public class HttpRequest { public Future fetchAsync(); }

    and provide a way to override the behavior in the HttpTransport such that UrlFetchTransport would use URLFetchService.fetchAsync().

    Comment 3 by project member [email protected], Mar 20, 2011

    while we're doing this reconfiguration, maybe it's time to think about streaming as well. The async callbacks would be

    OnFailure - called immediately if you get an error return OnHeaders(HttpResponse response) - called with all the header data OnData(HttpRespose response, byte [] data, length) - on each successive chunk of data. OnSuccess(HttpResposne response) - when we are finally done.

    An app could get away with just OnFailure and OnSuccess, but an app that did streaming responses could start parsing the JSON as it arrives.

    -tony

    Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=2

    type: feature request 
    opened by wonderfly 16
  • Synthesis failed for google-http-java-client

    Synthesis failed for google-http-java-client

    Hello! Autosynth couldn't regenerate google-http-java-client. :broken_heart:

    Here's the output from running synth.py:

       return callback(*args, **kwargs)
      File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
        spec.loader.exec_module(synth_module)  # type: ignore
      File "<frozen importlib._bootstrap_external>", line 678, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/kbuilder/.cache/synthtool/google-http-java-client/synth.py", line 21, in <module>
        templates = common_templates.java_library()
      File "/tmpfs/src/github/synthtool/synthtool/gcp/common.py", line 95, in java_library
        return self._generic_library("java_library", **kwargs)
      File "/tmpfs/src/github/synthtool/synthtool/gcp/common.py", line 57, in _generic_library
        result = t.render(**kwargs)
      File "/tmpfs/src/github/synthtool/synthtool/sources/templates.py", line 83, in render
        _render_to_path(self.env, template_name, self.dir / subdir, kwargs)
      File "/tmpfs/src/github/synthtool/synthtool/sources/templates.py", line 53, in _render_to_path
        output.dump(fh)
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/environment.py", line 1313, in dump
        fp.writelines(iterable)
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/environment.py", line 1357, in __next__
        return self._next()
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/environment.py", line 1125, in generate
        yield self.environment.handle_exception()
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
        reraise(*rewrite_traceback_stack(source=source))
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
        raise value.with_traceback(tb)
      File "/home/kbuilder/.cache/synthtool/synthtool/synthtool/gcp/templates/java_library/.github/workflows/ci.yaml", line 12, in top-level template code
        java: [{% if metadata['min_java_version'] <= 7 %}7, {% endif %}8, 11]
    jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'min_java_version'
    2020-06-19 13:26:21,282 autosynth [ERROR] > Synthesis failed
    2020-06-19 13:26:21,288 autosynth [DEBUG] > Running: git reset --hard HEAD
    HEAD is now at a82b980 chore(deps): update dependency org.apache.maven.plugins:maven-project-info-reports-plugin to v3.1.0 (#1050)
    2020-06-19 13:26:21,295 autosynth [DEBUG] > Running: git checkout autosynth-synthtool
    Switched to branch 'autosynth-synthtool'
    2020-06-19 13:26:21,302 autosynth [ERROR] > Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.
    2020-06-19 13:26:21,443 autosynth [DEBUG] > Running: git checkout a82b9808f112c240c213726356e610e3a9fb4e61
    Note: checking out 'a82b9808f112c240c213726356e610e3a9fb4e61'.
    
    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.
    
    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:
    
      git checkout -b <new-branch-name>
    
    HEAD is now at a82b980 chore(deps): update dependency org.apache.maven.plugins:maven-project-info-reports-plugin to v3.1.0 (#1050)
    2020-06-19 13:26:21,450 autosynth [DEBUG] > Running: git checkout 3e6fed750653a8f41a5efeca0bc16b756a9532bb
    HEAD is now at 3e6fed7 Revert "ci(java): run dependency test on Java 8 and 11 (#633)" (#636)
    2020-06-19 13:26:21,459 autosynth [DEBUG] > Running: git branch -f autosynth-70
    2020-06-19 13:26:21,463 autosynth [DEBUG] > Running: git checkout autosynth-70
    Switched to branch 'autosynth-70'
    2020-06-19 13:26:21,469 autosynth [INFO] > Running synthtool
    2020-06-19 13:26:21,470 autosynth [INFO] > ['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']
    2020-06-19 13:26:21,470 autosynth [DEBUG] > log_file_path: /tmpfs/src/logs/google-http-java-client/70/sponge_log.log
    2020-06-19 13:26:21,472 autosynth [DEBUG] > Running: /tmpfs/src/github/synthtool/env/bin/python3 -m synthtool --metadata synth.metadata synth.py --
    2020-06-19 13:26:21,679 synthtool [DEBUG] > Executing /home/kbuilder/.cache/synthtool/google-http-java-client/synth.py.
    On branch autosynth-70
    nothing to commit, working tree clean
    2020-06-19 13:26:21,813 synthtool [DEBUG] > Using precloned repo /home/kbuilder/.cache/synthtool/synthtool
    DEBUG:synthtool:Using precloned repo /home/kbuilder/.cache/synthtool/synthtool
    .github/CODEOWNERS
    .github/ISSUE_TEMPLATE/bug_report.md
    .github/ISSUE_TEMPLATE/feature_request.md
    .github/ISSUE_TEMPLATE/support_request.md
    .github/PULL_REQUEST_TEMPLATE.md
    .github/release-please.yml
    .github/trusted-contribution.yml
    .github/workflows/ci.yaml
    2020-06-19 13:26:21,835 synthtool [DEBUG] > Wrote metadata to synth.metadata.
    DEBUG:synthtool:Wrote metadata to synth.metadata.
    Traceback (most recent call last):
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
        main()
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
        spec.loader.exec_module(synth_module)  # type: ignore
      File "<frozen importlib._bootstrap_external>", line 678, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/kbuilder/.cache/synthtool/google-http-java-client/synth.py", line 21, in <module>
        templates = common_templates.java_library()
      File "/tmpfs/src/github/synthtool/synthtool/gcp/common.py", line 95, in java_library
        return self._generic_library("java_library", **kwargs)
      File "/tmpfs/src/github/synthtool/synthtool/gcp/common.py", line 57, in _generic_library
        result = t.render(**kwargs)
      File "/tmpfs/src/github/synthtool/synthtool/sources/templates.py", line 83, in render
        _render_to_path(self.env, template_name, self.dir / subdir, kwargs)
      File "/tmpfs/src/github/synthtool/synthtool/sources/templates.py", line 53, in _render_to_path
        output.dump(fh)
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/environment.py", line 1313, in dump
        fp.writelines(iterable)
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/environment.py", line 1357, in __next__
        return self._next()
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/environment.py", line 1125, in generate
        yield self.environment.handle_exception()
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
        reraise(*rewrite_traceback_stack(source=source))
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
        raise value.with_traceback(tb)
      File "/home/kbuilder/.cache/synthtool/synthtool/synthtool/gcp/templates/java_library/.github/workflows/ci.yaml", line 12, in top-level template code
        java: [{% if metadata['min_java_version'] <= 7 %}7, {% endif %}8, 11]
    jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'min_java_version'
    2020-06-19 13:26:21,879 autosynth [ERROR] > Synthesis failed
    2020-06-19 13:26:21,885 autosynth [DEBUG] > Running: git reset --hard HEAD
    HEAD is now at a82b980 chore(deps): update dependency org.apache.maven.plugins:maven-project-info-reports-plugin to v3.1.0 (#1050)
    2020-06-19 13:26:21,893 autosynth [DEBUG] > Running: git checkout autosynth
    Switched to branch 'autosynth'
    2020-06-19 13:26:21,900 autosynth [DEBUG] > Running: git clean -fdx
    Removing __pycache__/
    Traceback (most recent call last):
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 649, in <module>
        main()
      File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 498, in main
        return _inner_main(temp_dir)
      File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 629, in _inner_main
        commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
      File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 393, in synthesize_loop
        synthesize_inner_loop(toolbox, synthesizer)
      File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 403, in synthesize_inner_loop
        synthesizer, len(toolbox.versions) - 1
      File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 275, in synthesize_version_in_new_branch
        synthesizer.synthesize(synth_log_path, self.environ)
      File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 120, in synthesize
        synth_proc.check_returncode()  # Raise an exception.
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
        self.stderr)
    subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.
    
    

    Google internal developers can see the full log here.

    type: bug priority: p1 autosynth failure 
    opened by yoshi-automation 15
  • CustomSearch: NoHttpResponseException exception if interval between requests is 240+ seconds

    CustomSearch: NoHttpResponseException exception if interval between requests is 240+ seconds

    Environment details

    OS type and version: macOS 13.0.1 Java version: jdk1.8.0_251.jdk google-http-client-apache-v2-1.42.3

    Steps to reproduce

    1. Create new ApacheHttpTransport
    2. Make a request to https://customsearch.googleapis.com/customsearch/v1
    3. Wait at least 240 seconds
    4. Make another request to https://customsearch.googleapis.com/customsearch/v1

    Code example

    try (CloseableHttpClient httpClient = HttpClients.custom()
                    .setConnectionManager(new BasicHttpClientConnectionManager())
                    .build()) {
    
                Map<String, String> params = new LinkedHashMap<>();
                params.put("key", GOOGLE_API_KEY); // Reproducible for invalid key as well
                params.put("cx", "02395f9f6867a1988");
                params.put("q", LONG_QUERY); // Any query longer than 2048 characters
                params.put("start", "1");
    
                HttpTransport transport = new ApacheHttpTransport(httpClient);
                final HttpRequestFactory requestFactory = transport.createRequestFactory();
    
                final HttpRequest request1 = requestFactory.buildPostRequest(
                        new GenericUrl("https://customsearch.googleapis.com/customsearch/v1"),
                        new UrlEncodedContent(params)
                );
                request1.getHeaders().set("X-HTTP-Method-Override", "GET");
    
                try {
                    System.out.println(request1.execute().parseAsString());
                } catch (HttpResponseException ignore) {
                    // Fails in case of invalid key. Safe to ignore for the sake of this test.
                }
    
                Thread.sleep(5 * 60 * 1000);
                params.put("start", "11");
    
                final HttpRequest request2 = requestFactory.buildPostRequest(
                        new GenericUrl("https://customsearch.googleapis.com/customsearch/v1"),
                        new UrlEncodedContent(params)
                );
                request2.getHeaders().set("X-HTTP-Method-Override", "GET");
    
                try {
                    System.out.println(request2.execute().parseAsString());
                } catch (HttpResponseException ignore) {
                    // Fails in case of invalid key. Safe to ignore for the sake of this test.
                }
    }
    

    Stack trace

    org.apache.http.NoHttpResponseException: customsearch.googleapis.com:443 failed to respond
    
    	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
    	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
    	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
    	at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
    	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
    	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
    	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
    	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
    	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
    	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
    	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
    	at com.google.api.client.http.apache.v2.ApacheHttpRequest.execute(ApacheHttpRequest.java:73)
    	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1012)
    	at com.example.NoHttpResponseTest.testDelayBetweenRequestsDirectGoogleApi(NoHttpResponseTest.java:136)
    

    Any additional information below

    Same error when using google-api-services-customsearch-v1-rev20210918-2.0.0 CustomSearchAPI. No error, all completes fine, if using apache's CloseableHttpClient directly to make the same requests.

    type: bug priority: p3 
    opened by zhemaituk 14
Releases(v1.42.3)
Owner
Google APIs
Clients for Google APIs and tools that help produce them.
Google APIs
A high-level and lightweight HTTP client framework for Java. it makes sending HTTP requests in Java easier.

A high-level and lightweight HTTP client framework for Java. it makes sending HTTP requests in Java easier.

dromara 1.2k Jan 8, 2023
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

AsyncHttpClient 6k Jan 8, 2023
Unirest in Java: Simplified, lightweight HTTP client library.

Unirest for Java Install With Maven: <!-- Pull in as a traditional dependency --> <dependency> <groupId>com.konghq</groupId> <artifactId>unire

Kong 2.4k Jan 5, 2023
Unirest in Java: Simplified, lightweight HTTP client library.

Unirest for Java Install With Maven: <!-- Pull in as a traditional dependency --> <dependency> <groupId>com.konghq</groupId> <artifactId>unire

Kong 2.4k Jan 5, 2023
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

OkHttp See the project website for documentation and APIs. HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP

Square 43.4k Jan 5, 2023
Java HTTP Request Library

Http Request A simple convenience library for using a HttpURLConnection to make requests and access the response. This library is available under the

Kevin Sawicki 3.3k Dec 30, 2022
Feign makes writing java http clients easier

Feign makes writing java http clients easier Feign is a Java to HTTP client binder inspired by Retrofit, JAXRS-2.0, and WebSocket. Feign's first goal

null 8.5k Dec 30, 2022
⚗️ Lightweight HTTP extensions for Java 11

Methanol A lightweight library that complements java.net.http for a better HTTP experience. Overview Methanol provides useful lightweight HTTP extensi

Moataz Abdelnasser 175 Dec 17, 2022
Tiny, easily embeddable HTTP server in Java.

NanoHTTPD – a tiny web server in Java NanoHTTPD is a light-weight HTTP server designed for embedding in other applications, released under a Modified

NanoHttpd 6.5k Jan 5, 2023
A Java event based WebSocket and HTTP server

Webbit - A Java event based WebSocket and HTTP server Getting it Prebuilt JARs are available from the central Maven repository or the Sonatype Maven r

null 808 Jan 3, 2023
Feign makes writing java http clients easier

Feign makes writing java http clients easier Feign is a Java to HTTP client binder inspired by Retrofit, JAXRS-2.0, and WebSocket. Feign's first goal

null 8.5k Jan 1, 2023
Koios Java Client Library is based on Koios Elastic Query Layer for Cardano Node by Cardano Community Guild Operators

Koios Java Client What is Koios? Koios Java Client Library is based on Koios Elastic Query Layer for Cardano Node by Cardano Community Guild Operators

Dudi Edri 13 Dec 4, 2022
Share the chat messages across Minecraft Servers via HTTP backend powered by Spring Boot, this is the backend part of the project.

InterconnectedChat-Backend Share the chat messages across Minecraft Servers via HTTP backend powered by Spring Boot, this is the backend part of the p

贺兰星辰 3 Oct 6, 2021
Fast_Responder is a service that lets you quickly create an Http request responder

Fast_Responder is a service that lets you quickly create an Http request responder. The transponder can receive any request path configured and determine the request parameters according to your configuration to return different results. In addition to processing requests, the transponder can also make Http requests to any request address based on the latency, request headers, and parameters you configure. In essence, fast_responder is a dynamic mock service.

null 8 Jan 26, 2022
httpx - CLI to run HTTP file

httpx: CLI for run http file httpx is a CLI to execute requests from JetBrains Http File. How to install? Mac : brew install httpx-sh/tap/httpx Other

httpx 105 Dec 15, 2022
AltiriaSmsJavaClient, the official Java client of Altiria

¡Atención! Este proyecto aún se encuentra en desarrollo. Pronto se publicará la versión final para su uso. Altiria, cliente SMS Java Altiria SMS Java

Altiria 4 Dec 5, 2022
Client-side response routing for Spring

Riptide: A next generation HTTP client Riptide noun, /ˈrɪp.taɪd/: strong flow of water away from the shore Riptide is a library that implements client

Zalando SE 235 Jan 3, 2023
A small client useful for a variety of tasks ranging from raiding to duping.

CornClient A small utility mod for Minecraft useful for a variety of tasks ranging from raiding to duping. Support You can open an issue for help or f

Arilius Collection 115 Jan 4, 2022
skid client 1.12.2

Outrage best skid client Build / Contribute Download intellij idea Import gradle project Run genIntellijRuns Open runClient configuration, and add -Df

null 7 Dec 2, 2022