import pnews.Article;
import pnews.Category;
+import pnews.Language;
public class Pnews extends HttpServlet {
private static final String CLASS_NAME = Pnews.class.getName();
rp.setContentType("application/json;charset=utf-8");
rp.setCharacterEncoding("utf-8");
- rp.getWriter().write(JSON.getStats(config.getCategories()));
+ rp.getWriter().write(JSON.getStats(provider, config));
}
}
if (path.equals("/")) {
- writeArticles(config.getDefaultCategory(), resp);
+ doTemporaryRedirect(config.getDefaultLanguage().toURL(), resp);
return ;
}
}
}
- for (String l: config.getLanguages()) {
- if (path.equals("/" + l) || path.equals("/" + l + "/")) {
+ for (Language l: config.getLanguages()) {
+ if (path.equals(l.toURL())) {
doTemporaryRedirect(config.getDefaultCategory().getURL(), resp);
return ;
}