Package com.google.gdata.data.contacts

Examples of com.google.gdata.data.contacts.ContactFeed


  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    String encodedAddress = UriEscapers.uriEscaper().escape(user.getAddress());
    if (!userContext.hasOAuthCredentials()) {
      // Return an empty set of contacts; the client will show unknown avatars
      // and never call PhotosHandler.
      printJson(new ContactFeed(), encodedAddress, resp);
      return;
    }
    Pair<Integer, Integer> range = getRange(req);
    log.info("Fetching contacts for: " + user + ", [" + range.first + ", " + range.second + ")");
    URL url = new URL(FEED_URL + encodedAddress + "/thin"
        + "?start-index=" + range.first + "&max-results=" + (range.second - range.first));
    ContactFeed results;
    try {
      results = contacts.get().getFeed(url, ContactFeed.class);
    } catch (ServiceException e) {
      throw new IOException("Contact fetch failed: ", e);
    }
    log.info("Fetched " + results.getEntries().size() + " contacts for " + user);

    // Support ?format=html for debugging.
    if ("html".equals(req.getParameter("format"))) {
      printHtml(results, encodedAddress, resp);
    } else {
View Full Code Here


          feedUrl = new URL(
              "https://www.google.com/m8/feeds/contacts/keklikhasan@gmail.com/full");
        } catch (Exception e) {
          error(e);
        }
        ContactFeed resultFeed = null;
       
          try {
            resultFeed = service.getFeed(feedUrl, ContactFeed.class);
          } catch (IOException e) {
            error(e);
          } catch (ServiceException e) {
            error(e);
          }
       
        info(resultFeed.getTitle().getPlainText());

        for (int i = 0; i < resultFeed.getEntries().size(); i++) {
          ContactEntry entry = resultFeed.getEntries().get(i);
          info("\t" + entry.getTitle().getPlainText());

          info("Email addresses:");
          for (Email email : entry.getEmailAddresses()) {
            info(" " + email.getAddress());
View Full Code Here

      }

      URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full");
      ContactQuery contactQuery = new ContactQuery(feedUrl);
      contactQuery.setMaxResults(1000);
      ContactFeed resultFeed = service.getFeed(contactQuery, ContactFeed.class);

      for (ContactEntry contactEntry : resultFeed.getEntries()) {
        if (contactEntry.hasEmailAddresses()) {
          for (Email email : contactEntry.getEmailAddresses()) {
            if (email.getAddress().contains("gmail.com") && !email.getAddress().equals(loginInfo.getEmailAddress())) {
              contactModel = new ContactModel();
              contactModel.setEmailAddress(email.getAddress());
View Full Code Here

TOP

Related Classes of com.google.gdata.data.contacts.ContactFeed

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.