找回密码
 注册
查看: 557|回复: 0

R语言 Rook包 Rook-package()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 22:58:26 | 显示全部楼层 |阅读模式
Rook-package(Rook)
Rook-package()所属R语言包:Rook

                                         Rook: A web server interface and package for R
                                         鲁克:Web服务器的接口和封装为R

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

This help page defines the Rook specification. It borrows heavily from Ruby's Rack project: http://rack.rubyforge.org/.
本帮助页面定义乌鸦规范的。它借用了大量从Ruby的机架项目“:”http://rack.rubyforge.org/“。

After reading this document, read the Rhttpd help file as it will get you familiar with installing and running Rook applications. Then explore the example applications located in:
在阅读本文后,请阅读Rhttpd帮助文件,因为它会帮助您熟悉Rook应用程序的安装和运行。接着探讨在位于示例应用程序:

system.file('exampleApps',package='Rook').
system.file('exampleApps',package='Rook')。


鲁克的应用----------Rook applications----------

A Rook application is an R reference class object that implements a 'call' method or an R closure that takes exactly one argument, an environment, and returns a list with three named elements: 'status', 'headers', and 'body'.
一车的应用程序是一个的的R参考类对象,它实现叫的方法或R关闭,只有一个参数,环境三个命名的元素,并返回一个列表:'status','headers'和'body'。


你好世界----------Hello World----------

Here is a basic Rook application as a closure that implements 'hello world':
这是一个基本的鲁克的闭包实现的“Hello World”应用程序:


环境----------The Environment----------

The environment argument is a true R environment object which the application is free to modify. It is required to contain the following variables:
环境参数是一个真正的R环境中的对象,应用程序是免费修改。它需要包含以下变量:




REQUEST_METHOD  The HTTP request method, such as "GET" or "POST". This
REQUEST_METHOD HTTP请求方法,如“GET”或“POST”。这




SCRIPT_NAME  The initial portion of the request URL's "path" that corresponds to the application object, so that the application knows its virtual "location". This may be an empty string, if the application
SCRIPT_NAME的起始部分请求的URL的“路径”对应的应用程序对象,使应用程序知道它的虚拟的“位置”。这可能是一个空字符串,如果应用程序




PATH_INFO  The remainder of the request URL's "path", designating the virtual "location" of the request's target within the application. This may be an empty string, if the request URL targets the application root and does not have a trailing slash. This value may be percent-encoded
PATH_INFO的请求URL的“路径”,指定请求的目标应用程序内的虚拟的“位置”的其余部分。这可能是一个空字符串,如果请求的URL的目标应用程序的根,没有一个斜线。这个值可以百分比编码




QUERY_STRING  The portion of the request URL that follows the ?,
QUERY_STRING的部分请求的URL后面的?




SERVER_NAME, SERVER_PORT  When combined with SCRIPT_NAME and PATH_INFO, these variables can be used to complete the URL. Note however that HTTP_HOST, if present, should be used in preference to SERVER_NAME for reconstructing the request URL. SERVER_NAME and SERVER_PORT can never
SERVER_NAME,SERVER_PORT SCRIPT_NAME和PATH_INFO结合时,这些变量可以被用来完成URL。但是请注意,HTTP_HOST,如果存在的话,应优先使用SERVER_NAME用于重构的请求URL。绝对不能SERVER_NAME和SERVER_PORT




HTTP_ Variables  Variables corresponding to the client-supplied HTTP request headers (i.e., variables whose names begin with HTTP_). The presence or absence of these variables should correspond with the presence
HTTP_变量对应的客户端提供的HTTP请求报头(即,变量,其名称与HTTP_开始)。这些变量的存在或不存在应与存在

In addition, the environment must include the following Rook-specific variables:
此外,环境必须包括以下与鲁克特定的变量:




rook.version  This version of Rook.
rook.version这个版本的乌鸦。




rook.url_scheme 'http' or 'https', depending on the request URL.
rook.url_scheme的http“或”https“后,根据请求的URL。




rook.input See “The Input Stream” section.
rook.input请参阅“输入流”一节。




rook.errors See “The Error Stream” section.
rook.errors请参阅“错误流”一节。


在输入流----------The Input Stream----------

The rook.input variable must contain an object created from a reference class that implements read_lines(), read(), and rewind():
rook.input变量必须包含引用类中创建的对象,实现read_lines(),read(),rewind():




read_lines(l=-1L): takes one argument, the number of lines to read. Includes partial ending line.
read_lines(l=-1L):有一个参数,读取的行数。包括部分结束行。




read(l=-1L): takes one argument, the number of bytes to read. Returns a raw vector.
read(l=-1L):需要一个参数,即要读取的字节数。返回一个原始向量。




rewind(): Rewinds the input stream back to the beginning.
rewind():倒带,回到开头的输入流。


错误流----------The Error Stream----------

The rook.error variable must contain an object created from a reference class that implements flush() and cat():
rook.error变量必须包含一个对象创建一个引用类,实现flush()和cat():




flush(): called with no arguments and makes the error stream immediately appear.
flush():不带参数调用,并立即出现错误流。




cat(...,sep=" ",fill=FALSE,labels=NULL): called with the same arguments as R's "cat" without the file and append argument.
cat(...,sep=" ",fill=FALSE,labels=NULL):要求使用相同的参数R的"cat"不file追加argument。


响应----------The Response----------

Rook applications return a list with three named elements: 'status', 'headers', and 'body'.
鲁克应用程序返回一个列表命名的元素有三个:'status','headers'和'body'。

An HTTP status value as integer and must be greater than or equal to 100.
作为整数的HTTP状态值,并且必须是大于或等于100。

A named list that contains only character values corresponding to valid HTTP headers.
命名列表,其中只包含字符值对应于有效的HTTP标头。

Either a character or raw vector. If the character vector is named with value 'file' then value of the vector is interpreted as the location of a file.
一个字符或原始向量。如果特征向量的名为与值'file'矢量值被解释为一个文件的位置。


(作者)----------Author(s)----------


Jeffrey Horner <jeffrey.horner@gmail.com>

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-25 15:21 , Processed in 0.019152 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表