Package org.brickred.socialauth.util

Examples of org.brickred.socialauth.util.Response


  private Profile authFacebookLogin() throws Exception {
    String presp;

    try {
      Response response = authenticationStrategy.executeFeed(PROFILE_URL);
      presp = response.getResponseBodyAsString(Constants.ENCODING);
    } catch (Exception e) {
      throw new SocialAuthException("Error while getting profile from "
          + PROFILE_URL, e);
    }
    try {
View Full Code Here


    }
    StringBuilder strb = new StringBuilder();
    strb.append("message=").append(
        URLEncoder.encode(msg, Constants.ENCODING));
    strb.append("&access_token").append("=").append(accessGrant.getKey());
    Response serviceResponse;
    try {
      serviceResponse = authenticationStrategy.executeFeed(
          UPDATE_STATUS_URL, MethodType.POST.toString(), null, null,
          strb.toString());
      if (serviceResponse.getStatus() != 200) {
        throw new SocialAuthException(
            "Status not updated. Return Status code :"
                + serviceResponse.getStatus());
      }
    } catch (Exception e) {
      throw new SocialAuthException(e);
    }
    return serviceResponse;
View Full Code Here

  public List<Contact> getContactList() throws Exception {
    List<Contact> plist = new ArrayList<Contact>();
    LOG.info("Fetching contacts from " + CONTACTS_URL);
    String respStr;
    try {
      Response response = authenticationStrategy
          .executeFeed(CONTACTS_URL);
      respStr = response.getResponseBodyAsString(Constants.ENCODING);
    } catch (Exception e) {
      throw new SocialAuthException("Error while getting contacts from "
          + CONTACTS_URL, e);
    }
    try {
View Full Code Here

  public Response api(final String url, final String methodType,
      final Map<String, String> params,
      final Map<String, String> headerParams, final String body)
      throws Exception {
    LOG.info("Calling api function for url  :  " + url);
    Response response = null;
    try {
      response = authenticationStrategy.executeFeed(url, methodType,
          params, headerParams, body);
    } catch (Exception e) {
      throw new SocialAuthException(
View Full Code Here

      final InputStream inputStream) throws Exception {
    LOG.info("Uploading Image :: " + fileName + ", status message :: "
        + message);
    Map<String, String> map = new HashMap<String, String>();
    map.put("name", message);
    Response response = authenticationStrategy.uploadImage(
        IMAGE_UPLOAD_URL, MethodType.POST.toString(), map, null,
        fileName, inputStream, null);
    LOG.info("Upload Image status::" + response.getStatus());
    return response;
  }
View Full Code Here

    String url = ENDPOINTS.get(Constants.OAUTH_ACCESS_TOKEN_URL)
        + "?grant_type=fb_exchange_token&client_id=%1$s&client_secret=%2$s&fb_exchange_token=%3$s";
    url = String.format(url, config.get_consumerKey(),
        config.get_consumerSecret(), expireAccessGrant.getKey());
    LOG.debug("URL for Refresh Token :: " + url);
    Response response = HttpUtil.doHttpRequest(url,
        MethodType.GET.toString(), null, null);
    String result = null;
    try {
      result = response.getResponseBodyAsString(Constants.ENCODING);
    } catch (Exception e) {
      throw new SocialAuthException(e);
    }

    Map<String, Object> attributes = new HashMap<String, Object>();
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
          + providerSupport.getAccessGrant().getKey());
    } 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

  public List<Contact> getContactList() throws Exception {
    List<Contact> plist = new ArrayList<Contact>();
    LOG.info("Fetching contacts from " + CONTACTS_URL);
    String respStr;
    try {
      Response response = authenticationStrategy
          .executeFeed(CONTACTS_URL);
      respStr = response.getResponseBodyAsString(Constants.ENCODING);
    } catch (Exception e) {
      throw new SocialAuthException("Error while getting contacts from "
          + CONTACTS_URL, e);
    }
    try {
View Full Code Here

  public Response api(final String url, final String methodType,
      final Map<String, String> params,
      final Map<String, String> headerParams, final String body)
      throws Exception {
    LOG.info("Calling api function for url  :  " + url);
    Response response = null;
    try {
      response = authenticationStrategy.executeFeed(url, methodType,
          params, headerParams, body);
    } catch (Exception e) {
      throw new SocialAuthException(
View Full Code Here

    StringBuilder strb = new StringBuilder();
    strb.append("code=").append(code);
    strb.append("&client_secret=").append(config.get_consumerSecret());

    LOG.debug("Parameters for access token : " + strb.toString());
    Response response;
    try {
      response = HttpUtil.doHttpRequest(url, MethodType.GET.toString(),
          null, null);
    } catch (Exception e) {
      throw new SocialAuthException("Error in url : " + e);
    }
    String result = null;
    if (response.getStatus() == 200) {
      try {
        result = response.getResponseBodyAsString(Constants.ENCODING);
      } catch (Exception exc) {
        throw new SocialAuthException("Failed to parse response", exc);
      }
    }
    if (result == null || result.length() == 0) {
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.