@@ -45,79 +45,85 @@ min/max runtime parameters. For **multi-threaded** (a.k.a. `threadsafe!`)
4545Rails with a single runtime, set min/max both to 1. Otherwise, define the size
4646of the runtime pool as you wish.
4747
48- <context-param>
49- <param-name>rails.env</param-name>
50- <param-value>production</param-value>
51- </context-param>
52- <context-param>
53- <param-name>jruby.min.runtimes</param-name>
54- <param-value>1</param-value>
55- </context-param>
56- <context-param>
57- <param-name>jruby.max.runtimes</param-name>
58- <param-value>1</param-value>
59- </context-param>
60-
61- <filter>
62- <filter-name>RackFilter</filter-name>
63- <filter-class>org.jruby.rack.RackFilter</filter-class>
64- <!-- optional filter configuration init-params : -->
65- <init-param>
66- <param-name>resetUnhandledResponse</param-name>
67- <param-value>true</param-value> <!-- true (default), false or buffer -->
68- </init-param>
69- <init-param>
70- <param-name>addsHtmlToPathInfo</param-name>
71- <param-value>true</param-value> <!-- true (default), false -->
72- </init-param>
73- <init-param>
74- <param-name>verifiesHtmlResource</param-name>
75- <param-value>false</param-value> <!-- true, false (default) -->
76- </init-param>
77- </filter>
78- <filter-mapping>
79- <filter-name>RackFilter</filter-name>
80- <url-pattern>/*</url-pattern>
81- </filter-mapping>
82-
83- <listener>
84- <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
85- </listener>
48+ ``` xml
49+ <context-param >
50+ <param-name >rails.env</param-name >
51+ <param-value >production</param-value >
52+ </context-param >
53+ <context-param >
54+ <param-name >jruby.min.runtimes</param-name >
55+ <param-value >1</param-value >
56+ </context-param >
57+ <context-param >
58+ <param-name >jruby.max.runtimes</param-name >
59+ <param-value >1</param-value >
60+ </context-param >
61+
62+ <filter >
63+ <filter-name >RackFilter</filter-name >
64+ <filter-class >org.jruby.rack.RackFilter</filter-class >
65+ <!-- optional filter configuration init-params : -->
66+ <init-param >
67+ <param-name >resetUnhandledResponse</param-name >
68+ <param-value >true</param-value > <!-- true (default), false or buffer -->
69+ </init-param >
70+ <init-param >
71+ <param-name >addsHtmlToPathInfo</param-name >
72+ <param-value >true</param-value > <!-- true (default), false -->
73+ </init-param >
74+ <init-param >
75+ <param-name >verifiesHtmlResource</param-name >
76+ <param-value >false</param-value > <!-- true, false (default) -->
77+ </init-param >
78+ </filter >
79+ <filter-mapping >
80+ <filter-name >RackFilter</filter-name >
81+ <url-pattern >/*</url-pattern >
82+ </filter-mapping >
83+
84+ <listener >
85+ <listener-class >org.jruby.rack.rails.RailsServletContextListener</listener-class >
86+ </listener >
87+ ```
8688
8789### (Other) Rack Applications
8890
8991The main difference when using a non-Rails Rack application is that JRuby-Rack
9092looks for a "rackup" file named ** config.ru** in ` WEB-INF/config.ru ` or
9193` WEB-INF/*/config.ru ` . Here's a sample * web.xml* configuration :
9294
93- <filter>
94- <filter-name>RackFilter</filter-name>
95- <filter-class>org.jruby.rack.RackFilter</filter-class>
96- <!-- optional filter configuration init-params (@see above) -->
97- </filter>
98- <filter-mapping>
99- <filter-name>RackFilter</filter-name>
100- <url-pattern>/*</url-pattern>
101- </filter-mapping>
102-
103- <listener>
104- <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
105- </listener>
95+ ``` xml
96+ <filter >
97+ <filter-name >RackFilter</filter-name >
98+ <filter-class >org.jruby.rack.RackFilter</filter-class >
99+ <!-- optional filter configuration init-params (@see above) -->
100+ </filter >
101+ <filter-mapping >
102+ <filter-name >RackFilter</filter-name >
103+ <url-pattern >/*</url-pattern >
104+ </filter-mapping >
105+
106+ <listener >
107+ <listener-class >org.jruby.rack.RackServletContextListener</listener-class >
108+ </listener >
109+ ```
106110
107111If you don't have a * config.ru* or don't want to include it in your web app, you
108112can embed it directly in the * web.xml* as follows (using Sinatra as an example):
109113
110- <context-param>
111- <param-name>rackup</param-name>
112- <param-value>
113- require 'rubygems'
114- gem 'sinatra', '~> 1.3'
115- require './lib/app'
116- set :run, false
117- set :environment, :production
118- run Sinatra::Application
119- </param-value>
120- </context-param>
114+ ``` xml
115+ <context-param >
116+ <param-name >rackup</param-name >
117+ <param-value >
118+ require 'rubygems'
119+ gem 'sinatra', '~> 1.3'
120+ require './lib/app'
121+ set :run, false
122+ set :environment, :production
123+ run Sinatra::Application
124+ </param-value >
125+ </context-param >
126+ ```
121127
122128Be sure to escape angle-brackets for XML !
123129
@@ -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