* @param response the HttpServletResponse instance
* @return the name of the next view
*/
public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
Log log = getLog(request, response);
Collection<Request> requests = log.getRequests();
Set<String> uniqueIps = new HashSet<String>();
Set<String> uniqueIpsForNewsFeeds = new HashSet<String>();
Set<String> uniqueIpsForPageViews = new HashSet<String>();
Set<String> uniqueIpsForFileDownloads = new HashSet<String>();
int totalNewsFeedRequests = 0;
int totalPageViews = 0;
int totalFileDownloads = 0;
for (Request aRequest : requests) {
for (LogEntry logEntry : aRequest.getLogEntries()) {
uniqueIps.add(logEntry.getHost());
}
if (aRequest.isNewsFeed()) {
totalNewsFeedRequests += aRequest.getCount();
for (LogEntry logEntry : aRequest.getLogEntries()) {
uniqueIpsForNewsFeeds.add(logEntry.getHost());
}
} else if (aRequest.isPageView()) {
totalPageViews += aRequest.getCount();
for (LogEntry logEntry : aRequest.getLogEntries()) {
uniqueIpsForPageViews.add(logEntry.getHost());
}
} else if (aRequest.isFileDownload()) {
totalFileDownloads += aRequest.getCount();
for (LogEntry logEntry : aRequest.getLogEntries()) {
uniqueIpsForFileDownloads.add(logEntry.getHost());
}
}
}
getModel().put("logAction", "viewRequestsByType");
getModel().put("totalRequests", log.getTotalLogEntries());
getModel().put("uniqueIps", uniqueIps.size());
getModel().put("totalNewsfeedRequests", totalNewsFeedRequests);
getModel().put("uniqueIpsForNewsFeeds", uniqueIpsForNewsFeeds.size());
getModel().put("totalPageViews", totalPageViews);
getModel().put("uniqueIpsForPageViews", uniqueIpsForPageViews.size());