1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.container.state.impl;
18
19 import org.apache.jetspeed.cache.JetspeedContentCache;
20 import org.apache.jetspeed.container.PageHistoryValve;
21 import org.apache.jetspeed.request.RequestContext;
22
23 /***
24 * SessionFullClearOnChangePageNavigationalState, stores all nav parameters in the session, including render parameters
25 *
26 * @author <a href="mailto:kmoh.raj@gmail.com">Mohan Kannapareddy</a>
27 * @version $Id$
28 */
29
30 public class SessionFullExtendedNavigationalState extends SessionFullNavigationalState
31 {
32 private boolean clearStateOnPageChangeEnabled = false;
33
34
35 public SessionFullExtendedNavigationalState(NavigationalStateCodec codec,JetspeedContentCache cache)
36 {
37 super(codec, cache);
38 }
39 public SessionFullExtendedNavigationalState(NavigationalStateCodec codec, JetspeedContentCache cache, JetspeedContentCache decorationCache)
40 {
41 super(codec, cache, decorationCache);
42 }
43
44 public SessionFullExtendedNavigationalState(NavigationalStateCodec codec, JetspeedContentCache cache, JetspeedContentCache decorationCache, boolean clearStateOnPageChangeEnabled)
45 {
46 super(codec, cache, decorationCache);
47 this.clearStateOnPageChangeEnabled = clearStateOnPageChangeEnabled;
48 }
49
50 protected boolean clearPagePortletsModeAndWindowState(RequestContext context)
51 {
52 String contextKey = PageHistoryValve.REQUEST_CLEAR_PORTLETS_MODE_AND_WINDOWSTATE_KEY;
53 boolean result = false;
54 if (clearStateOnPageChangeEnabled)
55 {
56 Boolean pageNavigationEvent = (Boolean) context.getAttribute(contextKey);
57 if ((pageNavigationEvent != null))
58 {
59 result = pageNavigationEvent.booleanValue();
60 }
61 }
62
63 context.setAttribute(contextKey, Boolean.FALSE);
64
65 return result;
66 }
67
68 public synchronized void sync(RequestContext context)
69 {
70
71 boolean resetPagePortlets = false;
72 if (clearStateOnPageChangeEnabled)
73 {
74 resetPagePortlets = clearPagePortletsModeAndWindowState(context);
75 if (log.isDebugEnabled())
76 {
77 log.debug("resetPagePortlets:" + resetPagePortlets);
78 }
79 }
80
81
82 setClearPortletsModeAndWindowStateEnabled(resetPagePortlets);
83
84 super.sync(context);
85 }
86 }