Skip to content

Commit 0864cbf

Browse files
committed
Merge remote-tracking branch 'upstream/master' into gocd-master
2 parents 6f8578d + cf14c5e commit 0864cbf

File tree

108 files changed

+2135
-4062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+2135
-4062
lines changed

.github/workflows/maven.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ env:
1010
# Default versions for canonical release build
1111
DEFAULT_JAVA_VERSION: '8'
1212
DEFAULT_JRUBY_VERSION: '9.4.13.0' # Should match pom.xml <jruby.version> property (AND a version inside the test matrix)
13+
DEFAULT_RACK_VERSION: '~> 2.2.0' # Should match Gemfile (AND a version inside the test matrix)
1314

1415
jobs:
1516
build:
16-
name: JRuby ${{ matrix.jruby_version }} / Java ${{ matrix.java_version }}
17+
name: Rack ${{ matrix.rack_version }} on JRuby ${{ matrix.jruby_version }} / Java ${{ matrix.java_version }}
1718
runs-on: ubuntu-latest
1819

1920
strategy:
2021
matrix:
2122
jruby_version: [ '9.4.13.0', '10.0.2.0' ]
2223
java_version: [ '8', '11', '17', '21' ]
24+
rack_version: [ '~> 2.2.0' ]
2325
exclude:
2426
- jruby_version: '10.0.2.0'
2527
java_version: '8' # JRuby 10 requires Java 21
@@ -41,31 +43,42 @@ jobs:
4143

4244
- name: Build with Maven
4345
run: ./mvnw -B install -Djruby.version=${{ matrix.jruby_version }}
46+
env:
47+
RACK_VERSION: ${{ matrix.rack_version }}
4448

4549
# Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
4650
- name: Update dependency graph
4751
uses: advanced-security/maven-dependency-submission-action@b275d12641ac2d2108b2cbb7598b154ad2f2cee8 # v5.0.0
48-
if: github.ref == 'refs/heads/master' && matrix.java_version == env.DEFAULT_JAVA_VERSION && matrix.jruby_version == env.DEFAULT_JRUBY_VERSION
52+
if: github.ref == 'refs/heads/master' && matrix.java_version == env.DEFAULT_JAVA_VERSION && matrix.jruby_version == env.DEFAULT_JRUBY_VERSION && matrix.rack_version == env.DEFAULT_RACK_VERSION
4953

5054
appraisals:
5155
needs: build
52-
name: ${{ matrix.appraisal }} appraisal on ${{ matrix.jruby_version }} / Java ${{ matrix.java_version }}
56+
name: ${{ matrix.appraisal }} on ${{ matrix.jruby_version }} / Java ${{ matrix.java_version }}
5357
runs-on: ubuntu-latest
5458

5559
strategy:
5660
matrix:
61+
appraisal: [
62+
'rails50_rack22',
63+
'rails52_rack22',
64+
'rails60_rack22',
65+
'rails61_rack22',
66+
'rails70_rack22',
67+
'rails71_rack22',
68+
'rails72_rack22',
69+
'rails80_rack22',
70+
]
5771
jruby_version: [ '9.4.13.0', '10.0.2.0' ]
5872
java_version: [ '8', '11', '17', '21' ]
59-
appraisal: [ 'rails50', 'rails52', 'rails60', 'rails61', 'rails70', 'rails71', 'rails72', 'rails80' ]
6073
exclude:
61-
- jruby_version: '9.4.13.0'
62-
appraisal: 'rails80' # Requires Ruby 3.4 compatibility, which JRuby 9.4 does not support
6374
- jruby_version: '10.0.2.0'
6475
java_version: '8' # JRuby 10 requires Java 21
6576
- jruby_version: '10.0.2.0'
6677
java_version: '11' # JRuby 10 requires Java 21
6778
- jruby_version: '10.0.2.0'
6879
java_version: '17' # JRuby 10 requires Java 21
80+
- appraisal: 'rails80_rack22'
81+
jruby_version: '9.4.13.0' # Rails 8 requires Ruby 3.4 compatibility, which JRuby 9.4 does not support
6982
fail-fast: false
7083

7184
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ examples/*/nbproject
1212
nbproject
1313
.idea/
1414
.rvmrc
15+
gemfiles/*.lock

Appraisals

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
1-
appraise "rails50" do
2-
gem "rails", "~> 5.0.0"
3-
end
4-
5-
appraise "rails52" do
6-
gem "rails", "~> 5.2.0"
7-
end
1+
version_spec = ->(prefix, desc) { "~> #{desc.split(prefix).last.insert(1, ".")}.0" }
82

9-
appraise "rails60" do
10-
gem "rails", "~> 6.0.0"
11-
end
12-
13-
appraise "rails61" do
14-
gem "rails", "~> 6.1.0"
15-
end
3+
# Rails version -> rack versions in format
4+
# rails#{MAJOR}#{MINOR} => %w[ rack#{MAJOR}#{MINOR} ]
5+
{
6+
"rails50" => %w[rack22],
7+
"rails52" => %w[rack22],
8+
"rails60" => %w[rack22],
9+
"rails61" => %w[rack22],
10+
"rails70" => %w[rack22],
11+
"rails71" => %w[rack22],
12+
"rails72" => %w[rack22],
13+
"rails80" => %w[rack22]
14+
}.each do |rails_desc, rack_descs|
15+
rack_descs.each do |rack_desc|
1616

17-
appraise "rails70" do
18-
gem "rails", "~> 7.0.0"
17+
appraise "#{rails_desc}_#{rack_desc}" do
18+
group :default do
19+
gem "rack", version_spec.call("rack", rack_desc)
20+
gem "rails", version_spec.call("rails", rails_desc)
21+
end
22+
end
23+
end
1924
end
20-
21-
appraise "rails71" do
22-
gem "rails", "~> 7.1.0"
23-
end
24-
25-
appraise "rails72" do
26-
gem "rails", "~> 7.2.0"
27-
end
28-
29-
appraise "rails80" do
30-
gem "rails", "~> 8.0.0"
31-
end

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ group :default do
44
if rack_version = ENV['RACK_VERSION']
55
gem 'rack', rack_version
66
else
7-
gem 'rack', '~> 2.2'
7+
gem 'rack', '~> 2.2.0'
88
end
99
end
1010

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ GEM
2020
rspec-mocks (3.13.5)
2121
diff-lcs (>= 1.2.0, < 2.0)
2222
rspec-support (~> 3.13.0)
23-
rspec-support (3.13.4)
23+
rspec-support (3.13.5)
2424
thor (1.4.0)
2525

2626
PLATFORMS
@@ -32,6 +32,6 @@ PLATFORMS
3232

3333
DEPENDENCIES
3434
appraisal
35-
rack (~> 2.2)
35+
rack (~> 2.2.0)
3636
rake (~> 13.3)
3737
rspec

History.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
- Drop unnecessary `jruby.compat.version` and `RackConfig.getCompatVersion()` API
77
- Drop JMS support
88
- Drop deprecated `RackLogger` string (level) constants
9-
- Drop `jruby.rack.jruby.version` and `jruby.rack.rack.release` keys from rack `env` Hhsh
9+
- Drop `jruby.rack.jruby.version` and `jruby.rack.rack.release` keys from rack `env` Hash
10+
- Drop deprecated `Rack::Handler::Servlet::Env` and `Rack::Handler::Servlet::LazyEnv` types (replaced by `DefaultEnv`)
11+
- Drop undocumented and deprecated jruby-rack 1.0 backwards compat properties `jruby.runtime.timeout.sec`, `jruby.runtime.initializer.threads`, `jruby.init.serial`, `jruby.rack.request.size.threshold.bytes`
12+
- Drop deprecated `jruby.rack.ignore.env` property, replaced long ago by `jruby.runtime.env` and optional `jruby.runtime.env.rubyopt`
13+
- Drop deprecated `jruby.rack.filter.*` properties, replaced long ago by init parameters `addsHtmlToPathInfo` and `verifiesHtmlResource`
14+
- Drop deprecated `JRuby::Rack::RailsFileSystemLayout` alias for `JRuby::Rack::FileSystemLayout`
15+
- Drop deprecated `JRuby::Rack::Errors` alias for `JRuby::Rack::ErrorApp`
16+
- Drop deprecated `org.jruby.rack.RackInput` alias for `org.jruby.rack.ext.Input` class
17+
- Drop/rename deprecated `RackConfig` and `ServletRackEnvironment` API methods per their earlier comments
1018
- Change context listener to throw, in case of an exception during initialization, by default
1119
- Change rails context listener to assume a thread-safe application by default
12-
- update (bundled) rack to 2.2.17
13-
- Fix Rails 7.1 CSRF protection when working with `JavaServletStore` sessions
1420

15-
## 1.2.4 (UNRELEASED)
21+
## 1.2.4
1622

1723
- update (bundled) rack to 2.2.17
1824
- Fix Rails 7.1 CSRF protection when working with `JavaServletStore` sessions
@@ -173,9 +179,9 @@ Changes from 1.1.15 apply since the previous release got yanked due a regression
173179
to handle custom lazy-bound keys but can not use a default proc (#132)
174180
- support the renew (and skip) session option with servlet store (#131)
175181
- improve ENV isolation with booted Ruby runtimes
176-
* jruby.rack.env replaces jruby.rack.ignore.env (now deprecated)
182+
* jruby.runtime.env replaces jruby.rack.ignore.env (now deprecated)
177183
* make sure RUBYOPT is ignored (with backwards compat)
178-
* jruby.rack.env.rubyopt for finer RUBYOPT behavior control
184+
* jruby.runtime.env.rubyopt for finer RUBYOPT behavior control
179185
* allow env value to be specified from config
180186
- solve the rackup "chicken - egg" problem with a plain Rack app
181187
* with a magic comment in config.ru # rack.version: ~>1.3.6

README.md

Lines changed: 39 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# JRuby-Rack
22

3-
[![Gem Version](https://badge.fury.io/rb/jruby-rack.png)][8]
4-
[![Build Status](https://github.com/jruby/jruby-rack/actions/workflows/maven.yml/badge.svg)][9]
3+
[![Gem Version](https://badge.fury.io/rb/jruby-rack.png)][5]
4+
[![Build Status](https://github.com/jruby/jruby-rack/actions/workflows/maven.yml/badge.svg)][6]
55

66
JRuby-Rack is a lightweight adapter for the Java Servlet environment that allows
77
any (Ruby) Rack-based application to run unmodified in a Java Servlet container.
@@ -28,12 +28,13 @@ dependencies {
2828

2929
## Compatibility
3030

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. |
31+
| JRuby-Rack Series | Status | Rack | JRuby | Java | Rails | Target Servlet API | Notes |
32+
|------------------------------------------------------------|------------|-----------|------------|------|-----------|---------------------|--------------------------------------------|
33+
| 2.0 (_planned_) | Dev | 2.2 | 9.4 → 10.0 | 8+ | 5.0 → 8.0 | 5.0+ (Jakarta EE 9) | Pre 5.0 servlet APIs non functional. |
34+
| 1.3 (master, _unreleased_) | Dev | 2.2 | 9.4 → 10.0 | 8+ | 5.0 → 8.0 | 4.0 (Java EE 8) | Servlet 2.5 → 3.1 likely to work fine. |
35+
| [1.2](https://github.com/jruby/jruby-rack/tree/1.2-stable) | Maintained | 2.2 | 9.3 → 9.4 | 8+ | 5.0 → 7.2 | 3.0 (Java EE 6) | Servlet 3.1 → 4.0 OK with some containers. |
36+
| [1.1](https://github.com/jruby/jruby-rack/tree/1.1-stable) | EOL | 1.x → 2.2 | 1.6 → 9.4 | 6+ | 2.1 → 5.2 | 2.5 (Java EE 5) | Servlet 3.0 → 4.0 OK with some containers. |
37+
| 1.0 | EOL | 0.9 → 1.x | 1.1 → 1.9 | 5+ | 2.1 → 3.x | 2.5 (Java EE 5) | |
3738

3839
## Getting Started
3940

@@ -52,9 +53,6 @@ Otherwise you'll need to download the latest [jar release][2], drop it into the
5253
*WEB-INF/lib* directory and configure the `RackFilter` in your application's
5354
*web.xml* (see following examples).
5455

55-
Alternatively you can use a server built upon JRuby-Rack such as [Trinidad][3]
56-
with sensible defaults, without the need to configure a deployment descriptor.
57-
5856
### Rails
5957

6058
Here's sample *web.xml* configuration for Rails. Note the environment and
@@ -161,9 +159,14 @@ using is `org.jruby.rack.RackFilter`, the filter supports the following
161159
gets reset (accepts values "true", "false" and "buffer" to reset the buffer
162160
only), by default "true"
163161
- **addsHtmlToPathInfo** controls whether the .html suffix is added to the URI
164-
when checking if the request is for a static page
162+
when checking if the request is for a static page. The default behavior for
163+
Rails and many other Ruby applications is to add an *.html* extension to the
164+
resource and attempt to handle it before serving a dynamic request on the
165+
original URI. However, this behavior may confuse other servlets in your
166+
application that have a wildcard mapping. Defaults to true.
165167
- **verifiesHtmlResource** used with the previous parameter to make sure the
166-
requested static resource exists before adding the .html request URI suffix
168+
requested static resource exists before adding the .html request URI suffix.
169+
Defaults to false.
167170

168171
The application can also be configured to dispatch through a servlet instead of
169172
a filter, the servlet class name is `org.jruby.rack.RackServlet`.
@@ -192,11 +195,11 @@ Several aspects of Rails are automatically set up for you.
192195
## JRuby Runtime Management
193196

194197
JRuby runtime management and pooling is done automatically by the framework.
195-
In the case of Rails, runtimes are pooled by default (the default will most
196-
likely change with the adoption of Rails 4.0). For other Rack applications a
197-
single shared runtime is created and shared for every request by default.
198-
As of **1.1.9** if *jruby.min.runtimes* and *jruby.max.runtimes* values are
199-
specified pooling is supported for plain Rack applications as well.
198+
For Rack-only applications (and Rails ones from jruby-rack >= 1.3), a single
199+
shared runtime is created and shared for every request by default.
200+
201+
If *jruby.min.runtimes* and *jruby.max.runtimes* values are
202+
specified pooling of runtimes can be enabled for both types of applications.
200203

201204
We do recommend to boot your runtimes up-front to avoid the cost of initializing
202205
one while a request kicks in and find the pool empty, this can be easily avoided
@@ -241,10 +244,9 @@ as context init parameters in web.xml or as VM-wide system properties.
241244
- `jruby.runtime.env`: Allows to set a custom ENV hash for your Ruby environment
242245
and thus insulate the application from the environment it is running. By setting
243246
this option to en empty string (or 'false') it acts as if the ENV hash was
244-
cleared out (similar to the now deprecated `jruby.rack.ignore.env` option).
245-
- `jruby.runtime.env.rubyopt`: This option is used for compatibility with the
246-
(deprecated) `jruby.rack.ignore.env` option since it cleared out the ENV after
247-
RUBYOPT has been processed, by setting it to true ENV['RUBYOPT'] will be kept.
247+
cleared out (similar to the now removed `jruby.rack.ignore.env` option).
248+
- `jruby.runtime.env.rubyopt`: Set to true to cause ENV['RUBYOPT']
249+
to be retained even when using `jruby.runtime.env` to override environemnt (similar to how the removed `jruby.rack.ignore.env` option behaved by default).
248250
- `jruby.rack.logging`: Specify the logging device to use. Defaults to
249251
`servlet_context`. See below.
250252
- `jruby.rack.request.size.initial.bytes`: Initial size for request body memory
@@ -263,20 +265,6 @@ as context init parameters in web.xml or as VM-wide system properties.
263265
been previously read this leads to a limitation (Rack won't see the POST paras).
264266
Thus an alternate pure 'servlet' env "conversion" is provided that maps servlet
265267
parameters (and cookies) directly to Rack params, avoiding Rack's input parsing.
266-
- `jruby.rack.filter.adds.html`:
267-
**deprecated** use `addsHtmlToPathInfo` filter config init parameter.
268-
The default behavior for Rails and many other Ruby applications is to add an
269-
*.html* extension to the resource and attempt to handle it before serving a
270-
dynamic request on the original URI.
271-
However, this behavior may confuse other servlets in your application that
272-
have a wildcard mapping. Defaults to true.
273-
- `jruby.rack.filter.verify.resource.exists`:
274-
**deprecated** use `verifiesHtmlResource` filter config init parameter.
275-
If `jruby.rack.filter.adds.html` is true, then this setting, when true, adds
276-
an additional check using `ServletContext#getResource` to verify that the
277-
*.html* resource exists. Default is false.
278-
(Note that apparently some servers may not implement `getResource` in the way
279-
that is expected here, so in that case this setting won't matter.)
280268

281269
## Initialization
282270

@@ -331,17 +319,16 @@ For those loggers that require a specific named logger, set it with the
331319
Checkout the JRuby-Rack code using [git](http://git-scm.com/) :
332320

333321
```shell
334-
git clone git://github.com/jruby/jruby-rack.git
322+
git clone git@github.com:jruby/jruby-rack.git
335323
cd jruby-rack
336324
```
337325

338-
Ensure you have [Maven](http://maven.apache.org/) installed.
339-
It is required for downloading jar artifacts that JRuby-Rack depends on.
326+
Ensure you have a compatible JVM installed. It is required for building and compiling.
340327

341328
Build the .jar using Maven :
342329

343330
```shell
344-
mvn install
331+
./mvnw install
345332
```
346333

347334
the generated jar should be located at **target/jruby-rack-*.jar**
@@ -359,21 +346,20 @@ package and push the .jar every time a commit changes a source file).
359346

360347
## Releasing
361348

362-
* Make sure auth is configured for "central" repository ID in your .m2/settings.xml
363-
* Update the version in src/main/ruby/jruby/rack/version.rb to the release version
364-
* mvn release:prepare
365-
* mvn release:perform (possibly with -DuseReleaseProfile=false due to Javadoc doclint failures for now)
366-
* rake clean gem SKIP_SPECS=true and push the gem
349+
* Make sure auth is configured for "central" repository ID in your `.m2/settings.xml`
350+
* Update the version in `src/main/ruby/jruby/rack/version.rb` to the release version
351+
* `./mvnw release:prepare`
352+
* `./mvnw release:perform` (possibly with `-DuseReleaseProfile=false` due to Javadoc doclint failures for now)
353+
* `rake clean gem SKIP_SPECS=true` and push the gem
367354

368355
## Support
369356

370-
Please use [github][4] to file bugs, patches and/or pull requests.
371-
More information at the [wiki][5] or ask us at **#jruby**'s IRC channel.
357+
Please use [github][3] to file bugs, patches and/or pull requests.
358+
More information at the [wiki][4] or ask us at **#jruby**'s IRC channel.
372359

373360
[1]: https://github.com/jruby/warbler#warbler--
374-
[2]: https://oss.sonatype.org/content/repositories/releases/org/jruby/rack/jruby-rack/
375-
[3]: https://github.com/trinidad/trinidad
376-
[4]: https://github.com/jruby/jruby-rack/issues
377-
[5]: https://wiki.github.com/jruby/jruby-rack
378-
[8]: http://badge.fury.io/rb/jruby-rack
379-
[9]: https://github.com/jruby/jruby-rack/actions/workflows/maven.yml
361+
[2]: https://central.sonatype.com/artifact/org.jruby.rack/jruby-rack
362+
[3]: https://github.com/jruby/jruby-rack/issues
363+
[4]: https://github.com/jruby/jruby-rack/wiki
364+
[5]: http://badge.fury.io/rb/jruby-rack
365+
[6]: https://github.com/jruby/jruby-rack/actions/workflows/maven.yml

0 commit comments

Comments
 (0)