Search in sources :

Example 1 with NewsMoreResponse

use of cn.eoe.app.entity.NewsMoreResponse in project android-app by eoecn.

the class NewsDao method getMore.

public NewsMoreResponse getMore(String more_url) {
    NewsMoreResponse response;
    try {
        String result = RequestCacheUtil.getRequestContent(mActivity, more_url + Utility.getScreenParams(mActivity), Constants.WebSourceType.Json, Constants.DBContentType.Content_list, true);
        response = mObjectMapper.readValue(result, new TypeReference<NewsMoreResponse>() {
        });
        return response;
    } catch (JsonParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JsonMappingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
Also used : JsonMappingException(org.codehaus.jackson.map.JsonMappingException) TypeReference(org.codehaus.jackson.type.TypeReference) IOException(java.io.IOException) NewsMoreResponse(cn.eoe.app.entity.NewsMoreResponse) JsonParseException(org.codehaus.jackson.JsonParseException)

Example 2 with NewsMoreResponse

use of cn.eoe.app.entity.NewsMoreResponse in project android-app by eoecn.

the class TopDao method mapperJson.

public List<Object> mapperJson(boolean useCache) {
    List<Object> topCategorys = new ArrayList<Object>();
    tabs.clear();
    try {
        String resultNews = RequestCacheUtil.getRequestContent(mActivity, Urls.TOP_NEWS_URL + Utility.getScreenParams(mActivity), Constants.WebSourceType.Json, Constants.DBContentType.Content_list, useCache);
        NewsMoreResponse newsMoreResponse = mObjectMapper.readValue(resultNews, new TypeReference<NewsMoreResponse>() {
        });
        if (newsMoreResponse != null) {
            this.newsCategorys = newsMoreResponse.getResponse();
        }
        String resultBlogs = RequestCacheUtil.getRequestContent(mActivity, Urls.TOP_BLOG_URL + Utility.getScreenParams(mActivity), Constants.WebSourceType.Json, Constants.DBContentType.Content_list, useCache);
        BlogsMoreResponse blogsMoreResponse = mObjectMapper.readValue(resultBlogs, new TypeReference<BlogsMoreResponse>() {
        });
        if (blogsMoreResponse != null) {
            this.blogsCategorys = blogsMoreResponse.getResponse();
        }
        String resultWiki = RequestCacheUtil.getRequestContent(mActivity, Urls.TOP_WIKI_URL + Utility.getScreenParams(mActivity), Constants.WebSourceType.Json, Constants.DBContentType.Content_list, useCache);
        WikiMoreResponse wikiMoreResponse = mObjectMapper.readValue(resultWiki, new TypeReference<WikiMoreResponse>() {
        });
        if (wikiMoreResponse != null) {
            this.wikiCategorys = wikiMoreResponse.getResponse();
        }
        Collections.addAll(topCategorys, newsCategorys, blogsCategorys, wikiCategorys);
        return topCategorys;
    } catch (JsonParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JsonMappingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) BlogsMoreResponse(cn.eoe.app.entity.BlogsMoreResponse) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException) IOException(java.io.IOException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) JsonParseException(org.codehaus.jackson.JsonParseException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) WikiMoreResponse(cn.eoe.app.entity.WikiMoreResponse) NewsMoreResponse(cn.eoe.app.entity.NewsMoreResponse)

Aggregations

NewsMoreResponse (cn.eoe.app.entity.NewsMoreResponse)2 IOException (java.io.IOException)2 JsonParseException (org.codehaus.jackson.JsonParseException)2 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)2 BlogsMoreResponse (cn.eoe.app.entity.BlogsMoreResponse)1 WikiMoreResponse (cn.eoe.app.entity.WikiMoreResponse)1 ArrayList (java.util.ArrayList)1 TypeReference (org.codehaus.jackson.type.TypeReference)1