import com.rometools.rome.io.FeedException;
-import pnews.Article;
-import pnews.Category;
-import pnews.Language;
+import net.wpitchoune.pnews.Article;
+import net.wpitchoune.pnews.ArticleStore;
+import net.wpitchoune.pnews.Category;
+import net.wpitchoune.pnews.Config;
+import net.wpitchoune.pnews.Language;
public class Pnews extends HttpServlet {
private static final String CLASS_NAME = Pnews.class.getName();
if (redirectURL != null) {
a = ArticleStore.singleton.get(redirectURL);
if (a != null)
- a.readCount.incrementAndGet();
+ a.incrementReadCount();
else
LOG.severe("Cannot find the article " + redirectURL);
}
- private void writeArticles(Category cat, HttpServletResponse rp) {
+ private void writeArticles(Category cat, String entity, HttpServletResponse rp) {
String html;
List<Article> articles;
try {
- articles = provider.getArticles(cat);
+ articles = provider.getArticles(cat, entity);
if (articles != null) {
- html = HTML.toHTML(articles, cat, config.getCategories());
+ html = HTML.toHTML(articles, cat, entity, config, provider);
rp.setContentType("text/html;charset=utf-8");
rp.getWriter().write(html);
rp.setCharacterEncoding("utf-8");
} else {
LOG.severe("writeArticles cannot retrieve any articles");
- html = HTML.toHTML(new ArrayList<Article>(), cat, config.getCategories());
+ html = HTML.toHTML(new ArrayList<Article>(), cat, entity, config, provider);
rp.setContentType("text/html");
rp.getWriter().write(html);
}
for (Category cat: config.getCategories()) {
if (path.equals(cat.getURL())) {
- writeArticles(cat, resp);
+ writeArticles(cat, getQueryParameter(req, "entity"), resp);
return ;
}
}