Examples of JacksonFactory


Examples of com.google.api.client.json.jackson.JacksonFactory

        if (emailMap.containsKey(apiKey)){
            return emailMap.get(apiKey);
        }

        HttpTransport httpTransport = new NetHttpTransport();
        JacksonFactory jsonFactory = new JacksonFactory();
        GoogleCredential credential = getCredentials(apiKey);
        String emailAddress = null;

        try{
            Plus plus = new Plus(httpTransport, jsonFactory, credential);
View Full Code Here

Examples of com.google.api.client.json.jackson.JacksonFactory

    }

    private Gmail getGmailService(ApiKey apiKey) throws UpdateFailedException{
        HttpTransport httpTransport = new NetHttpTransport();
        JacksonFactory jsonFactory = new JacksonFactory();
        GoogleCredential credential = getCredentials(apiKey);
        return new Gmail(httpTransport, jsonFactory, credential);
    }
View Full Code Here

Examples of com.google.api.client.json.jackson.JacksonFactory

    log.info("code=" + code);

    log.info("clientId=" + clientId + ", clientSecret=" + clientSecret + ", code=" + code
        + ", callbackUrl=" + callbackUrl);
    GoogleAuthorizationCodeGrant authRequest = new GoogleAuthorizationCodeGrant(
        new UrlFetchTransport(), new JacksonFactory(), clientId, clientSecret, code, callbackUrl);

    AccessTokenResponse authResponse;
    try {
      authResponse = authRequest.execute();
    } catch (IOException e) {
View Full Code Here

Examples of com.google.api.client.json.jackson.JacksonFactory

      @Flag(FlagName.OAUTH_CLIENT_SECRET) String clientSecret,
      UserContext userContext) {
    this.userContext = userContext;
    this.accessThing = new GoogleAccessProtectedResource(
        getCredentials().getAccessToken(),
        new UrlFetchTransport(), new JacksonFactory(), clientId, clientSecret,
        getCredentials().getRefreshToken());
  }
View Full Code Here

Examples of com.google.api.client.json.jackson.JacksonFactory

  public static Credential getComputeEngineCredential()
      throws GeneralSecurityException, IOException {
    NetHttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
    try {
      // Try to connect using Google Compute Engine service account credentials.
      ComputeCredential credential = new ComputeCredential(transport, new JacksonFactory());
      // Force token refresh to detect if we are running on Google Compute Engine.
      credential.refreshToken();
      return credential;
    } catch (IOException e) {
      return null;
View Full Code Here

Examples of com.google.api.client.json.jackson.JacksonFactory

   * @return valid credentials or {@code null}
   */
  public static Credential getServiceAccountCredential(String account, String privateKeyFile)
      throws GeneralSecurityException, IOException {
    NetHttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
    JacksonFactory jsonFactory = new JacksonFactory();
    return new GoogleCredential.Builder()
        .setTransport(transport)
        .setJsonFactory(jsonFactory)
        .setServiceAccountId(account)
        .setServiceAccountScopes(DatastoreOptions.SCOPES)
View Full Code Here

Examples of com.google.api.client.json.jackson.JacksonFactory

  public ModelAndView handleOauthResponse(
      @RequestParam(value = "code") String code,
      HttpServletRequest request) {
    logger.info("Oauth response code is: " + code);
    HttpTransport httpTransport = new NetHttpTransport();
    JacksonFactory jsonFactory = new JacksonFactory();
    ModelAndView mv = new ModelAndView();
    try {
      AccessTokenResponse googleResponse = new GoogleAuthorizationCodeGrant(
          httpTransport, jsonFactory, clientId, clientSecret, code,
          redirectUrl).execute();
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

  public void testExecuteRefreshToken() throws Exception {

    HttpTransport transport = new MockMetadataServerTransport(ACCESS_TOKEN);

    ComputeCredential credential = new ComputeCredential(transport, new JacksonFactory());

    assertTrue(credential.refreshToken());
    assertEquals(ACCESS_TOKEN, credential.getAccessToken());
  }
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

  private static final String CLIENT_ID = "812741506391.apps.googleusercontent.com";
  private static final String CLIENT_SECRET = "{client_secret}";

  public void testBuilder() {
    GoogleAuthorizationCodeFlow.Builder builder = new GoogleAuthorizationCodeFlow.Builder(
        new MockHttpTransport(), new JacksonFactory(), CLIENT_ID, CLIENT_SECRET,
        ImmutableList.of("https://www.googleapis.com/auth/userinfo.email"));
    assertNull(builder.getApprovalPrompt());
    assertNull(builder.getAccessType());
  }
View Full Code Here

Examples of com.google.api.client.json.jackson2.JacksonFactory

    MockGoogleClientRequest<String> jsonHttpRequest2 =
        new MockGoogleClientRequest<String>(client, METHOD2, URI_TEMPLATE2, null, String.class);
    credential = new MockCredential();

    ObjectParser parser =
        testBinary ? new ProtoObjectParser() : new JsonObjectParser(new JacksonFactory());
    BatchRequest batchRequest =
        new BatchRequest(transport, credential).setBatchUrl(new GenericUrl(TEST_BATCH_URL));
    HttpRequest request1 = jsonHttpRequest1.buildHttpRequest();
    request1.setParser(parser);
    HttpRequest request2 = jsonHttpRequest2.buildHttpRequest();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.