Skip to content

Commit 7060a2a

Browse files
committed
[chore] Tidy markdown formatting for consistency
(cherry picked from commit 3e58600)
1 parent 47b195c commit 7060a2a

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

README.md

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ in your WAR file when it gets built.
2727
If you're assembling your own WAR using other means, you can install the
2828
**jruby-rack** gem. It provides a method to locate the jar file:
2929

30-
require 'jruby-rack'
31-
FileUtils.cp JRubyJars.jruby_rack_jar_path, '.'
30+
```ruby
31+
require 'jruby-rack'
32+
FileUtils.cp JRubyJars.jruby_rack_jar_path, '.'
33+
```
3234

3335
Otherwise you'll need to download the latest [jar release][2], drop it into the
34-
*WEB-INF/lib* directory and configure the `RackFilter` in your application's
35-
*web.xml* (see following examples).
36+
`WEB-INF/lib` directory and configure the `RackFilter` in your application's
37+
`web.xml` (see following examples).
3638

3739
### Rails
3840

39-
Here's sample *web.xml* configuration for Rails. Note the environment and
41+
Here's sample `web.xml` configuration for Rails. Note the environment and
4042
min/max runtime parameters. For **multi-threaded** (a.k.a. `threadsafe!`)
4143
Rails with a single runtime, set min/max both to 1. Otherwise, define the size
4244
of the runtime pool as you wish.
@@ -85,8 +87,8 @@ of the runtime pool as you wish.
8587
### (Other) Rack Applications
8688

8789
The main difference when using a non-Rails Rack application is that JRuby-Rack
88-
looks for a "rackup" file named **config.ru** in `WEB-INF/config.ru` or
89-
`WEB-INF/*/config.ru`. Here's a sample *web.xml* configuration :
90+
looks for a "rackup" file named `config.ru` in `WEB-INF/config.ru` or
91+
`WEB-INF/*/config.ru`. Here's a sample `web.xml` configuration :
9092

9193
```xml
9294
<filter>
@@ -104,8 +106,8 @@ looks for a "rackup" file named **config.ru** in `WEB-INF/config.ru` or
104106
</listener>
105107
```
106108

107-
If you don't have a *config.ru* or don't want to include it in your web app, you
108-
can embed it directly in the *web.xml* as follows (using Sinatra as an example):
109+
If you don't have a `config.ru` or don't want to include it in your web app, you
110+
can embed it directly in the `web.xml` as follows (using Sinatra as an example):
109111

110112
```xml
111113
<context-param>
@@ -140,7 +142,11 @@ using is `org.jruby.rack.RackFilter`, the filter supports the following
140142
gets reset (accepts values "true", "false" and "buffer" to reset the buffer
141143
only), by default "true"
142144
- **addsHtmlToPathInfo** controls whether the .html suffix is added to the URI
143-
when checking if the request is for a static page
145+
when checking if the request is for a static page. The default behavior for
146+
Rails and many other Ruby applications is to add an `.html` extension to the
147+
resource and attempt to handle it before serving a dynamic request on the
148+
original URI. However, this behavior may confuse other servlets in your
149+
application that have a wildcard mapping. Defaults to true.
144150
- **verifiesHtmlResource** used with the previous parameter to make sure the
145151
requested static resource exists before adding the .html request URI suffix
146152

@@ -150,9 +156,9 @@ a filter, the servlet class name is `org.jruby.rack.RackServlet`.
150156
## Servlet Environment Integration
151157

152158
- servlet context is accessible to any application through the Rack environment
153-
variable *java.servlet_context* (as well as the `$servlet_context` global).
159+
variable `java.servlet_context` (as well as the `$servlet_context` global).
154160
- the (native) servlet request and response objects could be obtained via the
155-
*java.servlet_request* and *java.servlet_response* keys
161+
`java.servlet_request` and `java.servlet_response` keys
156162
- all servlet request attributes are passed through to the Rack environment (and
157163
thus might override request headers or Rack environment variables)
158164
- servlet sessions can be used as a (java) session store for Rails, session
@@ -171,16 +177,15 @@ Several aspects of Rails are automatically set up for you.
171177
## JRuby Runtime Management
172178

173179
JRuby runtime management and pooling is done automatically by the framework.
174-
In the case of Rails, runtimes are pooled by default (the default will most
175-
likely change with the adoption of Rails 4.0). For other Rack applications a
180+
In the case of Rails, runtimes are pooled by default. For other Rack applications a
176181
single shared runtime is created and shared for every request by default.
177-
If *jruby.min.runtimes* and *jruby.max.runtimes* values are
182+
If `jruby.min.runtimes` and `jruby.max.runtimes` values are
178183
specified pooling is supported for plain Rack applications as well.
179184

180185
We do recommend to boot your runtimes up-front to avoid the cost of initializing
181186
one while a request kicks in and find the pool empty, this can be easily avoided
182-
by setting *jruby.min.runtimes* equal to *jruby.max.runtimes*. You might also
183-
want to consider tuning the *jruby.runtime.acquire.timeout* parameter to not
187+
by setting `jruby.min.runtimes` equal to `jruby.max.runtimes`. You might also
188+
want to consider tuning the `jruby.runtime.acquire.timeout` parameter to not
184189
wait too long when all (max) runtimes from the pool are busy.
185190

186191
## JRuby-Rack Configuration
@@ -190,18 +195,18 @@ as context init parameters in web.xml or as VM-wide system properties.
190195

191196
- `rackup`: Rackup script for configuring how the Rack application is mounted.
192197
Required for Rack-based applications other than Rails. Can be omitted if a
193-
*config.ru* is included in the application root.
198+
`config.ru` is included in the application root.
194199
- `public.root`: Relative path to the location of your application's static
195-
assets. Defaults to */*.
200+
assets. Defaults to `*/*`.
196201
- `rails.root`: Root path to the location of the Rails application files.
197-
Defaults to */WEB-INF*.
202+
Defaults to `*/WEB-INF*`.
198203
- `rails.env`: Specify the Rails environment to run. Defaults to 'production'.
199204
- `rails.relative_url_append`: Specify a path to be appended to the
200205
`ActionController::Base.relative_url_root` after the context path. Useful
201206
for running a rails app from the same war as an existing app, under a
202207
sub-path of the main servlet context root.
203208
- `gem.path`: Relative path to the bundled gem repository. Defaults to
204-
*/WEB-INF/gems*.
209+
`/WEB-INF/gems`.
205210
- `jruby.compat.version`: Set to "1.8" or "1.9" to make JRuby run a specific
206211
version of Ruby (same as the --1.8 / --1.9 command line flags).
207212
- `jruby.min.runtimes`: For non-threadsafe Rails applications using a runtime
@@ -263,17 +268,17 @@ as context init parameters in web.xml or as VM-wide system properties.
263268

264269
There are often cases where you need to perform custom initialization of the
265270
Ruby environment before booting the application. You can create a file called
266-
*META-INF/init.rb* or *WEB-INF/init.rb* inside the war file for this purpose.
271+
`META-INF/init.rb` or `WEB-INF/init.rb` inside the war file for this purpose.
267272
These files, if found, will be evaluated before booting the Rack environment,
268273
allowing you to set environment variables, load scripts, etc.
269274

270275
For plain Rack applications, JRuby-Rack also supports a magic comment to solve
271276
the "rackup" chicken-egg problem (you need Rack's builder loaded before loading
272-
the *config.ru*, yet you may want to setup the gem version from within the rackup
277+
the `config.ru`, yet you may want to setup the gem version from within the rackup
273278
file). As we ship with the Rack gem bundled, otherwise when executing the
274-
provided *config.ru* the bundled (latest) version of Rack will get loaded.
279+
provided `config.ru` the bundled (latest) version of Rack will get loaded.
275280

276-
Use **rack.version** to specify the Rack gem version to be loaded before rackup :
281+
Use `rack.version` to specify the Rack gem version to be loaded before rackup :
277282

278283
```ruby
279284
# encoding: UTF-8
@@ -324,7 +329,7 @@ Build the .jar using Maven :
324329
./mvnw install
325330
```
326331

327-
the generated jar should be located at **target/jruby-rack-*.jar**
332+
the generated jar should be located at `target/jruby-rack-*.jar`
328333

329334
Alternatively use Rake, e.g. to build the gem (skipping specs) :
330335

0 commit comments

Comments
 (0)