Class CKRequest
In: lib/cgikit.rb
Parent: CKMessage

CKRequest represents requests of HTTP headers.

CKRequest returns form parameters and cookies. But, in many cases, this class isn't used directly to get parameters because CGIKit sets these parameters to components automatically in the process of instanciating components.

Getting a request object

You can get a request object by CKApplication#request or CKComponent#request.

Parameters

CKRequest has some methods to access parameters.

multiple_params[key]:Returns an array of parameters. If key is missing, returns an empty array.
single_param(key), [key]:This method joins an array of parameters into a string and returns it. If key is missing, returns nil.

Cookies

Cookies is an array which includes some CKCookie objects. See CKCookie section about details of cookie.

cookie(key):Returns a CKCookie object whose key is the same as the argument.
cookies:Returns an array of CKCookie objects.
cookie_value(key):Returns the value of CKCookie object whose key is the the same as the argument.
cookie_values(key):If the argument is nil(by default, argument is nil.), this method returns an array which has all the values of cookies. Otherwise, it returns an array which has the values of cookies specified by the argument.

HTTP Headers

Some of HTTP headers are defined by instance methods. Call CKRequest#headers to get other CGI environment variables.

headers[key]:Returns a value of HTTP header.
accept:HTTP_ACCEPT
accept_charset:HTTP_ACCEPT_CHARSET
accept_language:HTTP_ACCEPT_LANGUAGE
auth_type:AUTH_TYPE
content_length:CONTENT_LENGTH
content_type:CONTENT_TYPE
from:HTTP_FROM
gateway_interface:GATEWAY_INTERFACE
path_info:PATH_INFO
path_translated:PATH_TRANSLATED
query_string:QUERY_STRING
raw_cookie:HTTP_COOKIE
referer:HTTP_REFERER
remote_addr:REMOTE_ADDR
remote_host:HTTP_HOST
remote_ident:REMOTE_IDENT
remote_user:REMOTE_USER
request_method:REQUEST_METHOD
script_name:SCRIPT_NAME
server_name:SERVER_NAME
server_port:SERVER_PORT
server_protocol:SERVER_PROTOCOL
server_software:SERVER_SOFTWARE
uri, url:REQUEST_URI
user_agent:HTTP_USER_AGENT
Methods
accept    accept_charset    accept_language    auth_type    content_length    content_type    cookie    cookie_value    cookie_values    from    gateway_interface    has_key?    keys    new    path_info    path_translated    query_string    raw_cookie    referer    remote_addr    remote_host    remote_ident    remote_user    request_method    script_name    server_name    server_port    server_protocol    server_software    single_param    uri    user_agent   
Attributes
:multiple_params  [RW] 
Public Class methods
new( headers, params )
Public Instance methods
single_param( key )
keys()
has_key?(key)
cookie( key )
cookie_value( key )
cookie_values( key = nil )
accept()
accept_charset()
accept_language()
auth_type()
content_length()
content_type()
from()
gateway_interface()
path_info()
path_translated()
query_string()
raw_cookie()
referer()
remote_addr()
remote_host()
remote_ident()
remote_user()
request_method()
script_name()
server_name()
server_port()
server_protocol()
server_software()
uri()
user_agent()