1/*2 * Copyright 2000-2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.modules.actions;
1819// Java Core Classes20import java.util.Enumeration;
2122// Jetspeed Modules23import org.apache.jetspeed.util.URILookup;
2425// Turbine Modules26import org.apache.turbine.modules.Action;
27import org.apache.turbine.util.RunData;
2829/***30 * Marks the referer page to enable buttons as "back"31 * 32 * @author <A HREF="shesmer@raleigh.ibm.com">Stephan Hesmer</A>33*/34publicclassMarkRefPageextends Action
35 {
36publicvoid doPerform( RunData data ) throws Exception
37 {
38 Enumeration enum = data.getRequest().getHeaderNames();
39while (enum.hasMoreElements()) {
40 String name = (String)enum.nextElement();
41if ("referer".equalsIgnoreCase(name)) {
42// check name case insensitive, because getHeader checks case-sensitive, 43// though it is defined as case-insensitive in the servlet specification44 String uri = data.getRequest().getHeader(name);
45if (uri!=null) {
46// remove sessionid, if exists47if (uri.indexOf(";jsessionid")!=-1) {
48 uri = uri.substring(0,uri.indexOf(";jsessionid"));
49 }
50// adds sessionid if necessary51 uri = data.getResponse().encodeURL( uri );
52 URILookup.markPage( uri, data);
53 }
54break;
55 }
56 }
57 }
5859 }