1 /*
2 * Copyright (c) 2005-2007 Creative Sphere Limited.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *
10 * Creative Sphere - initial API and implementation
11 *
12 */
13 package org.abstracthorizon.danube.http;
14
15 import org.abstracthorizon.danube.connection.Connection;
16 import org.abstracthorizon.danube.mvc.MVCConnectionHandler;
17
18 import java.io.IOException;
19
20 /**
21 * This class represents MVC controller for HTTP. It just adds
22 * no caching headers to http response.
23 *
24 * @author Daniel Sendula
25 */
26 public class HTTPMVCConnectionHandler extends MVCConnectionHandler {
27
28 /** Constructor */
29 public HTTPMVCConnectionHandler() {
30 }
31
32 /**
33 * This method just adds no caching headers to response
34 * @param connection connection
35 * @throws IOException if thrown by super {@link #handleConnection(Connection)}
36 */
37 public void handleConnection(Connection connection) {
38 HTTPConnection httpConnection = (HTTPConnection)connection.adapt(HTTPConnection.class);
39 httpConnection.getResponseHeaders().putOnly("Pragma", "No-cache");
40 httpConnection.getResponseHeaders().putOnly("Cache-Control", "no-cache");
41 httpConnection.getResponseHeaders().putOnly("Cache-Control", "no-store");
42 super.handleConnection(httpConnection);
43 }
44
45 }