System.out.println("Error path.");
response.sendRedirect("/home");
}
typeChart = URLDecoder.decode(typeChart, "UTF8");
System.out.println("Chart type : " + typeChart);
TubesFeed result = null;
if (typeChart.equalsIgnoreCase("most-viewed")) {
result = TubeService.getMostView("today", itemPerPage, page);
} else if (typeChart.equalsIgnoreCase("most-shared")) {
result = TubeService.getMostShared(itemPerPage, page);
} else if (typeChart.equalsIgnoreCase("top-rated")) {
result = TubeService.getTopRate("today", itemPerPage, page);
} else if (typeChart.equalsIgnoreCase("most-discussed")) {
result = TubeService.getMostDiscussed("today", itemPerPage, page);
} else if (typeChart.equalsIgnoreCase("top-favorites")) {
result = TubeService.getTopFavorites("today", itemPerPage, page);
}
if (result != null && result.getListTube().size() > 0) {
request.setAttribute("url", request.getRequestURL());
request.setAttribute("listCategory",
JavaCacheHandle.getCategory());
request.setAttribute("listChannel",
JavaCacheHandle.getChannels());
request.setAttribute("result", result.getListTube());
request.setAttribute("typeChart", typeChart);
request.setAttribute("totalResult", result.getTotalResult());
System.out.println(result.getTotalResult());
request.setAttribute("currentPage", result.getCurrentPage());
request.getRequestDispatcher("/tube_charts.jsp").forward(request,
response);
} else {
System.out.println("Null pointer.");
response.sendRedirect("/home");