@@ -28,12 +28,12 @@ dependencies {
2828
2929## Compatibility
3030
31- | JRuby-Rack Version | Status | JRuby Compat | Java Compat | Target Servlet API | Target Java EE | Notes |
32- | --------------------------------------------------------------| ------------| -------------- | ------------- | --------------------| ----------------| ---------------------------------------------------|
33- | 1.4 .x (_ planned_ ) | Dev | 9.4 → 10.0 | Java 17+ | 5.0 | Jakarta EE 9 | |
34- | 1.3.x (master, _ unreleased_ ) | Dev | 9.4 → 10.0 | Java 11+ | 4.0 | Java EE 8 | |
35- | [ 1.2.x] ( https://github.com/jruby/jruby-rack/tree/1.2-stable ) | Maintained | 9.3 → 9.4 | Java 8+ | 3.0 | Java EE 6 | Servlet 3.1 → 4.0 tested OK with some containers. |
36- | [ 1.1.x] ( https://github.com/jruby/jruby-rack/tree/1.1-stable ) | EOL | 1.6 → 9.4 | Java 8+ | 2.5 | Java EE 5 | Servlet 3.0 → 4.0 tested OK with some containers. |
31+ | JRuby-Rack Version | Status | Rack | JRuby | Java | Target Servlet API | Target Java EE | Notes |
32+ | --------------------------------------------------------------| ------------| -----------| ------------| ---------| --------------------| ---------------- | --------------------------------------------|
33+ | 2.0 .x (_ planned_ ) | Dev | 2.2 | 9.4 → 10.0 | Java 8+ | 5.0+ | Jakarta EE 9 | Pre 5.0 servlet APIs non functional. |
34+ | 1.3.x (master, _ unreleased_ ) | Dev | 2.2 | 9.4 → 10.0 | Java 8+ | 4.0 | Java EE 8 | Servlet 2.5 → 3.1 likely to work fine. |
35+ | [ 1.2.x] ( https://github.com/jruby/jruby-rack/tree/1.2-stable ) | Maintained | 2.2 | 9.3 → 9.4 | Java 8+ | 3.0 | Java EE 6 | Servlet 3.1 → 4.0 OK with some containers. |
36+ | [ 1.1.x] ( https://github.com/jruby/jruby-rack/tree/1.1-stable ) | EOL | 1.x → 2.2 | 1. 6 → 9.4 | Java 8+ | 2.5 | Java EE 5 | Servlet 3.0 → 4.0 OK with some containers. |
3737
3838## Getting Started
3939
@@ -62,79 +62,85 @@ min/max runtime parameters. For **multi-threaded** (a.k.a. `threadsafe!`)
6262Rails with a single runtime, set min/max both to 1. Otherwise, define the size
6363of the runtime pool as you wish.
6464
65- <context-param>
66- <param-name>rails.env</param-name>
67- <param-value>production</param-value>
68- </context-param>
69- <context-param>
70- <param-name>jruby.min.runtimes</param-name>
71- <param-value>1</param-value>
72- </context-param>
73- <context-param>
74- <param-name>jruby.max.runtimes</param-name>
75- <param-value>1</param-value>
76- </context-param>
77-
78- <filter>
79- <filter-name>RackFilter</filter-name>
80- <filter-class>org.jruby.rack.RackFilter</filter-class>
81- <!-- optional filter configuration init-params : -->
82- <init-param>
83- <param-name>resetUnhandledResponse</param-name>
84- <param-value>true</param-value> <!-- true (default), false or buffer -->
85- </init-param>
86- <init-param>
87- <param-name>addsHtmlToPathInfo</param-name>
88- <param-value>true</param-value> <!-- true (default), false -->
89- </init-param>
90- <init-param>
91- <param-name>verifiesHtmlResource</param-name>
92- <param-value>false</param-value> <!-- true, false (default) -->
93- </init-param>
94- </filter>
95- <filter-mapping>
96- <filter-name>RackFilter</filter-name>
97- <url-pattern>/*</url-pattern>
98- </filter-mapping>
99-
100- <listener>
101- <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
102- </listener>
65+ ``` xml
66+ <context-param >
67+ <param-name >rails.env</param-name >
68+ <param-value >production</param-value >
69+ </context-param >
70+ <context-param >
71+ <param-name >jruby.min.runtimes</param-name >
72+ <param-value >1</param-value >
73+ </context-param >
74+ <context-param >
75+ <param-name >jruby.max.runtimes</param-name >
76+ <param-value >1</param-value >
77+ </context-param >
78+
79+ <filter >
80+ <filter-name >RackFilter</filter-name >
81+ <filter-class >org.jruby.rack.RackFilter</filter-class >
82+ <!-- optional filter configuration init-params : -->
83+ <init-param >
84+ <param-name >resetUnhandledResponse</param-name >
85+ <param-value >true</param-value > <!-- true (default), false or buffer -->
86+ </init-param >
87+ <init-param >
88+ <param-name >addsHtmlToPathInfo</param-name >
89+ <param-value >true</param-value > <!-- true (default), false -->
90+ </init-param >
91+ <init-param >
92+ <param-name >verifiesHtmlResource</param-name >
93+ <param-value >false</param-value > <!-- true, false (default) -->
94+ </init-param >
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.rails.RailsServletContextListener</listener-class >
103+ </listener >
104+ ```
103105
104106### (Other) Rack Applications
105107
106108The main difference when using a non-Rails Rack application is that JRuby-Rack
107109looks for a "rackup" file named ** config.ru** in ` WEB-INF/config.ru ` or
108110` WEB-INF/*/config.ru ` . Here's a sample * web.xml* configuration :
109111
110- <filter>
111- <filter-name>RackFilter</filter-name>
112- <filter-class>org.jruby.rack.RackFilter</filter-class>
113- <!-- optional filter configuration init-params (@see above) -->
114- </filter>
115- <filter-mapping>
116- <filter-name>RackFilter</filter-name>
117- <url-pattern>/*</url-pattern>
118- </filter-mapping>
119-
120- <listener>
121- <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
122- </listener>
112+ ``` xml
113+ <filter >
114+ <filter-name >RackFilter</filter-name >
115+ <filter-class >org.jruby.rack.RackFilter</filter-class >
116+ <!-- optional filter configuration init-params (@see above) -->
117+ </filter >
118+ <filter-mapping >
119+ <filter-name >RackFilter</filter-name >
120+ <url-pattern >/*</url-pattern >
121+ </filter-mapping >
122+
123+ <listener >
124+ <listener-class >org.jruby.rack.RackServletContextListener</listener-class >
125+ </listener >
126+ ```
123127
124128If you don't have a * config.ru* or don't want to include it in your web app, you
125129can embed it directly in the * web.xml* as follows (using Sinatra as an example):
126130
127- <context-param>
128- <param-name>rackup</param-name>
129- <param-value>
130- require 'rubygems'
131- gem 'sinatra', '~> 1.3'
132- require './lib/app'
133- set :run, false
134- set :environment, :production
135- run Sinatra::Application
136- </param-value>
137- </context-param>
131+ ``` xml
132+ <context-param >
133+ <param-name >rackup</param-name >
134+ <param-value >
135+ require 'rubygems'
136+ gem 'sinatra', '~> 1.3'
137+ require './lib/app'
138+ set :run, false
139+ set :environment, :production
140+ run Sinatra::Application
141+ </param-value >
142+ </context-param >
143+ ```
138144
139145Be sure to escape angle-brackets for XML !
140146
@@ -288,13 +294,16 @@ provided *config.ru* the bundled (latest) version of Rack will get loaded.
288294
289295Use ** rack.version** to specify the Rack gem version to be loaded before rackup :
290296
291- # encoding: UTF-8
292- # rack.version: ~>2.2.10 (before code is loaded gem '~>2.2.10' will be called)
297+ ``` ruby
298+ # encoding: UTF-8
299+ # rack.version: ~>2.2.10 (before code is loaded gem '~>2.2.10' will be called)
300+ ```
293301
294302Or the equivalent of doing ` bundle exec rackup ... ` if you're using Bundler :
295303
296- # rack.version: bundler (requires 'bundler/setup' before loading the script)
297-
304+ ``` ruby
305+ # rack.version: bundler (requires 'bundler/setup' before loading the script)
306+ ```
298307
299308## Logging
300309
@@ -305,12 +314,12 @@ logging system, configure `jruby.rack.logging` as follows:
305314- ` servlet_context ` (default): Sends log messages to the servlet context.
306315- ` stdout ` : Sends log messages to the standard output stream ` System.out ` .
307316- ` slf4j ` : Sends log messages to SLF4J. SLF4J configuration is left up to you,
308- please refer to http ://www.slf4j.org/docs .html .
309- - ` log4j ` : Sends log messages to log4J. Again, Log4J configuration is
310- left up to you, consult http ://logging.apache.org/log4j/ .
317+ please refer to https ://www.slf4j.org/manual .html .
318+ - ` log4j ` : Sends log messages through Log4j. Only Log4j 2.x is supported, for
319+ - configuration please consult https ://logging.apache.org/log4j/2.x/index.html .
311320- ` commons_logging ` : Routes logs to commons-logging. You still need to configure
312- an underlying logging implementation with JCL. We recommend using the logger
313- library wrapper directly if possible, see http://commons.apache.org/logging/ .
321+ an underlying logging implementation with JCL.
322+ We recommend rather using the logger library wrapper directly when possible.
314323- ` jul ` : Directs log messages via Java's core logging facilities (util.logging).
315324
316325For those loggers that require a specific named logger, set it with the
@@ -321,21 +330,27 @@ For those loggers that require a specific named logger, set it with the
321330
322331Checkout the JRuby-Rack code using [ git] ( http://git-scm.com/ ) :
323332
324- git clone git://github.com/jruby/jruby-rack.git
325- cd jruby-rack
333+ ``` shell
334+ git clone git://github.com/jruby/jruby-rack.git
335+ cd jruby-rack
336+ ```
326337
327338Ensure you have [ Maven] ( http://maven.apache.org/ ) installed.
328339It is required for downloading jar artifacts that JRuby-Rack depends on.
329340
330341Build the .jar using Maven :
331342
332- mvn install
343+ ``` shell
344+ mvn install
345+ ```
333346
334347the generated jar should be located at ** target/jruby-rack-* .jar**
335348
336349Alternatively use Rake, e.g. to build the gem (skipping specs) :
337350
338- jruby -S rake clean gem SKIP_SPECS=true
351+ ``` shell
352+ jruby -S rake clean gem SKIP_SPECS=true
353+ ```
339354
340355You can ** not** use JRuby-Rack with Bundler directly from the git (or http) URL
341356(` gem 'jruby-rack', :github => 'jruby/jruby-rack' ` ) since the included .jar file
0 commit comments