Skip to content

Commit bdf41d4

Browse files
committed
set content handler type to java for tomcat & jersey
1 parent b0831b1 commit bdf41d4

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

CoreFeatures.md.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ <h2>
6161
<div class="highlight highlight-xml"><pre>&lt;<span class="pl-ent">dependency</span>&gt;
6262
&lt;<span class="pl-ent">groupId</span>&gt;nginx-clojure&lt;/<span class="pl-ent">groupId</span>&gt;
6363
&lt;<span class="pl-ent">artifactId</span>&gt;nginx-clojure&lt;/<span class="pl-ent">artifactId</span>&gt;
64-
&lt;<span class="pl-ent">version</span>&gt;0.3.0&lt;/<span class="pl-ent">version</span>&gt;
64+
&lt;<span class="pl-ent">version</span>&gt;0.4.0&lt;/<span class="pl-ent">version</span>&gt;
6565
&lt;/<span class="pl-ent">dependency</span>&gt;</pre></div>
6666

6767
<h1>

More.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,9 @@ Then we 'll get log files whose name just like myapp.2014-09-12-1.log, myapp.20
451451
452452
3.8 Sever Side WebSocket
453453
-----------------
454-
Sever Side WebSocket, like long polling/Server Sent Events, also use hijack API to get a NginxHttpServerChannel to send / receive messages.
455-
454+
455+
###3.8.1 Echo Service Example
456+
Sever Side WebSocket, like long polling/Server Sent Events, also use hijack API to get a NginxHttpServerChannel to send / receive messages.
456457
Here we give a echo service example.
457458
458459
In nginx.conf
@@ -543,6 +544,8 @@ public class WSEcho implements NginxJavaRingHandler {
543544
544545
}
545546
547+
###3.8.1 Use Access Handler For WebSocket Security
548+
546549
```
547550
548551
3.9 Java standard RESTful web services with Jersey
@@ -552,6 +555,8 @@ in nginx.conf
552555
553556
```nginx
554557
location /jersey {
558+
559+
content_handler_type java;
555560
content_handler_name 'nginx.clojure.bridge.NginxBridgeHandler';
556561
content_handler_property system.m2rep '/home/who/.m2/repository';
557562
@@ -636,6 +641,7 @@ in nginx.conf
636641
```nginx
637642
location / {
638643
644+
content_handler_type java;
639645
content_handler_name 'nginx.clojure.bridge.NginxBridgeHandler';
640646
641647
##Tomcat 8 installation path

More.md.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,11 @@ <h2>
433433
<h2>
434434
<a id="user-content-38--sever-side-websocket" class="anchor" href="#38--sever-side-websocket" aria-hidden="true"><span class="octicon octicon-link"></span></a>3.8 Sever Side WebSocket</h2>
435435

436-
<p>Sever Side WebSocket, like long polling/Server Sent Events, also use hijack API to get a NginxHttpServerChannel to send / receive messages.</p>
436+
<h3>
437+
<a id="user-content-381-echo-service-example" class="anchor" href="#381-echo-service-example" aria-hidden="true"><span class="octicon octicon-link"></span></a>3.8.1 Echo Service Example</h3>
437438

438-
<p>Here we give a echo service example.</p>
439+
<p>Sever Side WebSocket, like long polling/Server Sent Events, also use hijack API to get a NginxHttpServerChannel to send / receive messages.
440+
Here we give a echo service example.</p>
439441

440442
<p>In nginx.conf</p>
441443

@@ -519,6 +521,8 @@ <h2>
519521
}
520522

521523
}
524+
525+
###<span class="pl-c1">3.8</span><span class="pl-k">.</span><span class="pl-c1">1</span> <span class="pl-smi">Use</span> <span class="pl-smi">Access</span> <span class="pl-smi">Handler</span> <span class="pl-smi">For</span> <span class="pl-smi">WebSocket</span> <span class="pl-smi">Security</span>
522526
</pre></div>
523527

524528
<h2>
@@ -527,6 +531,8 @@ <h2>
527531
<p>in nginx.conf</p>
528532

529533
<div class="highlight highlight-nginx"><pre> <span class="pl-k">location</span> <span class="pl-en">/jersey </span>{
534+
535+
<span class="pl-k">content_handler_type</span> java;
530536
<span class="pl-k">content_handler_name</span> <span class="pl-s">'nginx.clojure.bridge.NginxBridgeHandler'</span>;
531537
<span class="pl-k">content_handler_property</span> system.m2rep <span class="pl-s">'/home/who/.m2/repository'</span>;
532538

@@ -604,6 +610,7 @@ <h2>
604610

605611
<div class="highlight highlight-nginx"><pre> <span class="pl-k">location</span> <span class="pl-en">/ </span>{
606612

613+
<span class="pl-k">content_handler_type</span> java;
607614
<span class="pl-k">content_handler_name</span> <span class="pl-s">'nginx.clojure.bridge.NginxBridgeHandler'</span>;
608615

609616
<span class="pl-c">##Tomcat 8 installation path</span>

more.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,7 @@ <h2>
442442
<span class="pl-k">@Override</span>
443443
<span class="pl-k">public</span> <span class="pl-k">Object</span>[] <span class="pl-en">invoke</span>(<span class="pl-k">Map&lt;<span class="pl-smi">String</span>, <span class="pl-smi">Object</span>&gt;</span> <span class="pl-v">request</span>) {
444444
<span class="pl-smi">NginxJavaRequest</span> r <span class="pl-k">=</span> (<span class="pl-smi">NginxJavaRequest</span>) request;
445-
<span class="pl-smi">NginxHandler</span> handler <span class="pl-k">=</span> r<span class="pl-k">.</span>handler();
446-
<span class="pl-smi">NginxHttpServerChannel</span> channel <span class="pl-k">=</span> handler<span class="pl-k">.</span>hijack(r, <span class="pl-c1">true</span>);
445+
<span class="pl-smi">NginxHttpServerChannel</span> channel <span class="pl-k">=</span> r<span class="pl-k">.</span>hijack(<span class="pl-c1">true</span>);
447446
channel<span class="pl-k">.</span>addListener(channel, <span class="pl-k">new</span> <span class="pl-k">ChannelListener&lt;<span class="pl-smi">NginxHttpServerChannel</span>&gt;</span>() {
448447
<span class="pl-k">@Override</span>
449448
<span class="pl-k">public</span> <span class="pl-k">void</span> <span class="pl-en">onClose</span>(<span class="pl-smi">NginxHttpServerChannel</span> <span class="pl-v">data</span>) {
@@ -530,9 +529,11 @@ <h2>
530529
<h2>
531530
<a id="user-content-38--sever-side-websocket" class="anchor" href="#38--sever-side-websocket" aria-hidden="true"><span class="octicon octicon-link"></span></a>3.8 Sever Side WebSocket</h2>
532531

533-
<p>Sever Side WebSocket, like long polling/Server Sent Events, also use hijack API to get a NginxHttpServerChannel to send / receive messages.</p>
532+
<h3>
533+
<a id="user-content-381-echo-service-example" class="anchor" href="#381-echo-service-example" aria-hidden="true"><span class="octicon octicon-link"></span></a>3.8.1 Echo Service Example</h3>
534534

535-
<p>Here we give a echo service example.</p>
535+
<p>Sever Side WebSocket, like long polling/Server Sent Events, also use hijack API to get a NginxHttpServerChannel to send / receive messages.
536+
Here we give a echo service example.</p>
536537

537538
<p>In nginx.conf</p>
538539

@@ -571,7 +572,7 @@ <h2>
571572
<span class="pl-k">@Override</span>
572573
<span class="pl-k">public</span> <span class="pl-k">Object</span>[] <span class="pl-en">invoke</span>(<span class="pl-k">Map&lt;<span class="pl-smi">String</span>, <span class="pl-smi">Object</span>&gt;</span> <span class="pl-v">request</span>) {
573574
<span class="pl-smi">NginxJavaRequest</span> r <span class="pl-k">=</span> (<span class="pl-smi">NginxJavaRequest</span>)request;
574-
<span class="pl-smi">NginxHttpServerChannel</span> sc <span class="pl-k">=</span> r<span class="pl-k">.</span>handler()<span class="pl-k">.</span>hijack(r, <span class="pl-c1">true</span>);
575+
<span class="pl-smi">NginxHttpServerChannel</span> sc <span class="pl-k">=</span> r<span class="pl-k">.</span>hijack(<span class="pl-c1">true</span>);
575576
sc<span class="pl-k">.</span>addListener(sc, <span class="pl-k">new</span> <span class="pl-k">MessageAdapter&lt;<span class="pl-smi">NginxHttpServerChannel</span>&gt;</span>() {
576577
<span class="pl-k">int</span> total <span class="pl-k">=</span> <span class="pl-c1">0</span>;
577578
<span class="pl-k">@Override</span>
@@ -616,6 +617,8 @@ <h2>
616617
}
617618

618619
}
620+
621+
###<span class="pl-c1">3.8</span><span class="pl-k">.</span><span class="pl-c1">1</span> <span class="pl-smi">Use</span> <span class="pl-smi">Access</span> <span class="pl-smi">Handler</span> <span class="pl-smi">For</span> <span class="pl-smi">WebSocket</span> <span class="pl-smi">Security</span>
619622
</pre></div>
620623

621624
<h2>
@@ -624,6 +627,8 @@ <h2>
624627
<p>in nginx.conf</p>
625628

626629
<div class="highlight highlight-nginx"><pre> <span class="pl-k">location</span> <span class="pl-en">/jersey </span>{
630+
631+
<span class="pl-k">content_handler_type</span> java;
627632
<span class="pl-k">content_handler_name</span> <span class="pl-s">'nginx.clojure.bridge.NginxBridgeHandler'</span>;
628633
<span class="pl-k">content_handler_property</span> system.m2rep <span class="pl-s">'/home/who/.m2/repository'</span>;
629634

@@ -701,6 +706,7 @@ <h2>
701706

702707
<div class="highlight highlight-nginx"><pre> <span class="pl-k">location</span> <span class="pl-en">/ </span>{
703708

709+
<span class="pl-k">content_handler_type</span> java;
704710
<span class="pl-k">content_handler_name</span> <span class="pl-s">'nginx.clojure.bridge.NginxBridgeHandler'</span>;
705711

706712
<span class="pl-c">##Tomcat 8 installation path</span>

0 commit comments

Comments
 (0)