params.put("ps", "20");
Wiki wiki = wikiService.getWiki(wikiLabel, params);
JsonJavaObject result = entityToJsonObject(wiki, WikiXPath.values(),
null);
JsonJavaArray pagesArray = new JsonJavaArray();
int page = 1;
int writtenPages = 0;
boolean morePages = true;
do{
params.put("page", Integer.toString(page));
EntityList<WikiPage> wikiPages = wikiService.getWikiPages(wikiLabel, params);
for (Iterator<WikiPage> iter = wikiPages.iterator(); iter.hasNext();) {
JsonJavaObject wikiEntry = new JsonJavaObject();
WikiPage wikiPage = iter.next();
entityToJsonObject(wikiPage, AtomXPath.values(), wikiEntry);
entityToJsonObject(wikiPage, WikiXPath.values(), wikiEntry);
String pageHTML = wikiPage.getContent();
wikiEntry.put("content", pageHTML);
wikiEntry.putArray("pageImages", extractImagesFromWikiPage(pageHTML));
pagesArray.add(wikiEntry);
}
writtenPages += wikiPages.size();
int total = wikiPages.getTotalResults();
if(writtenPages < total){
morePages = true;