3 * An interface for responses
5 * @author Roland Haeder <webmaster@ship-simu.org>
7 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
8 * @license GNU GPL 3.0 or any newer version
9 * @link http://www.ship-simu.org
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 interface Responseable extends FrameworkInterface {
28 * @param $status New response status
31 function setResponseStatus ($status);
36 * @param $name Name of header element
37 * @param $value Value of header element
40 function addHeader ($name, $value);
43 * "Writes" data to the response body
45 * @param $output Output we shall sent in the HTTP response
48 function writeToBody ($output);
51 * Flushs the cached HTTP response to the outer world
53 * @param $force Wether we shall force the output or abort if headers are
54 * already sent with an exception
56 * @throws ResponseHeadersAlreadySentException Thrown if headers are
59 function flushBuffer ($force = false);
62 * Adds a fatal message id to the response. The added messages can then be
63 * processed and outputed to the world
65 * @param $messageId The message id we shall add
68 function addFatalMessage ($messageId);
71 * Adds a cookie to the response
73 * @param $cookieName Cookie's name
74 * @param $cookieValue Value to store in the cookie
75 * @param $encrypted Do some extra encryption on the value
77 * @throws ResponseHeadersAlreadySentException If headers are already sent
79 function addCookie ($cookieName, $cookieValue, $encrypted = false);
82 * Redirect to a configured URL. The URL can be absolute or relative. In
83 * case of relative URL it will be extended automatically.
85 * @param $configEntry The configuration entry which holds our URL
87 * @throws ResponseHeadersAlreadySentException If headers are already sent
89 function redirectToConfiguredUrl ($configEntry);
92 * Expires the given cookie if it is set
94 * @param $cookieName Cookie to expire
97 function expireCookie ($cookieName);
100 * Refreshs a given cookie. This will make the cookie live longer
102 * @param $cookieName Cookie to refresh
105 function refreshCookie ($cookieName);