爱慕股份冲刺IPO A股将迎来第二家“内衣股” |[新浪彩票]余年双色球第20046期:红球连码29 30 |[新浪彩票]李白石排列三第20132期:双胆参考5 9 |云南贡山暴雨致2人死亡6人失踪,搜救还在进行中 |小林光一《我的履历书》 婚事遭反对终迎来大反转 |反虐猫志愿者遭人肉被寄祭祀品 曾曝范源庆虐猫事件 |北京恢复尾号限行首日:上调公交、地铁满载率至100% |中盐集团原董事长茆庆国受审 被控受贿7200余万元 |阿迪达斯、福特加入抵制Facebook广告行列 |江西赣州市原副市长何福洲履新市委常委、宣传部部长 |
<-
Apache > HTTP Server > Documentation > Version 2.4

Apache's Handler Use

Available Languages:  en  |  es  |  fr  |  ja  |  ko  |  tr  |  zh-cn 

This document describes the use of Apache's Handlers.

top

What is a Handler

A "handler" is an internal Apache representation of the action to be performed when a file is called. Generally, files have implicit handlers, based on the file type. Normally, all files are simply served by the server, but certain file types are "handled" separately.

Handlers may also be configured explicitly, based on either filename extensions or on location, without relation to file type. This is advantageous both because it is a more elegant solution, and because it also allows for both a type and a handler to be associated with a file. (See also Files with Multiple Extensions.)

Handlers can either be built into the server or included in a module, or they can be added with the Action directive. The built-in handlers in the standard distribution are as follows:

top

Examples

Modifying static content using a CGI script

The following directives will cause requests for files with the html extension to trigger the launch of the footer.pl CGI script.

Action add-footer /cgi-bin/footer.pl
AddHandler add-footer .html

Then the CGI script is responsible for sending the originally requested document (pointed to by the PATH_TRANSLATED environment variable) and making whatever modifications or additions are desired.

Files with HTTP headers

The following directives will enable the send-as-is handler, which is used for files which contain their own HTTP headers. All files in the /web/htdocs/asis/ directory will be processed by the send-as-is handler, regardless of their filename extensions.

<Directory "/web/htdocs/asis">
    SetHandler send-as-is
</Directory>
top

Programmer's Note

In order to implement the handler features, an addition has been made to the Apache API that you may wish to make use of. Specifically, a new record has been added to the request_rec structure:

char *handler

If you wish to have your module engage a handler, you need only to set r->handler to the name of the handler at any time prior to the invoke_handler stage of the request. Handlers are implemented as they were before, albeit using the handler name instead of a content type. While it is not necessary, the naming convention for handlers is to use a dash-separated word, with no slashes, so as to not invade the media type name-space.

Available Languages:  en  |  es  |  fr  |  ja  |  ko  |  tr  |  zh-cn 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.

送分电玩

mqczsd9.i0292.cn| mqczsd9.h9977.cn| mqczsd9.qxbucv.cn| mqczsd9.zhaozipeng.cn| mqczsd9.i1506.cn| nqczsd9.tengchong-xsy.cn|