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 java.io.UnsupportedEncodingException;
20import java.util.HashMap;
21import java.util.Iterator;
22import java.util.Map;
2324import javax.portlet.PortletMode;
25import javax.portlet.WindowState;
2627import org.apache.jetspeed.cache.JetspeedContentCache;
28import org.apache.pluto.om.window.PortletWindow;
2930/***31 * HybridNavigationalState32 * 33 * Only encodes render parameters that start with a given prefix34 *35 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>36 * @version $Id: AbstractNavigationalState.java 333093 2005-11-13 18:42:42Z taylor $37 */38publicclassHybridNavigationalStateextendsSessionNavigationalState39 {
40protected String prefix;
4142publicHybridNavigationalState(NavigationalStateCodec codec, String prefix, JetspeedContentCache cache)
43 {
44super(codec, cache);
45this.prefix = prefix;
46 }
4748public String encode(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action)
49 throws UnsupportedEncodingException
50 {
51 Map subset = new HashMap();
52 Iterator params = parameters.keySet().iterator();
53while (params.hasNext())
54 {
55 String key = (String)params.next();
56if (key.startsWith(prefix))
57 {
58// only encode params that start with prefix59 subset.put(key, parameters.get(key));
60 }
61 }
62returnsuper.encode(window, subset, mode, state, action);
63 }
6465publicboolean isNavigationalParameterStateFull()
66 {
67returntrue;
68 }
6970publicboolean isRenderParameterStateFull()
71 {
72return false;
73 }
747576 }