Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java @ 4489:fea3e4b6faba
Return after sending a redirect
Maybe this avoids the internel state errors in tomcat.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Wed, 14 Nov 2012 10:37:21 +0100 |
parents | e2d8f344491e |
children | 82cc03e5f1c4 |
comparison
equal
deleted
inserted
replaced
4488:5041105d2edd | 4489:fea3e4b6faba |
---|---|
78 try { | 78 try { |
79 Authentication aresp = this.auth(username, password, encoding); | 79 Authentication aresp = this.auth(username, password, encoding); |
80 if (aresp == null || !aresp.isSuccess()) { | 80 if (aresp == null || !aresp.isSuccess()) { |
81 logger.debug("Authentication not successful"); | 81 logger.debug("Authentication not successful"); |
82 this.redirectFailure(resp, req.getContextPath()); | 82 this.redirectFailure(resp, req.getContextPath()); |
83 return; | |
83 } | 84 } |
84 User user = aresp.getUser(); | 85 User user = aresp.getUser(); |
85 | 86 |
86 String url = getServletContext().getInitParameter("server-url"); | 87 String url = getServletContext().getInitParameter("server-url"); |
87 UserClient client = new UserClient(url); | 88 UserClient client = new UserClient(url); |
88 if (!client.userExists(user)) { | 89 if (!client.userExists(user)) { |
89 logger.debug("Creating db user"); | 90 logger.debug("Creating db user"); |
90 if (!client.createUser(user)) { | 91 if (!client.createUser(user)) { |
91 this.redirectFailure(resp, req.getContextPath(), | 92 this.redirectFailure(resp, req.getContextPath(), |
92 "Could not create new user"); | 93 "Could not create new user"); |
94 return; | |
93 } | 95 } |
94 } | 96 } |
95 | 97 |
96 HttpSession session = req.getSession(); | 98 HttpSession session = req.getSession(); |
97 session.setAttribute("user", user); | 99 session.setAttribute("user", user); |