01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * 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 and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.portal.event.aspect.impl;
18:
19: import org.apache.avalon.framework.logger.AbstractLogEnabled;
20: import org.apache.avalon.framework.thread.ThreadSafe;
21: import org.apache.cocoon.environment.ObjectModelHelper;
22: import org.apache.cocoon.environment.Response;
23: import org.apache.cocoon.portal.PortalService;
24: import org.apache.cocoon.portal.event.aspect.EventAspect;
25: import org.apache.cocoon.portal.event.aspect.EventAspectContext;
26:
27: /**
28: * This aspect implementation sets some headers on the response that tell
29: * clients/proxies to not cache. This "disables" the back button on the
30: * client.
31: *
32: * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
33: *
34: * @version CVS $Id: NoClientCachingEventAspect.java 433543 2006-08-22 06:22:54Z crossley $
35: */
36: public class NoClientCachingEventAspect extends AbstractLogEnabled
37: implements EventAspect, ThreadSafe {
38:
39: /**
40: * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext, org.apache.cocoon.portal.PortalService)
41: */
42: public void process(EventAspectContext context,
43: PortalService service) {
44:
45: final Response response = ObjectModelHelper.getResponse(context
46: .getObjectModel());
47: response.setHeader("Cache-Control", "no-cache");
48: response.addHeader("Cache-Control", "no-store");
49: response.setHeader("Pragma", "no-cache");
50: response.setHeader("Expires", "Thu, 01 Jan 2000 00:00:00 GMT");
51:
52: context.invokeNext(service);
53: }
54: }
|