Package com.huangzhimin.contacts.exception

Examples of com.huangzhimin.contacts.exception.ContactsException


    public List<Contact> getContacts() throws ContactsException {
        ContactsService service = new ContactsService("contactlist");
        try {
            service.setUserCredentials(email, password);
        } catch (AuthenticationException e) {
            throw new ContactsException("login failed", e);
        }
        try {
            URL feedUrl = new URL("http://www.google.com/m8/feeds/contacts/" + email + "/full");
            Query query = new Query(feedUrl);
            query.setMaxResults(Integer.MAX_VALUE);
            ContactFeed resultFeed = service.query(query, ContactFeed.class);
            List<Contact> contacts = new ArrayList<Contact>();
            for (ContactEntry entry : resultFeed.getEntries()) {
                for (Email email : entry.getEmailAddresses()) {
                    String address = email.getAddress();
                    String name = null;
                    if (entry.hasName()) {
                        name = entry.getName().getFullName().getValue();
                    } else {
                        name = getUsername(address);
                    }
                    contacts.add(new Contact(name, address));
                }
            }
            return contacts;
        } catch (Exception e) {
            throw new ContactsException("gmail protocol has changed", e);
        }
    }
View Full Code Here


            .getBytes(), "UTF-8"), friend.getLoginName()));
      }
      logout();
      return contacts;
    } catch (Exception e) {
      throw new ContactsException("msn protocol has changed", e);
    }
  }
View Full Code Here

      responseStr = doGet(redirectUrl1, loginUrl);
     
      String redirectUrl2 = getJSRedirectLocation(responseStr);
      indexPage = doGet(redirectUrl2, redirectUrl1);
    } catch (Exception e) {
      throw new ContactsException("126 protocol has changed", e);
    }
  }
View Full Code Here

          contacts.add(new Contact(username, email));
        }
      }
      return contacts;
    } catch (Exception e) {
      throw new ContactsException("126 protocol has changed", e);
    }
  }
View Full Code Here

          new NameValuePair("user", getUsername(email)),
          new NameValuePair("pass", password),
          new NameValuePair("verifycookie", "y") };
      indexPage = doPost(loginUrl, params, "http://mail.tom.com");
    } catch (Exception e) {
      throw new ContactsException("tom protocol has changed", e);
    }
  }
View Full Code Here

          contacts.add(new Contact(username, email));
        }
      }
      return contacts;
    } catch (Exception e) {
      throw new ContactsException("tom protocol has changed", e);
    }
  }
View Full Code Here

            };
            responseStr = doPost(loginUrl, params, lastUrl);
            String redirectUrl = getHrefUrl(responseStr, "/webmail/logon.do");
            doGet(lastUrl.substring(0, lastUrl.indexOf("/webmail/")) + redirectUrl, loginUrl);
        } catch (Exception e) {
      throw new ContactsException("189 protocol has changed", e);
    }
    }
View Full Code Here

                if (empty) break;
                page++;
            }
            return contacts;
        } catch (Exception e) {
            throw new ContactsException("189 protocol has changed", e);
        }
    }
View Full Code Here

    public void doLogin() throws ContactsException {
        try {
            String loginData = doSoapPost(loginRequestUrl(), loginRequestXml(), null);
            loginResponseHandle(loginData);
        } catch (Exception e) {
            throw new ContactsException("Hotmail protocol has changed", e);
        }
    }
View Full Code Here

        try {
            String contactsData = doSoapPost(contactsRequestUrl(), contactsRequestXml(), contactsRequestAction());

            return contactsResponseHandle(contactsData);
        } catch (Exception e) {
            throw new ContactsException("Hotmail protocol has changed", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.huangzhimin.contacts.exception.ContactsException

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.