1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 * 9 * http://www.apache.org/licenses/LICENSE-2.010 * 11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */17packageorg.apache.jetspeed.container.state.impl;
1819import org.apache.jetspeed.cache.JetspeedContentCache;
20import org.apache.jetspeed.container.PageHistoryValve;
21import org.apache.jetspeed.request.RequestContext;
2223/***24 * SessionFullClearOnChangePageNavigationalState, stores all nav parameters in the session, including render parameters25 *26 * @author <a href="mailto:kmoh.raj@gmail.com">Mohan Kannapareddy</a>27 * @version $Id$28 */2930publicclassSessionFullExtendedNavigationalStateextendsSessionFullNavigationalState31 {
32privateboolean clearStateOnPageChangeEnabled = false;
333435publicSessionFullExtendedNavigationalState(NavigationalStateCodec codec,JetspeedContentCache cache)
36 {
37super(codec, cache);
38 }
39publicSessionFullExtendedNavigationalState(NavigationalStateCodec codec, JetspeedContentCache cache, JetspeedContentCache decorationCache)
40 {
41super(codec, cache, decorationCache);
42 }
4344publicSessionFullExtendedNavigationalState(NavigationalStateCodec codec, JetspeedContentCache cache, JetspeedContentCache decorationCache, boolean clearStateOnPageChangeEnabled)
45 {
46super(codec, cache, decorationCache);
47this.clearStateOnPageChangeEnabled = clearStateOnPageChangeEnabled;
48 }
4950protectedboolean clearPagePortletsModeAndWindowState(RequestContext context)
51 {
52 String contextKey = PageHistoryValve.REQUEST_CLEAR_PORTLETS_MODE_AND_WINDOWSTATE_KEY;
53boolean result = false;
54if (clearStateOnPageChangeEnabled)
55 {
56 Boolean pageNavigationEvent = (Boolean) context.getAttribute(contextKey);
57if ((pageNavigationEvent != null))
58 {
59 result = pageNavigationEvent.booleanValue();
60 }
61 }
62//Just to be safe make it false63 context.setAttribute(contextKey, Boolean.FALSE);
6465return result;
66 }
6768publicsynchronizedvoid sync(RequestContext context)
69 {
70// JS2-806, check the session for a psuedo inter page navigation.71boolean resetPagePortlets = false;
72if (clearStateOnPageChangeEnabled)
73 {
74 resetPagePortlets = clearPagePortletsModeAndWindowState(context);
75if (log.isDebugEnabled())
76 {
77 log.debug("resetPagePortlets:" + resetPagePortlets);
78 }
79 }
8081// push the informaion up to SessionNavigationalState, so that we can handle it appropriately there82 setClearPortletsModeAndWindowStateEnabled(resetPagePortlets);
83//Inform the super84super.sync(context);
85 }
86 }