Package com.google.api.client.json

Examples of com.google.api.client.json.JsonObjectParser


      JsonFactory jsonFactory) throws IOException {
    Preconditions.checkNotNull(credentialStream);
    Preconditions.checkNotNull(transport);
    Preconditions.checkNotNull(jsonFactory);

    JsonObjectParser parser = new JsonObjectParser(jsonFactory);
    GenericJson fileContents = parser.parseAndClose(
        credentialStream, OAuth2Utils.UTF_8, GenericJson.class);
    String fileType = (String) fileContents.get("type");
    if (fileType == null) {
      throw new IOException("Error reading credentials from stream, 'type' field not specified.");
    }
View Full Code Here


   * @param request
   *            is the request to configure
   */
  protected void configure(final HttpRequest request) {
    request.getHeaders().setAuthorization(String.format("OAuth %s", token));
    request.setParser(new JsonObjectParser(jsonFactory));

    final ExponentialBackOff backoff = new ExponentialBackOff.Builder().setInitialIntervalMillis(500)
        .setMaxElapsedTimeMillis(60000).setMaxIntervalMillis(30000).setMultiplier(1.5)
        .setRandomizationFactor(0.5).build();
    request.setUnsuccessfulResponseHandler(new HttpBackOffUnsuccessfulResponseHandler(backoff));
View Full Code Here

   */
  protected abstract JsonFactory createJsonFactory() throws IOException;

  @Override
  protected final ObjectParser getParser(UnparsedNotification notification) throws IOException {
    return new JsonObjectParser(getJsonFactory());
  }
View Full Code Here

 
  public static HttpRequestFactory createRequestFactory(final HttpTransport transport) {
        
      return transport.createRequestFactory(new HttpRequestInitializer() {
       public void initialize(HttpRequest request) {
        JsonObjectParser parser = new JsonObjectParser(jacksonFactory);
        request.setParser(parser);
       }
    });
  }
View Full Code Here

    this.acceptType  = Json.MEDIA_TYPE;

    requestFactory = HTTP_TRANSPORT.createRequestFactory(new HttpRequestInitializer() {
      @Override
      public void initialize(HttpRequest request) {
        request.setParser(new JsonObjectParser(JSON_FACTORY));
      }
    });

  }
View Full Code Here

    private HttpRequestFactory createRequestFactory() {
        return HTTP_TRANSPORT.createRequestFactory(new HttpRequestInitializer() {
            @Override
            public void initialize(HttpRequest request) {
                request.setParser(new JsonObjectParser(JSON_FACTORY));
                request.getHeaders().setBasicAuthentication(asanaConfiguration.getUserApiKey(), " ");
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.google.api.client.json.JsonObjectParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.