}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
VosaoContext ctx = VosaoContext.getInstance();
ctx.setSkipURLs(skipURLs);
HttpServletRequest httpRequest = (HttpServletRequest)request;
HttpServletResponse httpResponse = (HttpServletResponse)response;
String url = httpRequest.getServletPath();
if (url.startsWith("/_ah/plugin")) {
if (processPluginServlet(request, response)) {
return;
}
}
if (ctx.isSkipUrl(url)) {
chain.doFilter(request, response);
return;
}
if (!isLoggedIn(httpRequest) && servedFromCache(url, httpResponse)) {
return;
}
SeoUrlEntity seoUrl = getDao().getSeoUrlDao().getByFrom(url);
if (seoUrl != null) {
httpResponse.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
httpResponse.setHeader("Location", seoUrl.getToLink());
httpResponse.setHeader("Connection", "close");
return;
}
try {
if (getDao().getGroupDao().getGuestsGroup() == null) {
httpResponse.sendRedirect("/setup");
return;
}
PageEntity page = getPage(url, httpRequest);
if (page != null) {
renderPage(httpRequest, httpResponse, page, url);
return;
}
if (url.equals("/")) {
showNoApprovedContent(httpResponse);
return;
}
ConfigEntity config = ctx.getConfig();
if (!StringUtils.isEmpty(config.getSite404Url())) {
page = getPage(config.getSite404Url(), httpRequest);
if (page != null) {
renderPage(httpRequest, httpResponse, page, url);
}
}
httpResponse.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
catch (AccessDeniedException e) {
HttpSession session = httpRequest.getSession(true);
String userEmail = (String)session.getAttribute(
AuthenticationFilter.USER_SESSION_ATTR);
UserEntity user = getDao().getUserDao().getByEmail(userEmail);
ConfigEntity config = ctx.getConfig();
if (user != null) {
renderMessage(httpResponse, Messages.get("access_denied_page"));
return;
}
if (StringUtils.isEmpty(config.getSiteUserLoginUrl())) {