1
2
3
4
5
6
7
8
9
10
11 package com.atlassian.johnson.filters;
12
13 import com.atlassian.johnson.JohnsonEventContainer;
14 import org.apache.log4j.Category;
15
16 import javax.servlet.http.HttpServletRequest;
17 import javax.servlet.http.HttpServletResponse;
18 import java.io.IOException;
19
20
21
22
23
24 public class JohnsonFilter extends AbstractJohnsonFilter
25 {
26 public static final Category log = Category.getInstance(JohnsonFilter.class);
27
28 public static final String ALREADY_FILTERED = JohnsonFilter.class.getName() + "_already_filtered";
29 public static final String URL_SETUP = "/secure/Setup!default.jspa";
30
31 protected void handleError(JohnsonEventContainer appEventContainer, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws IOException
32 {
33 String servletPath = getServletPath(servletRequest);
34 String contextPath = servletRequest.getContextPath();
35 log.info("The application is still starting up, or there are errors. Redirecting request from '" + servletPath + "' to '" + config.getErrorPath() + "'");
36 servletResponse.sendRedirect(contextPath + config.getErrorPath());
37 }
38
39 protected void handleNotSetup(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws IOException
40 {
41 String servletPath = getServletPath(servletRequest);
42 String contextPath = servletRequest.getContextPath();
43 log.info("The application is not yet setup. Redirecting request from '" + servletPath + "' to '" + config.getSetupPath() + "'");
44 servletResponse.sendRedirect(contextPath + config.getSetupPath());
45 }
46 }