@@ -43,79 +43,85 @@ min/max runtime parameters. For **multi-threaded** (a.k.a. `threadsafe!`)
4343Rails with a single runtime, set min/max both to 1. Otherwise, define the size
4444of the runtime pool as you wish.
4545
46- <context-param>
47- <param-name>rails.env</param-name>
48- <param-value>production</param-value>
49- </context-param>
50- <context-param>
51- <param-name>jruby.min.runtimes</param-name>
52- <param-value>1</param-value>
53- </context-param>
54- <context-param>
55- <param-name>jruby.max.runtimes</param-name>
56- <param-value>1</param-value>
57- </context-param>
58-
59- <filter>
60- <filter-name>RackFilter</filter-name>
61- <filter-class>org.jruby.rack.RackFilter</filter-class>
62- <!-- optional filter configuration init-params : -->
63- <init-param>
64- <param-name>resetUnhandledResponse</param-name>
65- <param-value>true</param-value> <!-- true (default), false or buffer -->
66- </init-param>
67- <init-param>
68- <param-name>addsHtmlToPathInfo</param-name>
69- <param-value>true</param-value> <!-- true (default), false -->
70- </init-param>
71- <init-param>
72- <param-name>verifiesHtmlResource</param-name>
73- <param-value>false</param-value> <!-- true, false (default) -->
74- </init-param>
75- </filter>
76- <filter-mapping>
77- <filter-name>RackFilter</filter-name>
78- <url-pattern>/*</url-pattern>
79- </filter-mapping>
80-
81- <listener>
82- <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
83- </listener>
46+ ``` xml
47+ <context-param >
48+ <param-name >rails.env</param-name >
49+ <param-value >production</param-value >
50+ </context-param >
51+ <context-param >
52+ <param-name >jruby.min.runtimes</param-name >
53+ <param-value >1</param-value >
54+ </context-param >
55+ <context-param >
56+ <param-name >jruby.max.runtimes</param-name >
57+ <param-value >1</param-value >
58+ </context-param >
59+
60+ <filter >
61+ <filter-name >RackFilter</filter-name >
62+ <filter-class >org.jruby.rack.RackFilter</filter-class >
63+ <!-- optional filter configuration init-params : -->
64+ <init-param >
65+ <param-name >resetUnhandledResponse</param-name >
66+ <param-value >true</param-value > <!-- true (default), false or buffer -->
67+ </init-param >
68+ <init-param >
69+ <param-name >addsHtmlToPathInfo</param-name >
70+ <param-value >true</param-value > <!-- true (default), false -->
71+ </init-param >
72+ <init-param >
73+ <param-name >verifiesHtmlResource</param-name >
74+ <param-value >false</param-value > <!-- true, false (default) -->
75+ </init-param >
76+ </filter >
77+ <filter-mapping >
78+ <filter-name >RackFilter</filter-name >
79+ <url-pattern >/*</url-pattern >
80+ </filter-mapping >
81+
82+ <listener >
83+ <listener-class >org.jruby.rack.rails.RailsServletContextListener</listener-class >
84+ </listener >
85+ ```
8486
8587### (Other) Rack Applications
8688
8789The main difference when using a non-Rails Rack application is that JRuby-Rack
8890looks for a "rackup" file named ** config.ru** in ` WEB-INF/config.ru ` or
8991` WEB-INF/*/config.ru ` . Here's a sample * web.xml* configuration :
9092
91- <filter>
92- <filter-name>RackFilter</filter-name>
93- <filter-class>org.jruby.rack.RackFilter</filter-class>
94- <!-- optional filter configuration init-params (@see above) -->
95- </filter>
96- <filter-mapping>
97- <filter-name>RackFilter</filter-name>
98- <url-pattern>/*</url-pattern>
99- </filter-mapping>
100-
101- <listener>
102- <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
103- </listener>
93+ ``` xml
94+ <filter >
95+ <filter-name >RackFilter</filter-name >
96+ <filter-class >org.jruby.rack.RackFilter</filter-class >
97+ <!-- optional filter configuration init-params (@see above) -->
98+ </filter >
99+ <filter-mapping >
100+ <filter-name >RackFilter</filter-name >
101+ <url-pattern >/*</url-pattern >
102+ </filter-mapping >
103+
104+ <listener >
105+ <listener-class >org.jruby.rack.RackServletContextListener</listener-class >
106+ </listener >
107+ ```
104108
105109If you don't have a * config.ru* or don't want to include it in your web app, you
106110can embed it directly in the * web.xml* as follows (using Sinatra as an example):
107111
108- <context-param>
109- <param-name>rackup</param-name>
110- <param-value>
111- require 'rubygems'
112- gem 'sinatra', '~> 1.3'
113- require './lib/app'
114- set :run, false
115- set :environment, :production
116- run Sinatra::Application
117- </param-value>
118- </context-param>
112+ ``` xml
113+ <context-param >
114+ <param-name >rackup</param-name >
115+ <param-value >
116+ require 'rubygems'
117+ gem 'sinatra', '~> 1.3'
118+ require './lib/app'
119+ set :run, false
120+ set :environment, :production
121+ run Sinatra::Application
122+ </param-value >
123+ </context-param >
124+ ```
119125
120126Be sure to escape angle-brackets for XML !
121127
@@ -271,13 +277,16 @@ provided *config.ru* the bundled (latest) version of Rack will get loaded.
271277
272278Use ** rack.version** to specify the Rack gem version to be loaded before rackup :
273279
274- # encoding: UTF-8
275- # rack.version: ~>2.2.10 (before code is loaded gem '~>2.2.10' will be called)
280+ ``` ruby
281+ # encoding: UTF-8
282+ # rack.version: ~>2.2.10 (before code is loaded gem '~>2.2.10' will be called)
283+ ```
276284
277285Or the equivalent of doing ` bundle exec rackup ... ` if you're using Bundler :
278286
279- # rack.version: bundler (requires 'bundler/setup' before loading the script)
280-
287+ ``` ruby
288+ # rack.version: bundler (requires 'bundler/setup' before loading the script)
289+ ```
281290
282291## Logging
283292
@@ -304,21 +313,27 @@ For those loggers that require a specific named logger, set it with the
304313
305314Checkout the JRuby-Rack code using [ git] ( http://git-scm.com/ ) :
306315
307- git clone git://github.com/jruby/jruby-rack.git
308- cd jruby-rack
316+ ``` shell
317+ git clone git://github.com/jruby/jruby-rack.git
318+ cd jruby-rack
319+ ```
309320
310321Ensure you have [ Maven] ( http://maven.apache.org/ ) installed.
311322It is required for downloading jar artifacts that JRuby-Rack depends on.
312323
313324Build the .jar using Maven :
314325
315- mvn install
326+ ``` shell
327+ mvn install
328+ ```
316329
317330the generated jar should be located at ** target/jruby-rack-* .jar**
318331
319332Alternatively use Rake, e.g. to build the gem (skipping specs) :
320333
321- jruby -S rake clean gem SKIP_SPECS=true
334+ ``` shell
335+ jruby -S rake clean gem SKIP_SPECS=true
336+ ```
322337
323338You can ** not** use JRuby-Rack with Bundler directly from the git (or http) URL
324339(` gem 'jruby-rack', :github => 'jruby/jruby-rack' ` ) since the included .jar file
0 commit comments