Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java @ 4451:e2d8f344491e
Use static variable for login page name in LoginServlet
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Thu, 08 Nov 2012 10:47:24 +0100 |
parents | 0074c113bb95 |
children | fea3e4b6faba |
comparison
equal
deleted
inserted
replaced
4450:0074c113bb95 | 4451:e2d8f344491e |
---|---|
19 import de.intevation.flys.client.server.features.Features; | 19 import de.intevation.flys.client.server.features.Features; |
20 | 20 |
21 public class LoginServlet extends HttpServlet { | 21 public class LoginServlet extends HttpServlet { |
22 | 22 |
23 private static Logger logger = Logger.getLogger(LoginServlet.class); | 23 private static Logger logger = Logger.getLogger(LoginServlet.class); |
24 | |
24 private static final String FLYS_PAGE = "FLYS.html"; | 25 private static final String FLYS_PAGE = "FLYS.html"; |
26 private static final String LOGIN_PAGE = "login.jsp"; | |
25 | 27 |
26 private void redirectFailure(HttpServletResponse resp, String path) | 28 private void redirectFailure(HttpServletResponse resp, String path) |
27 throws IOException { | 29 throws IOException { |
28 resp.sendRedirect(path + "/login.jsp"); | 30 resp.sendRedirect(path + "/" + LOGIN_PAGE); |
29 } | 31 } |
30 | 32 |
31 private void redirectFailure(HttpServletResponse resp, String path, | 33 private void redirectFailure(HttpServletResponse resp, String path, |
32 Exception e) throws IOException { | 34 Exception e) throws IOException { |
33 this.redirectFailure(resp, path, e.getMessage()); | 35 this.redirectFailure(resp, path, e.getMessage()); |
34 } | 36 } |
35 | 37 |
36 private void redirectFailure(HttpServletResponse resp, String path, | 38 private void redirectFailure(HttpServletResponse resp, String path, |
37 String message) throws IOException { | 39 String message) throws IOException { |
38 resp.sendRedirect(path + "/login.jsp?error=" + message); | 40 resp.sendRedirect(path + "/" + LOGIN_PAGE + "?error=" + message); |
39 } | 41 } |
40 | 42 |
41 private void redirectSuccess(HttpServletResponse resp, String path, | 43 private void redirectSuccess(HttpServletResponse resp, String path, |
42 String uri) throws IOException { | 44 String uri) throws IOException { |
43 if (uri == null) { | 45 if (uri == null) { |
108 throws AuthenticationException, IOException | 110 throws AuthenticationException, IOException |
109 { | 111 { |
110 ServletContext sc = this.getServletContext(); | 112 ServletContext sc = this.getServletContext(); |
111 Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE); | 113 Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE); |
112 String auth = sc.getInitParameter("authentication"); | 114 String auth = sc.getInitParameter("authentication"); |
113 return AuthenticationFactory.getInstance(auth).auth(username, password, encoding, features); | 115 return AuthenticationFactory.getInstance(auth).auth(username, password, |
116 encoding, features); | |
114 } | 117 } |
115 } | 118 } |