Android Open Source - doubanbook4android Douban Request






From Project

Back to project page doubanbook4android.

License

The source code is released under:

Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECI...

If you think the Android project doubanbook4android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * DoubanRequest.java/*from w  w w  .  j  a v  a 2  s  .c  om*/
 * classes : org.kevin.douban.auth.DoubanRequest 
 * Created at : 2013-5-14 ????10:55:12
 */
package com.study.doubanbook_for_android.auth;

import com.study.doubanbook_for_android.api.NetUtils;
import com.study.doubanbook_for_android.utils.JsonUtil;

/**
 * 
 * the request for login or auth
 */
public class DoubanRequest {
  /**
   * ????Access Token
   * ???Content-Type?Text/Html?????GsonHttpMessageConverter?????
   * 
   * @param params
   * @return
   */
  public static Token requestAccessToken(DoubanParameters params) {
    String s = NetUtils.getHttpEntity(Douban.URL_OAUTH2_ACCESS_TOKEN,
        NetUtils.POST, params.getmKeys(), params.getmValues(), null);
    return JsonUtil.fromJsonObject(s, Token.class);
  }

  /**
   * TODO think
   * may i should use the spring frame to simplify the net access?
   * @param params
   * @return
   */
  public static Token requestAccessToken1(DoubanParameters params) {
    //int statusCode = 0;
    // try {
    // RestTemplate restTemplate = new RestTemplate();
    // restTemplate.getMessageConverters().add(
    // new StringHttpMessageConverter());
    // HttpHeaders httpHeaders = new HttpHeaders();
    // httpHeaders.setAccept(Collections.singletonList(new MediaType(
    // "application", "json", Charset.forName("utf-8"))));
    // HttpEntity<?> requestEntity = new HttpEntity<Object>(httpHeaders);
    // ResponseEntity<String> respone = restTemplate.exchange(
    // Douban.URL_OAUTH2_ACCESS_TOKEN.concat("?").concat(
    // UriUtils.encodeParameters(params)),
    // HttpMethod.POST, requestEntity, String.class);
    // statusCode = respone.getStatusCode().value();
    // if (statusCode == 200) {
    // return JsonUtil.fromJsonObject(respone.getBody(), Token.class);
    // } else {
    // return null;
    // }
    // } catch (RestClientException e) {
    // Log.d("douban-request", "status code :" + statusCode
    // + " exception msg:" + e.getMessage());
    // }
    return null;
  }
}




Java Source Code List

.UserListAdapter.java
com.study.doubanbook_for_android.activity.BaseActivity.java
com.study.doubanbook_for_android.activity.BaseP2RActivity.java
com.study.doubanbook_for_android.activity.BookDetailActivity.java
com.study.doubanbook_for_android.activity.BookListsActivity.java
com.study.doubanbook_for_android.activity.BookNoteListActivity.java
com.study.doubanbook_for_android.activity.CollectDetailActivity.java
com.study.doubanbook_for_android.activity.NoteAndUserDetailActivity.java
com.study.doubanbook_for_android.activity.SerchInputActivity.java
com.study.doubanbook_for_android.activity.TextActivity1.java
com.study.doubanbook_for_android.activity.UserDetailActivity.java
com.study.doubanbook_for_android.activity.UserListActivity.java
com.study.doubanbook_for_android.activity.UserNoteActivity.java
com.study.doubanbook_for_android.adapter.BookAdapter.java
com.study.doubanbook_for_android.adapter.CommentAdapter.java
com.study.doubanbook_for_android.adapter.UserNoteAdapter.java
com.study.doubanbook_for_android.api.NetUtils.java
com.study.doubanbook_for_android.api.SSLSocketFactoryEx.java
com.study.doubanbook_for_android.api.WrongMsg.java
com.study.doubanbook_for_android.auth.AccessToken.java
com.study.doubanbook_for_android.auth.DoubanDialogError.java
com.study.doubanbook_for_android.auth.DoubanDialog.java
com.study.doubanbook_for_android.auth.DoubanException.java
com.study.doubanbook_for_android.auth.DoubanOAuthListener.java
com.study.doubanbook_for_android.auth.DoubanParameters.java
com.study.doubanbook_for_android.auth.DoubanRequest.java
com.study.doubanbook_for_android.auth.Douban.java
com.study.doubanbook_for_android.auth.KeepToken.java
com.study.doubanbook_for_android.auth.SimpleDoubanOAuthListener.java
com.study.doubanbook_for_android.auth.Token.java
com.study.doubanbook_for_android.business.DoubanBusiness.java
com.study.doubanbook_for_android.callback.AsynCallback.java
com.study.doubanbook_for_android.imagedownloader.FileCache.java
com.study.doubanbook_for_android.imagedownloader.INetImageDownloader.java
com.study.doubanbook_for_android.imagedownloader.ImageCache.java
com.study.doubanbook_for_android.imagedownloader.ImageDownloaderListener.java
com.study.doubanbook_for_android.imagedownloader.ImageDownloader.java
com.study.doubanbook_for_android.model.Annotations.java
com.study.doubanbook_for_android.model.AuthorUser.java
com.study.doubanbook_for_android.model.BookItem.java
com.study.doubanbook_for_android.model.CollectBookMsg.java
com.study.doubanbook_for_android.model.CollectSuccessResult.java
com.study.doubanbook_for_android.model.CommentItem.java
com.study.doubanbook_for_android.model.Comment.java
com.study.doubanbook_for_android.model.CurrenUserCollection.java
com.study.doubanbook_for_android.model.GeneralNoteResult.java
com.study.doubanbook_for_android.model.GeneralResult.java
com.study.doubanbook_for_android.model.GeneralUserResult.java
com.study.doubanbook_for_android.model.ImageItem.java
com.study.doubanbook_for_android.model.Rating.java
com.study.doubanbook_for_android.model.RequestGrantScope.java
com.study.doubanbook_for_android.model.TagItem.java
com.study.doubanbook_for_android.model.URLMananeger.java
com.study.doubanbook_for_android.utils.EncodeUtils.java
com.study.doubanbook_for_android.utils.JsonParser.java
com.study.doubanbook_for_android.utils.JsonUtil.java
com.study.doubanbook_for_android.utils.UriUtils.java