source: branches/camp/camp-2_5-E/data/class/SC_Response.php @ 19114

Revision 19114, 2.8 KB checked in by miningbrownie, 12 years ago (diff)
Line 
1<?php
2class SC_Response{
3
4    /**
5     *
6     * @var HTTP_Response
7     */
8    var $http;
9    /**
10     * コンテンツタイプ
11     * Enter description here ...
12     * @var unknown_type
13     */
14    var $contentType;
15    var $header;
16    var $body;
17    var $statuscode;
18    var $header = array();
19
20    var $statusTexts = array(
21    '100' => 'Continue',
22    '101' => 'Switching Protocols',
23    '200' => 'OK',
24    '201' => 'Created',
25    '202' => 'Accepted',
26    '203' => 'Non-Authoritative Information',
27    '204' => 'No Content',
28    '205' => 'Reset Content',
29    '206' => 'Partial Content',
30    '300' => 'Multiple Choices',
31    '301' => 'Moved Permanently',
32    '302' => 'Found',
33    '303' => 'See Other',
34    '304' => 'Not Modified',
35    '305' => 'Use Proxy',
36    '306' => '(Unused)',
37    '307' => 'Temporary Redirect',
38    '400' => 'Bad Request',
39    '401' => 'Unauthorized',
40    '402' => 'Payment Required',
41    '403' => 'Forbidden',
42    '404' => 'Not Found',
43    '405' => 'Method Not Allowed',
44    '406' => 'Not Acceptable',
45    '407' => 'Proxy Authentication Required',
46    '408' => 'Request Timeout',
47    '409' => 'Conflict',
48    '410' => 'Gone',
49    '411' => 'Length Required',
50    '412' => 'Precondition Failed',
51    '413' => 'Request Entity Too Large',
52    '414' => 'Request-URI Too Long',
53    '415' => 'Unsupported Media Type',
54    '416' => 'Requested Range Not Satisfiable',
55    '417' => 'Expectation Failed',
56    '500' => 'Internal Server Error',
57    '501' => 'Not Implemented',
58    '502' => 'Bad Gateway',
59    '503' => 'Service Unavailable',
60    '504' => 'Gateway Timeout',
61    '505' => 'HTTP Version Not Supported',
62    );
63
64
65    /**
66     *
67     * Enter description here ...
68     */
69    var $encoding;
70
71    function SC_Response(){
72        $this->http = new HTTP_Response();
73    }
74
75    function response(){
76
77    }
78
79    function sendHeader(){
80        // HTTPのヘッダ
81        header('HTTP/1.1 '.$this->statuscode.' '.$this->statusTexts[$this->statuscode]);
82        foreach ($this->header as $name => $head){
83          header(''$head);
84        }
85    }
86
87
88    function setContentLength(int $length){
89
90    }
91
92
93    function setContentType(String $contentType){
94        $this->header['Content-Type'] = $contentType;
95    }
96
97    function setResponseCode(int $code){
98
99    }
100
101    function setResposeBody(String $body){
102
103    }
104
105    function addDateHdeader(String $name, $date){
106
107    }
108    function addHeader(String $name, $value){
109        $this->header[$name] = $value;
110    }
111
112    function containsHeader(String $name){
113        return isset($this->header[$name]);
114    }
115
116    function sendError(int $errorcode){
117
118    }
119
120    function sendRedirect(String $location){
121
122    }
123
124    function setHeader(Array $headers){
125        $this->header = $headers;
126    }
127
128    function setStatus(int $sc = 202){
129        $this->statuscode = $sc;
130    }
131
132}
Note: See TracBrowser for help on using the repository browser.