use of com.newsrob.download.NewsRobHttpClient in project newsrob by marianokamp.
the class GRAnsweredBadRequestException method remotelyAlterState.
private int remotelyAlterState(Collection<Entry> entries, final String column, String desiredState) throws ReaderAPIException {
NewsRobHttpClient httpClient = NewsRobHttpClient.newInstance(false, context);
try {
HttpPost editApiRequest = new HttpPost(getGoogleHost() + "/reader/api/0/edit-tag?client=" + CLIENT_NAME);
submitPostRequest(httpClient, editApiRequest, createNVPForAlterRemoteState(entries, column, desiredState), false);
// At this point the submitPost is already done without errors
// otherwise an exception would have been raised
List<String> atomIds = new ArrayList<String>(entries.size());
for (Entry entry : entries) atomIds.add(entry.getAtomId());
getEntryManager().removePendingStateMarkers(atomIds, column);
return entries.size();
} catch (Exception e) {
String message = "Problem during marking entry as un-/read: " + e.getMessage();
Log.e(TAG, message, e);
throw new ReaderAPIException(message, e);
} finally {
httpClient.close();
}
}
use of com.newsrob.download.NewsRobHttpClient in project newsrob by marianokamp.
the class GRAnsweredBadRequestException method fetchStreamIds.
private long[] fetchStreamIds(final EntryManager entryManager, String tag, final String googleStateToExclude) throws SAXException, IOException, ParserConfigurationException, GRTokenExpiredException, GRAnsweredBadRequestException {
Timing t = new Timing("ER.fetchStreamIds for " + tag + " xt=" + googleStateToExclude, context);
PL.log("ER.fetchStreamIds for " + tag + " xt=" + googleStateToExclude + " (1)", context);
NewsRobHttpClient httpClient = NewsRobHttpClient.newInstance(false, context);
try {
List<String> tags = new ArrayList<String>(2);
// tags.add(GOOGLE_STATE_READING_LIST);
if (tag != null)
tags.add(tag);
long[] unreadIds = getStreamIDsFromGR(httpClient, tags, googleStateToExclude, MAX_ARTICLES_ON_GOOGLE_READER_ACCOUNT);
PL.log("EntriesRetriever.getUnreadIDsFromGR done.", context);
return unreadIds;
} finally {
httpClient.close();
t.stop();
PL.log("ER.fetchStreamIds for " + tag + " xt=" + googleStateToExclude + " (2)", context);
}
}
Aggregations