annotate xml/ru/docs/http/ngx_http_js_module.xml @ 2693:3cbd6e440581

Documented the js_var directive.
author Yaroslav Zhuravlev <yar@nginx.com>
date Mon, 29 Mar 2021 19:40:27 +0100
parents 45214e5316cd
children 42fb92e582db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
1 <?xml version="1.0"?>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
2
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
3 <!--
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
4 Copyright (C) Nginx, Inc.
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
5 -->
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
6
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
8
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
9 <module name="Модуль ngx_http_js_module"
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
10 link="/ru/docs/http/ngx_http_js_module.html"
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
11 lang="ru"
2693
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
12 rev="28">
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
13
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
14 <section id="summary">
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
15
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
16 <para>
1844
f56626ce9c40 Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1843
diff changeset
17 Модуль <literal>ngx_http_js_module</literal> позволяет задавать
f56626ce9c40 Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1843
diff changeset
18 обработчики location и переменных
2245
87a0e2c73a25 Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2244
diff changeset
19 на <link doc="../njs/index.xml">njs</link> —
1844
f56626ce9c40 Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1843
diff changeset
20 подмножестве языка JavaScript.
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
21 </para>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
22
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
23 <para>
2188
523dc4cc8745 Updated installation procedure in njs modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2187
diff changeset
24 Инструкция по сборке и установке доступны
2245
87a0e2c73a25 Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2244
diff changeset
25 <link doc="../njs/install.xml">здесь</link>.
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
26 </para>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
27
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
28 </section>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
29
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
30
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
31 <section id="example" name="Пример конфигурации">
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
32
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
33 <para>
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
34 Пример работает начиная с версии
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
35 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>.
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
36 <example>
2190
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
37 http {
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
38 js_import http.js;
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
39
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
40 js_set $foo http.foo;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
41 js_set $summary http.summary;
1858
36cbfff92c6d Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1853
diff changeset
42
2190
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
43 server {
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
44 listen 8000;
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
45
2190
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
46 location / {
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
47 add_header X-Foo $foo;
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
48 js_content http.baz;
2190
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
49 }
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
50
2206
5cacd6fffade Eliminated some examples of unsafe prefix locations.
Ruslan Ermilov <ru@nginx.com>
parents: 2190
diff changeset
51 location = /summary {
2190
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
52 return 200 $summary;
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
53 }
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
54
2206
5cacd6fffade Eliminated some examples of unsafe prefix locations.
Ruslan Ermilov <ru@nginx.com>
parents: 2190
diff changeset
55 location = /hello {
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
56 js_content http.hello;
2190
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
57 }
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
58 }
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
59 }
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
60 </example>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
61 </para>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
62
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
63 <para>
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
64 The <path>http.js</path> file:
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
65 <example>
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
66 function foo(r) {
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
67 r.log("hello from foo() handler");
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
68 return "foo";
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
69 }
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
70
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
71 function summary(r) {
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
72 var a, s, h;
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
73
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
74 s = "JS summary\n\n";
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
75
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
76 s += "Method: " + r.method + "\n";
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
77 s += "HTTP version: " + r.httpVersion + "\n";
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
78 s += "Host: " + r.headersIn.host + "\n";
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
79 s += "Remote Address: " + r.remoteAddress + "\n";
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
80 s += "URI: " + r.uri + "\n";
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
81
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
82 s += "Headers:\n";
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
83 for (h in r.headersIn) {
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
84 s += " header '" + h + "' is '" + r.headersIn[h] + "'\n";
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
85 }
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
86
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
87 s += "Args:\n";
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
88 for (a in r.args) {
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
89 s += " arg '" + a + "' is '" + r.args[a] + "'\n";
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
90 }
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
91
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
92 return s;
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
93 }
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
94
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
95 function baz(r) {
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
96 r.status = 200;
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
97 r.headersOut.foo = 1234;
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
98 r.headersOut['Content-Type'] = "text/plain; charset=utf-8";
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
99 r.headersOut['Content-Length'] = 15;
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
100 r.sendHeader();
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
101 r.send("nginx");
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
102 r.send("java");
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
103 r.send("script");
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
104
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
105 r.finish();
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
106 }
2190
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
107
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
108 function hello(r) {
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
109 r.return(200, "Hello world!");
dfc49994218c Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2188
diff changeset
110 }
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
111
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
112 export default {foo, summary, baz, hello};
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
113 </example>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
114 </para>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
115
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
116 </section>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
117
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
118
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
119 <section id="directives" name="Директивы">
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
120
2664
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
121 <directive name="js_body_filter">
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
122 <syntax><value>функция</value> | <value>модуль.функция</value>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
123 [<value>buffer_type</value>=<value>строка</value> | <value>буфер</value>]</syntax>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
124 <default/>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
125 <context>location</context>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
126 <context>limit_except</context>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
127 <appeared-in>0.5.2</appeared-in>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
128
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
129 <para>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
130 Задаёт функцию njs в качестве фильтра тела ответа.
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
131 Функция фильтра вызывается для каждого блока данных тела ответа
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
132 со следующими аргументами:
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
133
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
134 <list type="tag">
2675
893cd7724c8c Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2664
diff changeset
135 <tag-name><literal>r</literal></tag-name>
893cd7724c8c Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2664
diff changeset
136 <tag-desc>
893cd7724c8c Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2664
diff changeset
137 объект <link doc="../njs/reference.xml" id="http">HTTP request</link>
893cd7724c8c Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2664
diff changeset
138 </tag-desc>
893cd7724c8c Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2664
diff changeset
139
2664
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
140 <tag-name><literal>data</literal></tag-name>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
141 <tag-desc>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
142 входящий блок данных
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
143 может быть строкой или буфером
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
144 в зависимости от значения <literal>buffer_type</literal>,
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
145 по умолчанию является строкой.
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
146 </tag-desc>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
147
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
148 <tag-name><literal>flags</literal></tag-name>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
149 <tag-desc>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
150 объект со следующими свойствами:
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
151 <list type="tag">
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
152 <tag-name><literal>last</literal></tag-name>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
153 <tag-desc>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
154 логическое значение, true, если данные являются последним буфером.
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
155 </tag-desc>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
156
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
157 </list>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
158 </tag-desc>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
159
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
160 </list>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
161 </para>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
162
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
163 <para>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
164 Функция фильтра может передавать свою модифицированную версию
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
165 входящего блока данных следующему фильтру тела ответа при помощи вызова
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
166 <link doc="../njs/reference.xml" id="r_sendbuffer"><literal>r.sendBuffer()</literal></link>.
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
167 Пример преобразования букв в нижний регистр в теле ответа:
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
168 <example>
2675
893cd7724c8c Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2664
diff changeset
169 function filter(r, data, flags) {
2664
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
170 r.sendBuffer(data.toLowerCase(), flags);
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
171 }
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
172 </example>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
173 Для отмены фильтра (блоки данных будут передаваться клиенту
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
174 без вызова <literal>js_body_filter</literal>),
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
175 можно использовать
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
176 <link doc="../njs/reference.xml" id="r_done"><literal>r.done()</literal></link>.
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
177 </para>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
178
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
179 <para>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
180 Если функция фильтра изменяет длину тела ответа, то
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
181 необходимо очистить заголовок ответа <header>Content-Length</header>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
182 (если присутствует) в
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
183 <link id="js_header_filter"><literal>js_header_filter</literal></link>,
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
184 чтобы применить поблочное кодирование.
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
185 </para>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
186
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
187 </directive>
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
188
9e39e64bff84 Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2651
diff changeset
189
2142
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
190 <directive name="js_content">
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
191 <syntax><value>функция</value> | <value>модуль.функция</value></syntax>
2142
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
192 <default/>
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
193 <context>location</context>
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
194 <context>limit_except</context>
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
195
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
196 <para>
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
197 Задаёт функцию njs в качестве обработчика содержимого location.
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
198 Начиная с версии <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
199 можно ссылаться на функцию модуля.
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
200 </para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
201
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
202 </directive>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
203
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
204
2651
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
205 <directive name="js_header_filter">
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
206 <syntax><value>функция</value> | <value>модуль.функция</value></syntax>
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
207 <default/>
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
208 <context>location</context>
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
209 <context>limit_except</context>
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
210 <appeared-in>0.5.1</appeared-in>
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
211
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
212 <para>
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
213 Задаёт функцию njs в качестве фильтра заголовка ответа.
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
214 Директива позволяет менять произвольные поля заголовка ответа.
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
215 </para>
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
216
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
217 </directive>
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
218
b4991bbd64ee Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
219
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
220 <directive name="js_import">
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
221 <syntax><value>модуль.js</value> |
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
222 <value>имя_экспорта из модуль.js</value></syntax>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
223 <default/>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
224 <context>http</context>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
225 <appeared-in>0.4.0</appeared-in>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
226
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
227 <para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
228 Импортирует модуль, позволяющий задавать обработчики location и переменных
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
229 на njs.
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
230 <literal>Имя_экспорта</literal> является пространством имён
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
231 при доступе к функциям модуля.
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
232 Если <literal>имя_экспорта</literal> не задано,
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
233 то пространством имён будет являться имя модуля.
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
234 <example>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
235 js_import http.js;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
236 </example>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
237 В примере при доступе к экспорту в качестве
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
238 пространства имён используется имя модуля <literal>http</literal>.
2680
8751cab1d562 Corrected example description in js_import.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2675
diff changeset
239 Если импортируемый модуль экспортирует <literal>foo()</literal>,
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
240 то для доступа используется <literal>http.foo</literal>.
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
241 </para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
242
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
243 <para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
244 Директив <literal>js_import</literal> может быть несколько.
2142
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
245 </para>
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
246
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
247 </directive>
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
248
ca7568f67dee Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents: 2135
diff changeset
249
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
250 <directive name="js_include">
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
251 <syntax><value>файл</value></syntax>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
252 <default/>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
253 <context>http</context>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
254
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
255 <para>
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
256 Задаёт файл, позволяющий задавать обработчики location и переменных на njs:
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
257 <example>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
258 nginx.conf:
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
259 js_include http.js;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
260 location /version {
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
261 js_content version;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
262 }
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
263
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
264 http.js:
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
265 function version(r) {
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
266 r.return(200, njs.version);
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
267 }
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
268 </example>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
269 </para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
270
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
271 <para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
272 Директива устарела начиная с
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
273 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>,
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
274 вместо неё следует использовать директиву <link id="js_import"/>.
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
275 </para>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
276
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
277 </directive>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
278
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
279
2352
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
280 <directive name="js_path">
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
281 <syntax>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
282 <value>путь</value></syntax>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
283 <default/>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
284 <context>http</context>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
285 <appeared-in>0.3.0</appeared-in>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
286
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
287 <para>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
288 Задаёт дополнительный путь для модулей njs.
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
289 </para>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
290
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
291 </directive>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
292
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2288
diff changeset
293
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
294 <directive name="js_set">
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
295 <syntax>
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
296 <value>$переменная</value> <value>функция</value> |
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
297 <value>модуль.функция</value></syntax>
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
298 <default/>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
299 <context>http</context>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
300
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
301 <para>
2686
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
302 Задаёт <literal>функцию</literal> njs
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
303 для указанной <literal>переменной</literal>.
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
304 Начиная с <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
305 можно ссылаться на функцию модуля.
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
306 </para>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
307
2686
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
308 <para>
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
309 Функция вызывается в момент
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
310 первого обращения к переменной для данного запроса.
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
311 Точный момент вызова функции зависит от
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
312 <link doc="../dev/development_guide.xml" id="http_phases">фазы</link>,
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
313 в которой происходит обращение к переменной.
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
314 Это можно использовать для реализации дополнительной логики,
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
315 не относящейся к вычислению переменной.
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
316 Например, если переменная указана
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
317 в директиве <link doc="ngx_http_log_module.xml" id="log_format"/>,
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
318 то её обработчик не будет выполняться до фазы записи в лог.
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
319 Этот обработчик также может использоваться для выполнения процедур
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
320 непосредственно перед освобождением запроса.
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
321 </para>
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
322
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
323 </directive>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
324
2693
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
325
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
326 <directive name="js_var">
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
327 <syntax><value>$переменная</value> [<value>значение</value>]</syntax>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
328 <default/>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
329 <context>http</context>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
330 <appeared-in>0.5.3</appeared-in>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
331
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
332 <para>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
333 Объявляет
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
334 <link doc="../njs/reference.xml" id="r_variables">перезаписываемую</link>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
335 переменную.
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
336 В качестве значения можно использовать текст, переменные и их комбинации.
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
337 Переменная не перезаписывается после перенаправления,
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
338 в отличие от переменных, созданных при помощи
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
339 директивы <link doc="ngx_http_rewrite_module.xml" id="set"/>.
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
340 </para>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
341
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
342 </directive>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
343
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
344 </section>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
345
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
346
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
347 <section id="arguments" name="Аргумент запроса">
2149
6df1a86a60b8 Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents: 2142
diff changeset
348
6df1a86a60b8 Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents: 2142
diff changeset
349 <para>
2187
ed905ab118c7 Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2175
diff changeset
350 Каждый HTTP-обработчик njs получает один аргумент,
2288
786e96c52c7a Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2246
diff changeset
351 <link doc="../njs/reference.xml" id="http">объект</link> запроса.
1843
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
352 </para>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
353
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
354 </section>
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
355
3492eb9b8138 Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
356 </module>