Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/GGInAFilter.java @ 3851:a4c9296f6efa
Use the Context PATH servlet variable when using URLs in the GGInAFilter
flys-client/trunk@5591 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 24 Sep 2012 13:04:53 +0000 |
parents | 71ba3cf3ec5e |
children | 17fe00c09b7c |
comparison
equal
deleted
inserted
replaced
3850:8d0ababa2db7 | 3851:a4c9296f6efa |
---|---|
32 | 32 |
33 private boolean deactivate = false; | 33 private boolean deactivate = false; |
34 private String authmethod; | 34 private String authmethod; |
35 private ServletContext sc; | 35 private ServletContext sc; |
36 | 36 |
37 public static final String LOGIN_JSP = "/login.jsp"; | |
38 public static final String LOGIN_SERVLET = "/flys/login"; | |
39 public static final String FLYS_CSS = "/FLYS.css"; | |
40 | |
37 | 41 |
38 /** | 42 /** |
39 * Initialize. | 43 * Initialize. |
40 * | 44 * |
41 * Read FilterConfig parameter deactivate | 45 * Read FilterConfig parameter deactivate |
44 public void init(FilterConfig config) | 48 public void init(FilterConfig config) |
45 throws ServletException | 49 throws ServletException |
46 { | 50 { |
47 String deactivate = config.getInitParameter("deactivate"); | 51 String deactivate = config.getInitParameter("deactivate"); |
48 this.sc = config.getServletContext(); | 52 this.sc = config.getServletContext(); |
53 logger.debug("GGInAFilter context " + this.sc.getContextPath()); | |
49 this.authmethod = sc.getInitParameter("authentication"); | 54 this.authmethod = sc.getInitParameter("authentication"); |
50 if (deactivate != null && deactivate.equalsIgnoreCase("true")) { | 55 if (deactivate != null && deactivate.equalsIgnoreCase("true")) { |
51 this.deactivate = true; | 56 this.deactivate = true; |
52 } | 57 } |
53 | 58 |
79 | 84 |
80 logger.debug("Request for: " + requesturi); | 85 logger.debug("Request for: " + requesturi); |
81 | 86 |
82 // Allow access to login pages | 87 // Allow access to login pages |
83 // TODO Maybe replace with Filter <url-pattern> | 88 // TODO Maybe replace with Filter <url-pattern> |
84 if (requesturi.equals("/login.jsp") || requesturi.equals("/flys/login") | 89 String path = this.sc.getContextPath(); |
85 || requesturi.equals("/FLYS.css")) { | 90 if (requesturi.equals(path + "/login.jsp") || |
91 requesturi.equals(path + "/flys/login") | |
92 || requesturi.equals(path + "/FLYS.css")) { | |
86 logger.debug("Request for login " + requesturi); | 93 logger.debug("Request for login " + requesturi); |
87 chain.doFilter(req, resp); | 94 chain.doFilter(req, resp); |
88 return; | 95 return; |
89 } | 96 } |
90 | 97 |
125 return; | 132 return; |
126 } | 133 } |
127 | 134 |
128 private void redirect(ServletResponse resp) throws IOException { | 135 private void redirect(ServletResponse resp) throws IOException { |
129 logger.debug("Redirect to login"); | 136 logger.debug("Redirect to login"); |
130 ((HttpServletResponse) resp).sendRedirect("/login.jsp"); | 137 ((HttpServletResponse) resp).sendRedirect(this.sc.getContextPath() + |
138 "/login.jsp"); | |
131 } | 139 } |
132 | 140 |
133 | 141 |
134 /** | 142 /** |
135 * Do nothing at destruction. | 143 * Do nothing at destruction. |