root/trunk/src/main/php/net/stubbles/ipo/response/stubResponse.php

Revision 1478, 2.4 kB (checked in by mikey, 1 month ago)

changed param order: version is more likely to be set then sapi
added support reasonPhrase in status codes

Line 
1 <?php
2 /**
3  * interface for a response to a request
4  *
5  * @author      Frank Kleine <mikey@stubbles.net>
6  * @package     stubbles
7  * @subpackage  ipo_response
8  */
9 stubClassLoader::load('net::stubbles::ipo::response::stubCookie');
10 /**
11  * interface for a response to a request
12  *
13  * The response collects all data that should be send to the source
14  * that initiated the request.
15  *
16  * @package     stubbles
17  * @subpackage  ipo_response
18  */
19 interface stubResponse extends stubObject
20 {
21     /**
22      * clears the response
23      */
24     public function clear();
25
26     /**
27      * sets the http version
28      *
29      * The version should be a string like '1.0' or '1.1'.
30      *
31      * @param  string  $version
32      */
33     public function setVersion($version);
34
35     /**
36      * returns the http version
37      *
38      * @return  string
39      */
40     public function getVersion();
41
42     /**
43      * sets the status code to be send
44      *
45      * This needs only to be done if another status code then the default one
46      * should be send.
47      *
48      * @param  int     $statusCode
49      * @param  string  $reasonPhrase  optional
50      */
51     public function setStatusCode($statusCode, $reasonPhrase = null);
52
53     /**
54      * returns status code to be send
55      *
56      * If return value is <null> the default one will be send.
57      *
58      * @return  int
59      */
60     public function getStatusCode();
61
62     /**
63      * add a header to the response
64      *
65      * @param  string  $name   the name of the header
66      * @param  string  $value  the value of the header
67      */
68     public function addHeader($name, $value);
69
70     /**
71      * returns the list of headers
72      *
73      * @return  array<string,string>
74      */
75     public function getHeaders();
76
77     /**
78      * add a cookie to the response
79      *
80      * @param  stubCookie  $cookie  the cookie to set
81      */
82     public function setCookie(stubCookie $cookie);
83
84     /**
85      * returns the list of cookies
86      *
87      * @return  array<string,stubCookie>
88      */
89     public function getCookies();
90
91     /**
92      * write data into the response
93      *
94      * @param  string  $data
95      */
96     public function write($data);
97
98     /**
99      * returns the data written so far
100      *
101      * @return  string
102      */
103     public function getData();
104
105     /**
106      * replaces the data written so far with the new data
107      *
108      * @param  string  $data
109      */
110     public function replaceData($data);
111
112     /**
113      * send the response out
114      */
115     public function send();
116 }
117 ?>
Note: See TracBrowser for help on using the browser.