Mercurial > dive4elements > gnv-client
comparison gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java @ 394:14eecfde4607
Render links to step back to previous states into gui. Added controller to advance back to these states.
gnv/trunk@538 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 13 Jan 2010 22:17:02 +0000 |
parents | ad381cc47217 |
children | 15ac78a91d1b |
comparison
equal
deleted
inserted
replaced
393:d812c5b62eb4 | 394:14eecfde4607 |
---|---|
34 /** | 34 /** |
35 * This Method provides an singleton Instance of this Class. | 35 * This Method provides an singleton Instance of this Class. |
36 * | 36 * |
37 * @return an singleton Instance of this Class | 37 * @return an singleton Instance of this Class |
38 */ | 38 */ |
39 public static SessionModelFactory getInstance() { | 39 public synchronized static SessionModelFactory getInstance() { |
40 if (instance == null) { | 40 if (instance == null) { |
41 instance = new SessionModelFactory(); | 41 instance = new SessionModelFactory(); |
42 } | 42 } |
43 return instance; | 43 return instance; |
44 } | 44 } |
47 * Getting the ArtifactDatabaseClient | 47 * Getting the ArtifactDatabaseClient |
48 * | 48 * |
49 * @return the ArtifactDatabaseClient | 49 * @return the ArtifactDatabaseClient |
50 */ | 50 */ |
51 public SessionModel getSessionModel(HttpServletRequest request) { | 51 public SessionModel getSessionModel(HttpServletRequest request) { |
52 synchronized (this.getClass()) { | 52 synchronized (request) { |
53 SessionModel sm = null; | 53 SessionModel sm = null; |
54 if (request.getSession().getAttribute(SESSION_MODEL_ID) != null) { | 54 Object obj = request.getSession().getAttribute(SESSION_MODEL_ID); |
55 sm = (SessionModel) request.getSession().getAttribute( | 55 if (obj instanceof SessionModel) { |
56 SESSION_MODEL_ID); | 56 sm = (SessionModel) obj; |
57 ; | |
58 } else { | 57 } else { |
59 sm = new DefaultSessionModel(); | 58 sm = new DefaultSessionModel(); |
60 request.getSession().setAttribute(SESSION_MODEL_ID, sm); | 59 request.getSession().setAttribute(SESSION_MODEL_ID, sm); |
61 } | 60 } |
62 | 61 |