Skip to content

Commit bb0cf4b

Browse files
committed
update doc for v0.5.0
1 parent 59d996d commit bb0cf4b

26 files changed

+2022
-1795
lines changed

Configuration.md

+54
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,60 @@ location /hello {
763763
{:body upper-body})))
764764
```
765765

766+
2.9 Nginx Log Handler
767+
-----------------
768+
769+
Nginx log handler will be called just before the request is destroyed and its return result will be ignored.
770+
In a log handler we should not modify any thing about this request such as header, status. response, body and so on.
771+
772+
* **Java**
773+
774+
e.g.
775+
776+
```nginx
777+
location /hello {
778+
....
779+
log_handler_type java;
780+
log_handler_name mytest.MyLogHandler;
781+
log_handler_property format 'yyyyMMdd HH:mm:ss';
782+
}
783+
784+
```
785+
786+
```java
787+
public class MyLogHandler implements NginxJavaRingHandler, Configurable {
788+
String format;
789+
@Override
790+
public Object[] invoke(Map<String, Object> request) throws IOException {
791+
File file = new File("logs/SimpleLogHandler.log");
792+
try (FileOutputStream out = new FileOutputStream(file, true)) {
793+
out.write((new SimpleDateFormat(format).format(new Date()) + ":" + request.get(Constants.URI) + "\n")
794+
.getBytes("utf8"));
795+
}
796+
return null;
797+
}
798+
799+
@Override
800+
public void config(Map<String, String> properties) {
801+
format = properties.get("format");
802+
}
803+
}
804+
```
805+
806+
* **Clojure**
807+
808+
```nginx
809+
location /hello {
810+
log_handler_type clojure;
811+
log_handler_name mytest/simple-log-handler;
812+
}
813+
814+
```
815+
816+
```clojure
817+
(defn simple-log-handler [request]
818+
(spit "logs/SimpleLogHandler.log" (str (Date.) ":" (:uri request) "\n") :append true ))
819+
```
766820

767821
[nginx-clojure broadcast API]: https://github.com/nginx-clojure/nginx-clojure/issues/38
768822
[Shared Map]: https://nginx-clojure.github.io/sharedmap.html

Configuration.md.html

+279-367
Large diffs are not rendered by default.

CoreFeatures.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
Core Features
22
=================
33

4-
The latest release is v0.4.5, more detail changes about it can be found from [Release History](//nginx-clojure.github.io/downloads.html).
4+
The latest release is v0.5.0, more detail changes about it can be found from [Release History](//nginx-clojure.github.io/downloads.html).
55

66
1. Compatible with [Ring](https://github.com/ring-clojure/ring/blob/master/SPEC) and obviously supports those Ring based frameworks, such as Compojure etc.
77
1. Http Services by using Clojure / Java / Groovy to write simple handlers for http services.
88
1. Nginx Access Handler by Clojure / Java / Groovy
99
1. Nginx Header Filter by Clojure / Java / Groovy
10-
1. **_NEW_**: Nginx Body Filter by Clojure / Java / Groovy
10+
1. Nginx Body Filter by Clojure / Java / Groovy
11+
1. **_NEW_**: Nginx Log Handler by Clojure / Java / Groovy
12+
1. **_NEW_**: HTTP V2 support in both standard edition and embedded edition which are compiled against Nginx 1.14.2
13+
1. **_NEW_**: Support Java 9, 10, 11, 12
1114
1. Pub/Sub Among Nginx Worker Processes
1215
1. Shared Map based on shared memory & Shared Map based Ring session store
1316
1. Support Sente, see [this PR](https://github.com/ptaoussanis/sente/pull/160)
@@ -24,13 +27,14 @@ With this feature one java main thread can handle thousands of connections.
2427
1. Long Polling & Server Sent Events
2528
1. Run initialization clojure code when nginx worker starting
2629
1. Support user defined http request method
27-
1. Compatible with the Nginx lastest stable version 1.12.0. (Nginx 1.8.x, Nginx 1.6.x, 1.4.x is also ok, older version is not tested and maybe works.)
30+
1. Compatible with the Nginx lastest most stable version 1.14.2. (Nginx 1.12.x, 1.8.x, 1.6.x, 1.4.x is also ok, older version is not tested and maybe works.)
2831
1. One of benifits of [Nginx](http://nginx.org/) is worker processes are automatically restarted by a master process if they crash
2932
1. Utilizes lazy headers and direct memory operation between [Nginx](http://nginx.org/) and JVM to fast handle dynamic contents from Clojure or Java code.
3033
1. Utilizes [Nginx](http://nginx.org/) zero copy file sending mechanism to fast handle static contents controlled by Clojure or Java code.
3134
1. Supports Linux x64, Linux x86 32bit, Win32, Win64 and Mac OS X. Freebsd version can also be got from Freebsd ports.
3235

3336
By the way it is very fast, the benchmarks can be found [HERE(with wrk2)](https://github.com/ptaoussanis/clojure-web-server-benchmarks/).
37+
3438
Jar Repository
3539
================
3640

@@ -43,19 +47,19 @@ Nginx-Clojure has already been published to https://clojars.org/ whose maven rep
4347
</repository>
4448
```
4549

46-
After adding clojars repository, you can reference nginx-clojure 0.4.5 , e.g.
50+
After adding clojars repository, you can reference nginx-clojure 0.5.0 , e.g.
4751

4852
Leiningen (clojure, no need to add clojars repository which is a default repository for Leiningen)
4953
-----------------
5054

5155
```clojure
52-
[nginx-clojure "0.4.5"]
56+
[nginx-clojure "0.5.0"]
5357
```
5458
Gradle (groovy/java)
5559
-----------------
5660

5761
```
58-
compile "nginx-clojure:nginx-clojure:0.4.5"
62+
compile "nginx-clojure:nginx-clojure:0.5.0"
5963
```
6064
Maven
6165
-----------------
@@ -64,7 +68,7 @@ Maven
6468
<dependency>
6569
<groupId>nginx-clojure</groupId>
6670
<artifactId>nginx-clojure</artifactId>
67-
<version>0.4.5</version>
71+
<version>0.5.0</version>
6872
</dependency>
6973
```
7074

@@ -76,7 +80,7 @@ More Documents can be found from its web site [nginx-clojure.github.io](http://n
7680

7781
License
7882
=================
79-
Copyright © 2013-2017 Zhang, Yuexiang (xfeep) and released under the BSD 3-Clause license.
83+
Copyright © 2013-2019 Zhang, Yuexiang (xfeep) and released under the BSD 3-Clause license.
8084

8185
This program uses:
8286
* Re-rooted ASM bytecode engineering library which is distributed under the BSD 3-Clause license

CoreFeatures.md.html

+20-15
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
<h1>
22
<a id="user-content-core-features" class="anchor" href="#core-features" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Core Features</h1>
3-
<p>The latest release is v0.4.5, more detail changes about it can be found from <a href="//nginx-clojure.github.io/downloads.html">Release History</a>.</p>
3+
<p>The latest release is v0.5.0, more detail changes about it can be found from <a href="//nginx-clojure.github.io/downloads.html" rel="nofollow">Release History</a>.</p>
44
<ol>
55
<li>Compatible with <a href="https://github.com/ring-clojure/ring/blob/master/SPEC">Ring</a> and obviously supports those Ring based frameworks, such as Compojure etc.</li>
66
<li>Http Services by using Clojure / Java / Groovy to write simple handlers for http services.</li>
77
<li>Nginx Access Handler by Clojure / Java / Groovy</li>
88
<li>Nginx Header Filter by Clojure / Java / Groovy</li>
9+
<li>Nginx Body Filter by Clojure / Java / Groovy</li>
910
<li>
10-
<strong><em>NEW</em></strong>: Nginx Body Filter by Clojure / Java / Groovy</li>
11+
<strong><em>NEW</em></strong>: Nginx Log Handler by Clojure / Java / Groovy</li>
12+
<li>
13+
<strong><em>NEW</em></strong>: HTTP V2 support in both standard edition and embedded edition which are compiled against Nginx 1.14.2</li>
14+
<li>
15+
<strong><em>NEW</em></strong>: Support Java 9, 10, 11, 12</li>
1116
<li>Pub/Sub Among Nginx Worker Processes</li>
1217
<li>Shared Map based on shared memory &amp; Shared Map based Ring session store</li>
1318
<li>Support Sente, see <a href="https://github.com/ptaoussanis/sente/pull/160">this PR</a>
@@ -25,41 +30,41 @@ <h1>
2530
<li>Long Polling &amp; Server Sent Events</li>
2631
<li>Run initialization clojure code when nginx worker starting</li>
2732
<li>Support user defined http request method</li>
28-
<li>Compatible with the Nginx lastest stable version 1.12.0. (Nginx 1.8.x, Nginx 1.6.x, 1.4.x is also ok, older version is not tested and maybe works.)</li>
29-
<li>One of benifits of <a href="http://nginx.org/">Nginx</a> is worker processes are automatically restarted by a master process if they crash</li>
30-
<li>Utilizes lazy headers and direct memory operation between <a href="http://nginx.org/">Nginx</a> and JVM to fast handle dynamic contents from Clojure or Java code.</li>
31-
<li>Utilizes <a href="http://nginx.org/">Nginx</a> zero copy file sending mechanism to fast handle static contents controlled by Clojure or Java code.</li>
33+
<li>Compatible with the Nginx lastest most stable version 1.14.2. (Nginx 1.12.x, 1.8.x, 1.6.x, 1.4.x is also ok, older version is not tested and maybe works.)</li>
34+
<li>One of benifits of <a href="http://nginx.org/" rel="nofollow">Nginx</a> is worker processes are automatically restarted by a master process if they crash</li>
35+
<li>Utilizes lazy headers and direct memory operation between <a href="http://nginx.org/" rel="nofollow">Nginx</a> and JVM to fast handle dynamic contents from Clojure or Java code.</li>
36+
<li>Utilizes <a href="http://nginx.org/" rel="nofollow">Nginx</a> zero copy file sending mechanism to fast handle static contents controlled by Clojure or Java code.</li>
3237
<li>Supports Linux x64, Linux x86 32bit, Win32, Win64 and Mac OS X. Freebsd version can also be got from Freebsd ports.</li>
3338
</ol>
39+
<p>By the way it is very fast, the benchmarks can be found <a href="https://github.com/ptaoussanis/clojure-web-server-benchmarks/">HERE(with wrk2)</a>.</p>
3440
<h1>
35-
<a id="user-content-by-the-way-it-is-very-fast-the-benchmarks-can-be-found-herewith-wrk2jar-repository" class="anchor" href="#by-the-way-it-is-very-fast-the-benchmarks-can-be-found-herewith-wrk2jar-repository" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>By the way it is very fast, the benchmarks can be found <a href="https://github.com/ptaoussanis/clojure-web-server-benchmarks/">HERE(with wrk2)</a>.
36-
Jar Repository</h1>
37-
<p>Nginx-Clojure has already been published to <a href="https://clojars.org/">https://clojars.org/</a> whose maven repository is</p>
41+
<a id="user-content-jar-repository" class="anchor" href="#jar-repository" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Jar Repository</h1>
42+
<p>Nginx-Clojure has already been published to <a href="https://clojars.org/" rel="nofollow">https://clojars.org/</a> whose maven repository is</p>
3843
<div class="highlight highlight-text-xml"><pre>&lt;<span class="pl-ent">repository</span>&gt;
3944
&lt;<span class="pl-ent">id</span>&gt;clojars.org&lt;/<span class="pl-ent">id</span>&gt;
4045
&lt;<span class="pl-ent">url</span>&gt;http://clojars.org/repo&lt;/<span class="pl-ent">url</span>&gt;
4146
&lt;/<span class="pl-ent">repository</span>&gt;</pre></div>
42-
<p>After adding clojars repository, you can reference nginx-clojure 0.4.5 , e.g.</p>
47+
<p>After adding clojars repository, you can reference nginx-clojure 0.5.0 , e.g.</p>
4348
<h2>
4449
<a id="user-content-leiningen-clojure-no-need-to-add-clojars-repository-which-is-a-default-repository-for-leiningen" class="anchor" href="#leiningen-clojure-no-need-to-add-clojars-repository-which-is-a-default-repository-for-leiningen" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Leiningen (clojure, no need to add clojars repository which is a default repository for Leiningen)</h2>
45-
<div class="highlight highlight-source-clojure"><pre>[nginx-clojure <span class="pl-s"><span class="pl-pds">"</span>0.4.5<span class="pl-pds">"</span></span>]</pre></div>
50+
<div class="highlight highlight-source-clojure"><pre>[nginx-clojure <span class="pl-s"><span class="pl-pds">"</span>0.5.0<span class="pl-pds">"</span></span>]</pre></div>
4651
<h2>
4752
<a id="user-content-gradle-groovyjava" class="anchor" href="#gradle-groovyjava" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Gradle (groovy/java)</h2>
48-
<pre><code>compile "nginx-clojure:nginx-clojure:0.4.5"
53+
<pre><code>compile "nginx-clojure:nginx-clojure:0.5.0"
4954
</code></pre>
5055
<h2>
5156
<a id="user-content-maven" class="anchor" href="#maven" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Maven</h2>
5257
<div class="highlight highlight-text-xml"><pre>&lt;<span class="pl-ent">dependency</span>&gt;
5358
&lt;<span class="pl-ent">groupId</span>&gt;nginx-clojure&lt;/<span class="pl-ent">groupId</span>&gt;
5459
&lt;<span class="pl-ent">artifactId</span>&gt;nginx-clojure&lt;/<span class="pl-ent">artifactId</span>&gt;
55-
&lt;<span class="pl-ent">version</span>&gt;0.4.5&lt;/<span class="pl-ent">version</span>&gt;
60+
&lt;<span class="pl-ent">version</span>&gt;0.5.0&lt;/<span class="pl-ent">version</span>&gt;
5661
&lt;/<span class="pl-ent">dependency</span>&gt;</pre></div>
5762
<h1>
5863
<a id="user-content-more-documents" class="anchor" href="#more-documents" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>More Documents</h1>
59-
<p>More Documents can be found from its web site <a href="http://nginx-clojure.github.io/">nginx-clojure.github.io</a></p>
64+
<p>More Documents can be found from its web site <a href="http://nginx-clojure.github.io/" rel="nofollow">nginx-clojure.github.io</a></p>
6065
<h1>
6166
<a id="user-content-license" class="anchor" href="#license" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>License</h1>
62-
<p>Copyright © 2013-2017 Zhang, Yuexiang (xfeep) and released under the BSD 3-Clause license.</p>
67+
<p>Copyright © 2013-2019 Zhang, Yuexiang (xfeep) and released under the BSD 3-Clause license.</p>
6368
<p>This program uses:</p>
6469
<ul>
6570
<li>Re-rooted ASM bytecode engineering library which is distributed under the BSD 3-Clause license</li>

0 commit comments

Comments
 (0)