Thanks Sanket, Here is code what I am trying to work with for the reference :
In JSP I am putting this : <a href="https://www.google.com/accounts/AuthsubRequest?next=http:// 59.162.218.75:8080/GContacts/GoogleTest&scope=http://www.google.com/ calendar/feeds/http://www.google.com/m8/feeds/ contacts&secure=0&session=1"> which after authentication redirect me to the :http:// 59.162.218.75:8080/GContacts/GoogleTest And here in the servlet below is the code where I want the userid and password comes from authsub : protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String token=AuthSubUtil.getTokenFromReply(request.getQueryString ()); String sessionToken = AuthSubUtil.exchangeForSessionToken ("https","www.google.com",token, null); ContactsService contactsService = new ContactsService ("GoogleTest"); contactsService.setAuthSubToken(sessionToken, null); contactsService.setUserCredentials("[email protected]", "xxxxxxx#"); GoogleTest.printDateMinQueryResults(contactsService); } catch (AuthenticationException e) { e.printStackTrace(); } } public static void printDateMinQueryResults(ContactsService myService) { try { URL feedUrl = new URL("https://www.google.com/ m8/feeds/contacts/default/full"); Query myQuery = new Query(feedUrl); myQuery.setMaxResults(999999); ContactFeed resultFeed = myService.query(myQuery, ContactFeed.class); System.out.println("****" +resultFeed.getTitle ().getPlainText()); List<ContactEntry> entry = resultFeed.getEntries (); for (ContactEntry ce : entry) { final List<Email> ee = ce.getEmailAddresses(); final List<Im> mm = ce.getImAddresses(); } // // Print the results for (int i = 0; i < resultFeed.getEntries().size(); i++) { ContactEntry entry1 = resultFeed.getEntries().get(i); List<Email> ee=entry1.getEmailAddresses(); for(Email ss : ee) { System.out.println("==>"+ss.getAddress()); } } } catch (ServiceException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } thanks in advance -- You received this message because you are subscribed to the Google Groups "Google Contacts API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en.
