Skip to content

Commit 9c03176

Browse files
committed
Merge remote-tracking branch 'upstream/master' into jakarta-update
# Conflicts: # .github/workflows/maven.yml # README.md # src/main/java/org/jruby/rack/UnmappedRackFilter.java # src/main/java/org/jruby/rack/servlet/ResponseCapture.java # src/spec/ruby/spec_helper.rb
2 parents 3182a7f + d9b0b55 commit 9c03176

File tree

139 files changed

+960
-9612
lines changed

Some content is hidden

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

139 files changed

+960
-9612
lines changed

.github/workflows/maven.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
jruby_version: [ '9.4.13.0', '10.0.0.1' ]
21+
jruby_version: [ '9.4.13.0', '10.0.1.0' ]
2222
java_version: [ '17', '21' ]
2323
exclude:
24-
- jruby_version: '10.0.0.1'
24+
- jruby_version: '10.0.1.0'
2525
java_version: '17' # JRuby 10 requires Java 21
2626
fail-fast: false
2727

@@ -36,12 +36,12 @@ jobs:
3636
cache: maven
3737

3838
- name: Build with Maven
39-
run: mvn -B install -Djruby.version=${{ matrix.jruby_version }}
39+
run: ./mvnw -B install -Djruby.version=${{ matrix.jruby_version }}
4040

4141
# Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
4242
- name: Update dependency graph
4343
uses: advanced-security/maven-dependency-submission-action@b275d12641ac2d2108b2cbb7598b154ad2f2cee8 # v5.0.0
44-
if: github.head_ref == 'refs/heads/master' && matrix.java_version == env.DEFAULT_JAVA_VERSION && matrix.jruby_version == env.DEFAULT_JRUBY_VERSION
44+
if: github.ref == 'refs/heads/master' && matrix.java_version == env.DEFAULT_JAVA_VERSION && matrix.jruby_version == env.DEFAULT_JRUBY_VERSION
4545

4646
appraisals:
4747
needs: build
@@ -50,13 +50,13 @@ jobs:
5050

5151
strategy:
5252
matrix:
53-
jruby_version: [ '9.4.13.0', '10.0.0.1' ]
53+
jruby_version: [ '9.4.13.0', '10.0.1.0' ]
5454
java_version: [ '17', '21' ]
5555
appraisal: [ 'rails50', 'rails52', 'rails60', 'rails61', 'rails70', 'rails71', 'rails72', 'rails80' ]
5656
exclude:
5757
- jruby_version: '9.4.13.0'
5858
appraisal: 'rails80' # Requires Ruby 3.4 compatibility, which JRuby 9.4 does not support
59-
- jruby_version: '10.0.0.1'
59+
- jruby_version: '10.0.1.0'
6060
java_version: '17' # JRuby 10 requires Java 21
6161
fail-fast: false
6262

@@ -75,7 +75,7 @@ jobs:
7575
cache: maven
7676

7777
- name: Setup JRuby
78-
uses: ruby/setup-ruby@472790540115ce5bd69d399a020189a8c87d641f # v1.247.0
78+
uses: ruby/setup-ruby@2a7b30092b0caf9c046252510f9273b4875f3db9 # v1.254.0
7979
with:
8080
ruby-version: jruby-${{ matrix.jruby_version }}
8181
bundler-cache: 'false' # Need to install later so we can vary from Gemfile.lock as required for JRuby version compatibility
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

Gemfile.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,3 @@ DEPENDENCIES
3434
rack (~> 2.2)
3535
rake (~> 13.3)
3636
rspec
37-
38-
BUNDLED WITH
39-
2.6.3

README.md

Lines changed: 95 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,22 @@
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]
5+
36
JRuby-Rack is a lightweight adapter for the Java Servlet environment that allows
47
any (Ruby) Rack-based application to run unmodified in a Java Servlet container.
58
JRuby-Rack supports Rails as well as any Rack-compatible Ruby web framework.
69

710
For more information on Rack, visit http://rack.github.io/.
811

9-
**This README (master) targets JRuby-Rack 1.3. Please use the
10-
[1.1-stable](https://github.com/jruby/jruby-rack/tree/1.1-stable) branch for
11-
current stable 1.1.x releases.**
12-
13-
[![Gem Version](https://badge.fury.io/rb/jruby-rack.png)][8]
14-
[![Build Status](https://github.com/jruby/jruby-rack/actions/workflows/maven.yml/badge.svg)][9]
15-
1612
## Compatibility
1713

18-
JRuby-Rack 1.4.x
19-
- aims to be compatible with JRuby 9.4 -> 10.0 and Java 17+
20-
- supports any container compatible with Jakarta Servlet 5.0 API (JEE 9)
21-
22-
JRuby-Rack 1.3.x
23-
- aims to be compatible with JRuby 9.4 -> 10.0 and Java 11+
24-
- supports any container compatible with Java Servlet 4.0 API
25-
26-
JRuby-Rack 1.2.x
27-
- compatible with JRuby 9.3 -> 9.4 and their supported JDK versions
28-
- supports any container compatible with Java Servlet 3.0 API
29-
30-
JRuby-Rack 1.1.x
31-
- aims to be compatible with JRuby >= 1.6.4 (used successfully through JRuby 9.4)
32-
- supports any container compatible with Java Servlet 2.5 API (JEE 5)
33-
14+
| JRuby-Rack Version | Status | JRuby Compat | Java Compat | Target Servlet API | Target Java EE | Notes |
15+
|--------------------------------------------------------------|------------|--------------|-------------|--------------------|----------------|---------------------------------------------------|
16+
| 1.4.x (_planned_) | Dev | 9.4 → 10.0 | Java 17+ | 5.0 | Jakarta EE 9 | |
17+
| 1.3.x (master, _unreleased_) | Dev | 9.4 → 10.0 | Java 11+ | 4.0 | Java EE 8 | |
18+
| [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. |
19+
| [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. |
3420

3521
## Getting Started
3622

@@ -59,79 +45,85 @@ min/max runtime parameters. For **multi-threaded** (a.k.a. `threadsafe!`)
5945
Rails with a single runtime, set min/max both to 1. Otherwise, define the size
6046
of the runtime pool as you wish.
6147

62-
<context-param>
63-
<param-name>rails.env</param-name>
64-
<param-value>production</param-value>
65-
</context-param>
66-
<context-param>
67-
<param-name>jruby.min.runtimes</param-name>
68-
<param-value>1</param-value>
69-
</context-param>
70-
<context-param>
71-
<param-name>jruby.max.runtimes</param-name>
72-
<param-value>1</param-value>
73-
</context-param>
74-
75-
<filter>
76-
<filter-name>RackFilter</filter-name>
77-
<filter-class>org.jruby.rack.RackFilter</filter-class>
78-
<!-- optional filter configuration init-params : -->
79-
<init-param>
80-
<param-name>resetUnhandledResponse</param-name>
81-
<param-value>true</param-value> <!-- true (default), false or buffer -->
82-
</init-param>
83-
<init-param>
84-
<param-name>addsHtmlToPathInfo</param-name>
85-
<param-value>true</param-value> <!-- true (default), false -->
86-
</init-param>
87-
<init-param>
88-
<param-name>verifiesHtmlResource</param-name>
89-
<param-value>false</param-value> <!-- true, false (default) -->
90-
</init-param>
91-
</filter>
92-
<filter-mapping>
93-
<filter-name>RackFilter</filter-name>
94-
<url-pattern>/*</url-pattern>
95-
</filter-mapping>
96-
97-
<listener>
98-
<listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
99-
</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+
```
10088

10189
### (Other) Rack Applications
10290

10391
The main difference when using a non-Rails Rack application is that JRuby-Rack
10492
looks for a "rackup" file named **config.ru** in `WEB-INF/config.ru` or
10593
`WEB-INF/*/config.ru`. Here's a sample *web.xml* configuration :
10694

107-
<filter>
108-
<filter-name>RackFilter</filter-name>
109-
<filter-class>org.jruby.rack.RackFilter</filter-class>
110-
<!-- optional filter configuration init-params (@see above) -->
111-
</filter>
112-
<filter-mapping>
113-
<filter-name>RackFilter</filter-name>
114-
<url-pattern>/*</url-pattern>
115-
</filter-mapping>
116-
117-
<listener>
118-
<listener-class>org.jruby.rack.RackServletContextListener</listener-class>
119-
</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+
```
120110

121111
If you don't have a *config.ru* or don't want to include it in your web app, you
122112
can embed it directly in the *web.xml* as follows (using Sinatra as an example):
123113

124-
<context-param>
125-
<param-name>rackup</param-name>
126-
<param-value>
127-
require 'rubygems'
128-
gem 'sinatra', '~&gt; 1.3'
129-
require './lib/app'
130-
set :run, false
131-
set :environment, :production
132-
run Sinatra::Application
133-
</param-value>
134-
</context-param>
114+
```xml
115+
<context-param>
116+
<param-name>rackup</param-name>
117+
<param-value>
118+
require 'rubygems'
119+
gem 'sinatra', '~&gt; 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+
```
135127

136128
Be sure to escape angle-brackets for XML !
137129

@@ -285,13 +277,16 @@ provided *config.ru* the bundled (latest) version of Rack will get loaded.
285277

286278
Use **rack.version** to specify the Rack gem version to be loaded before rackup :
287279

288-
# encoding: UTF-8
289-
# 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+
```
290284

291285
Or the equivalent of doing `bundle exec rackup ...` if you're using Bundler :
292286

293-
# rack.version: bundler (requires 'bundler/setup' before loading the script)
294-
287+
```ruby
288+
# rack.version: bundler (requires 'bundler/setup' before loading the script)
289+
```
295290

296291
## Logging
297292

@@ -318,21 +313,27 @@ For those loggers that require a specific named logger, set it with the
318313

319314
Checkout the JRuby-Rack code using [git](http://git-scm.com/) :
320315

321-
git clone git://github.com/jruby/jruby-rack.git
322-
cd jruby-rack
316+
```shell
317+
git clone git://github.com/jruby/jruby-rack.git
318+
cd jruby-rack
319+
```
323320

324321
Ensure you have [Maven](http://maven.apache.org/) installed.
325322
It is required for downloading jar artifacts that JRuby-Rack depends on.
326323

327324
Build the .jar using Maven :
328325

329-
mvn install
326+
```shell
327+
mvn install
328+
```
330329

331330
the generated jar should be located at **target/jruby-rack-*.jar**
332331

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

335-
jruby -S rake clean gem SKIP_SPECS=true
334+
```shell
335+
jruby -S rake clean gem SKIP_SPECS=true
336+
```
336337

337338
You can **not** use JRuby-Rack with Bundler directly from the git (or http) URL
338339
(`gem 'jruby-rack', :github => 'jruby/jruby-rack'`) since the included .jar file
@@ -341,7 +342,7 @@ package and push the .jar every time a commit changes a source file).
341342

342343
## Releasing
343344

344-
* Make sure auth is configured for "ossrh" repository ID in your .m2/settings.xml
345+
* Make sure auth is configured for "central" repository ID in your .m2/settings.xml
345346
* Update the version in src/main/ruby/jruby/rack/version.rb to the release version
346347
* mvn release:prepare
347348
* mvn release:perform (possibly with -DuseReleaseProfile=false due to Javadoc doclint failures for now)

Rakefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ directory 'target/classes'
3838

3939
desc "Compile classes"
4040
task(:compile => 'target/classes') do
41-
sh "mvn compile #{ENV['JRUBY_VERSION'] ? "-Djruby.version=#{ENV['JRUBY_VERSION']}" : ""}"
41+
sh "./mvnw compile #{ENV['JRUBY_VERSION'] ? "-Djruby.version=#{ENV['JRUBY_VERSION']}" : ""}"
4242
end
4343

4444
directory 'target/test-classes'
4545

4646
desc "Compile test classes"
4747
task(:test_prepare => ['target/classes', 'target/test-classes']) do
48-
sh "mvn test-compile #{ENV['JRUBY_VERSION'] ? "-Djruby.version=#{ENV['JRUBY_VERSION']}" : ""}"
48+
sh "./mvnw test-compile #{ENV['JRUBY_VERSION'] ? "-Djruby.version=#{ENV['JRUBY_VERSION']}" : ""}"
4949
end
5050

5151
desc "Unpack the rack gem"
@@ -98,7 +98,7 @@ task :test_resources => ["target/test-classes"]
9898
namespace :resources do
9999
desc "Copy (and generate) resources"
100100
task :copy => :resources do
101-
sh 'mvn process-resources -Dmdep.skip=true'
101+
sh './mvnw process-resources -Dmdep.skip=true'
102102
end
103103
desc "Generate test resources"
104104
task :test => :test_resources
@@ -208,7 +208,7 @@ task :release_checks do
208208
" git push origin :#{GEM_VERSION}" if ok
209209
end
210210

211-
pom_version = `mvn help:evaluate -Dexpression=project.version`.
211+
pom_version = `./mvnw help:evaluate -Dexpression=project.version`.
212212
split("\n").reject { |line| line =~ /[INFO]/ }.first.chomp
213213
if pom_version =~ /dev|SNAPSHOT/
214214
fail "Can't release a dev/snapshot version.\n" +
@@ -218,7 +218,7 @@ task :release_checks do
218218
unless pom_version.sub(/\-(\D+\w*)/, '.\1') == GEM_VERSION
219219
fail "Can't release because pom.xml version (#{pom_version}) is different than " +
220220
"jruby/rack/version.rb (#{GEM_VERSION}).\n" +
221-
"Please run `mvn install' to bring the two files in sync."
221+
"Please run `./mvnw install' to bring the two files in sync."
222222
end
223223

224224
puts "release #{GEM_VERSION} looks ready to go ..."
@@ -229,7 +229,7 @@ task :release => [:release_checks, :clean] do
229229
args = ''
230230
args << "-Dgpg.keyname=#{ENV['GPG_KEYNAME']} " if ENV['GPG_KEYNAME']
231231

232-
sh "mvn -Prelease #{args} -DupdateReleaseInfo=true clean deploy"
232+
sh "./mvnw -Prelease #{args} -DupdateReleaseInfo=true clean deploy"
233233

234234
sh "git tag #{GEM_VERSION}"
235235

0 commit comments

Comments
 (0)