Package org.brickred.socialauth.util

Examples of org.brickred.socialauth.util.Response


   * The message field of the feeds includes the urls of the images
   */
  public List<Feed> getFeeds() throws Exception {
    List<Feed> list = new ArrayList<Feed>();
    try {
      Response response = providerSupport.api(FEED_URL);
      String respStr = response
          .getResponseBodyAsString(Constants.ENCODING);
      LOG.debug("Feed Json response :: " + respStr);
      JSONObject resp = new JSONObject(respStr);
      JSONArray data = resp.getJSONArray("data");
      LOG.debug("Feeds count : " + data.length());
View Full Code Here


    this.providerSupport = providerSupport;
  }

  @Override
  public List<Album> getAlbums() throws Exception {
    Response response = providerSupport.api(ALBUMS_URL,
        MethodType.GET.toString(), null, null, null);
    String respStr = response.getResponseBodyAsString(Constants.ENCODING);
    LOG.debug("Albums JSON :: " + respStr);
    List<Album> albums = new ArrayList<Album>();
    JSONObject resp = new JSONObject(respStr);
    JSONArray data = resp.getJSONArray("data");
    LOG.debug("Albums count : " + data.length());
View Full Code Here

    }
    return albums;
  }

  private List<Photo> getAlbumPhotos(final String id) throws Exception {
    Response response = providerSupport.api(
        String.format(ALBUM_PHOTOS_URL, id), MethodType.GET.toString(),
        null, null, null);
    String respStr = response.getResponseBodyAsString(Constants.ENCODING);
    LOG.info("Getting Photos of Album :: " + id);
    JSONObject resp = new JSONObject(respStr);
    JSONArray data = resp.getJSONArray("data");
    LOG.debug("Photos count : " + data.length());
    List<Photo> photos = new ArrayList<Photo>();
View Full Code Here

  }

  @Override
  public Career getCareerDetails() throws Exception {
    LOG.info("Fetching career details from " + PROFILE_URL);
    Response serviceResponse = null;
    try {
      serviceResponse = providerSupport.api(PROFILE_URL);
    } catch (Exception ie) {
      throw new SocialAuthException(
          "Failed to retrieve the career details from " + PROFILE_URL,
          ie);
    }
    Element root;
    try {
      root = XMLParseUtil.loadXmlResource(serviceResponse
          .getInputStream());
    } catch (Exception e) {
      throw new ServerDataException(
          "Failed to parse the career details from response."
              + PROFILE_URL, e);
View Full Code Here

  @Override
  public List<Feed> getFeeds() throws Exception {
    LOG.info("getting feeds for google plus");
    List<Feed> list = new ArrayList<Feed>();
    try {
      Response response = providerSupport.api(FEED_URL);
      String respStr = response
          .getResponseBodyAsString(Constants.ENCODING);
      System.out.println(respStr);
      JSONObject resp = new JSONObject(respStr);
      JSONArray items = resp.getJSONArray("items");
      LOG.debug("Feeds count : " + items.length());
View Full Code Here

  @Override
  public List<Feed> getFeeds() throws Exception {
    List<Feed> list = new ArrayList<Feed>();
    try {
      Response response = providerSupport.api(FEED_URL);
      String respStr = response
          .getResponseBodyAsString(Constants.ENCODING);
      JSONObject resp = new JSONObject(respStr);
      JSONArray data = resp.getJSONArray("data");
      LOG.debug("Feeds count : " + data.length());
      for (int i = 0; i < data.length(); i++) {
View Full Code Here

    this.providerSupport = providerSupport;
  }

  @Override
  public List<Album> getAlbums() throws Exception {
    Response response = null;
    List<Album> albums = new ArrayList<Album>();
    LOG.info("Getting feeds from URL : " + FEED_URL);

    response = providerSupport.api(FEED_URL);
    String respStr = response.getResponseBodyAsString(Constants.ENCODING);
    LOG.debug("Feeds json string :: " + respStr);
    JSONArray jarr = new JSONArray(respStr);
    LOG.debug("Feeds count :: " + jarr.length());

    for (int i = 0; i < jarr.length(); i++) {
View Full Code Here

   * @throws Exception
   */
  @Override
  public List<Feed> getFeeds() throws Exception {
    LOG.info("Getting feeds from URL : " + FEED_URL);
    Response serviceResponse = null;
    List<Feed> list;
    try {
      serviceResponse = providerSupport.api(FEED_URL);
    } catch (Exception ie) {
      throw new SocialAuthException("Failed to retrieve the feeds from "
          + FEED_URL, ie);
    }

    if (serviceResponse.getStatus() != 200) {
      throw new SocialAuthException("Failed to retrieve the feeds from  "
          + FEED_URL + ". Staus :" + serviceResponse.getStatus());
    }
    Element root;
    try {
      root = XMLParseUtil.loadXmlResource(serviceResponse
          .getInputStream());
      list = getStatusFeed(root);

    } catch (Exception e) {
      throw new ServerDataException(
View Full Code Here

  }

  private Profile getProfile() throws Exception {
    LOG.debug("Obtaining user profile");
    Profile profile = new Profile();
    Response serviceResponse;
    try {
      serviceResponse = authenticationStrategy.executeFeed(PROFILE_URL);
    } catch (Exception e) {
      throw new SocialAuthException(
          "Failed to retrieve the user profile from  " + PROFILE_URL,
          e);
    }
    String res;
    try {
      res = serviceResponse.getResponseBodyAsString(Constants.ENCODING);
    } catch (Exception exc) {
      throw new SocialAuthException("Failed to read response from  "
          + PROFILE_URL, exc);
    }
View Full Code Here

  @Override
  public List<Contact> getContactList() throws Exception {
    LOG.info("Fetching contacts from " + CONTACTS_URL);

    Response serviceResponse;
    try {
      serviceResponse = authenticationStrategy.executeFeed(CONTACTS_URL);
    } catch (Exception e) {
      throw new SocialAuthException("Error while getting contacts from "
          + CONTACTS_URL, e);
    }
    if (serviceResponse.getStatus() != 200) {
      throw new SocialAuthException("Error while getting contacts from "
          + CONTACTS_URL + "Status : " + serviceResponse.getStatus());
    }
    String respStr;
    try {
      respStr = serviceResponse
          .getResponseBodyAsString(Constants.ENCODING);
    } catch (Exception exc) {
      throw new SocialAuthException("Failed to read response from  "
          + CONTACTS_URL, exc);
    }
View Full Code Here

TOP

Related Classes of org.brickred.socialauth.util.Response

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.