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

Revision 19115, 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($name.': '.$head);
84        }
85       
86    }
87
88
89    function setContentLength(int $length){
90
91    }
92
93
94    function setContentType(String $contentType){
95        $this->header['Content-Type'] = $contentType;
96    }
97
98    function setResponseCode(int $code){
99
100    }
101
102    function setResposeBody(String $body){
103
104    }
105
106    function addDateHdeader(String $name, $date){
107
108    }
109    function addHeader(String $name, $value){
110        $this->header[$name] = $value;
111    }
112
113    function containsHeader(String $name){
114        return isset($this->header[$name]);
115    }
116
117    function sendError(int $errorcode){
118
119    }
120
121    function sendRedirect(String $location){
122
123    }
124
125    function setHeader(Array $headers){
126        $this->header = $headers;
127    }
128
129    function setStatus(int $sc = 202){
130        $this->statuscode = $sc;
131    }
132
133}
Note: See TracBrowser for help on using the repository browser.