Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
jruby_version: [ '10.0.6.0', '10.1.1.0' ]
java_version: [ '21', '25' ]
rack_version: [ '~> 2.2.0' ]
rack_version: [ '~> 2.2.0', '~> 3.1.0', '~> 3.2.0' ]
fail-fast: false

steps:
Expand Down Expand Up @@ -52,8 +52,9 @@ jobs:
strategy:
matrix:
appraisal: [
'rails72_rack22',
'rails80_rack22',
'rails72_rack22', 'rails72_rack31',
'rails80_rack22', 'rails80_rack31', 'rails80_rack32',
'rails81_rack31', 'rails81_rack32',
]
jruby_version: [ '10.0.6.0', '10.1.1.0' ]
java_version: [ '21', '25' ]
Expand Down
5 changes: 3 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ version_spec = ->(prefix, desc) { "~> #{major_minor.call(prefix, desc)}.0" }
# Rails version -> rack versions in format
# rails#{MAJOR}#{MINOR} => %w[ rack#{MAJOR}#{MINOR} ]
{
"rails72" => {racks: %w[rack22]},
"rails80" => {racks: %w[rack22]}
"rails72" => {racks: %w[rack22 rack31]},
"rails80" => {racks: %w[rack22 rack31 rack32]},
"rails81" => {racks: %w[rack31 rack32]}
}.each do |rails_desc, c|
c[:racks].each do |rack_desc|

Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 1.3.1 (UNRELEASED)

- feat: support Rack 3.0 -> 3.2
- `org.jruby.rack.RackEnvironment` gained a `getProtocol()` method (backing the Rack 3.x required `SERVER_PROTOCOL`
Rack env key); custom implementations not extending the servlet request wrapper need to implement it
- fix: correct opt-in `ServletEnv` charset mismapping when parsing query strings
- fix: ensure `rack.` internal headers are stripped in responses
- chore: remove ancient dead Rails 2-era adapter code
Expand All @@ -8,6 +11,9 @@
- fix: close the original body when ShowStatus replaces it
- fix: detect Transfer-Encoding/Content-Length headers case-insensitively
- chore: revert `rack.version` value to be Rack 2.2 spec conformant
- fix: handle Array response header values (Rack 3.x) for special-cased headers
- fix: join repeated request header values instead of only passing the first
- fix: do not mutate (potentially frozen) response header values when writing

## 1.3.0

Expand All @@ -17,7 +23,6 @@

For most users this should be a minor upgrade; as long as you do not depend on functionality deprecated within
JRuby-Rack 1.2.x, EOL JRuby or EOL Rails versions.

Breaking compatibility changes
- Drop support for JRuby 9.x (and thus Java < 21)
- Drop support for Rails < 7.2
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For more information on Rack, visit http://rack.github.io/.

| JRuby-Rack Series | Status | Rack | JRuby | Java | Rails | Servlet API (min → mostly supported) | Notes |
|----------------------------------------------------------------|---------------|-----------|-------------|------|-----------|--------------------------------------|-----------------------------------------------------------|
| [**1.3**](https://github.com/jruby/jruby-rack/tree/1.3-stable) | Maintained | 2.2 | 10.0 → 10.1 | 21+ | 7.2 → 8.0 | 4.0 (Java EE 8) | ✅ _Unofficial_: Rails 6.1 → 7.1 untested, but likely OK. |
| [**1.3**](https://github.com/jruby/jruby-rack/tree/1.3-stable) | Maintained | 2.2 → 3.2 | 10.0 → 10.1 | 21+ | 7.2 → 8.1 | 4.0 (Java EE 8) | ✅ _Unofficial_: Rails 6.1 → 7.1 untested, but likely OK. |
| [**1.2**](https://github.com/jruby/jruby-rack/tree/1.2-stable) | EOL @ 2026-09 | 2.2 | 9.3 → 10.1 | 8+ | 5.0 → 8.0 | 3.0 → 4.0 (Java EE 6 → 7) | |
| [**1.1**](https://github.com/jruby/jruby-rack/tree/1.1-stable) | EOL @ 2024-05 | 1.x → 2.2 | 1.6 → 9.4 | 6+ | 2.1 → 5.2 | 2.5 → 4.0 (Java EE 5 → 7) | |
| [**1.0**](https://github.com/jruby/jruby-rack/tree/1.0.10) | EOL @ 2011-11 | 0.9 → 1.x | 1.1 → 1.9 | 5+ | 2.1 → 3.x | 2.5 (Java EE 5) | |
Expand Down Expand Up @@ -169,6 +169,9 @@ a filter, the servlet class name is `org.jruby.rack.RackServlet`.
- servlet sessions can be used as a (java) session store for Rails, session
attributes with String keys (and String, numeric, boolean, or java
object values) are automatically copied to the servlet session for you.
Note: on Rack 3.x the servlet session store relies on the `rack-session`
gem - Rails depends on it transitively, but plain Rack applications
configuring `java_servlet_store` need to add it to their Gemfile.

## Rails

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ task :gem => [:clean, target_jar, target_jruby_rack, target_jruby_rack_version]
gem.files = FileList["./**/*"].exclude("*.gem").map{ |f| f.sub(/^\.\//, '') }
gem.homepage = %q{http://jruby.org}
gem.required_ruby_version = '>= 3.4.0' # JRuby >= 10.0
gem.add_dependency 'rack', '~> 2.2.0'
gem.add_dependency 'rack', '>= 2.2.0', '< 4'
end

require 'rubygems/package'
Expand Down
37 changes: 19 additions & 18 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ As an executable jar within Jetty:

## Demo routes

| Example | Component | Embedded Route | Deployed War Route |
|---------|------------------------|-------------------------------------|---------------------------------------------|
| Rails 7 | Status Page | http://localhost:8080/up | http://localhost:8080/rails7/up |
| Rails 7 | Snoop Dump | http://localhost:8989/snoop | http://localhost:8080/rails7/snoop |
| Rails 7 | Simple Form submission | http://localhost:8989/simple_form | http://localhost:8080/rails7/simple_form |
| Rails 7 | Body Posts | http://localhost:8989/body | http://localhost:8080/rails7/body |
| Rails 7 | JSP (render) | http://localhost:8989/jsp/ | http://localhost:8080/rails7/jsp/ |
| Rails 7 | JSP (forward to) | http://localhost:8989/jsp-forward/ | http://localhost:8080/rails7/jsp-forward/ |
| Rails 7 | JSP (include) | http://localhost:8989/jsp-include/ | http://localhost:8080/rails7/jsp-include/ |
| Sinatra | Demo Index | http://localhost:8989/ | http://localhost:8080/sinatra |
| Sinatra | Info | http://localhost:8989/info | http://localhost:8080/sinatra/info |
| Sinatra | Snoop Dump | http://localhost:8989/env | http://localhost:8080/sinatra/env |
| Sinatra | JSP (render) | http://localhost:8989/jsp/index.jsp | http://localhost:8080/sinatra/jsp/index.jsp |
| Sinatra | JSP (forward to) | http://localhost:8989/jsp_forward | http://localhost:8080/sinatra/jsp_forward |
| Sinatra | JSP (include) | http://localhost:8989/jsp_include | http://localhost:8080/sinatra/jsp_include |
| Sinatra | Streaming Demo | http://localhost:8989/stream | http://localhost:8080/sinatra/stream |
| Camping | Demo Index | http://localhost:8989/ | http://localhost:8080/camping |
| Camping | Snoop Dump | http://localhost:8989/snoop | http://localhost:8080/camping/snoop |
| Example | Component | Embedded Route | Deployed War Route |
|---------|---------------------------|-------------------------------------|---------------------------------------------|
| Rails 8 | Status Page | http://localhost:8080/up | http://localhost:8080/rails8/up |
| Rails 8 | Snoop Dump | http://localhost:8989/snoop | http://localhost:8080/rails8/snoop |
| Rails 8 | Simple Form submission | http://localhost:8989/simple_form | http://localhost:8080/rails8/simple_form |
| Rails 8 | Body Posts | http://localhost:8989/body | http://localhost:8080/rails8/body |
| Rails 8 | JSP (render) | http://localhost:8989/jsp/ | http://localhost:8080/rails8/jsp/ |
| Rails 8 | JSP (forward to) | http://localhost:8989/jsp-forward/ | http://localhost:8080/rails8/jsp-forward/ |
| Rails 8 | JSP (include) | http://localhost:8989/jsp-include/ | http://localhost:8080/rails8/jsp-include/ |
| Sinatra | Demo Index | http://localhost:8989/ | http://localhost:8080/sinatra |
| Sinatra | Info | http://localhost:8989/info | http://localhost:8080/sinatra/info |
| Sinatra | Snoop Dump | http://localhost:8989/env | http://localhost:8080/sinatra/env |
| Sinatra | JSP (render) | http://localhost:8989/jsp/index.jsp | http://localhost:8080/sinatra/jsp/index.jsp |
| Sinatra | JSP (forward to) | http://localhost:8989/jsp_forward | http://localhost:8080/sinatra/jsp_forward |
| Sinatra | JSP (include) | http://localhost:8989/jsp_include | http://localhost:8080/sinatra/jsp_include |
| Sinatra | Streaming Enumerable Demo | http://localhost:8989/stream | http://localhost:8080/sinatra/stream |
| Sinatra | Streaming Proc Demo | http://localhost:8989/stream_call | http://localhost:8080/sinatra/stream_call |
| Camping | Demo Index | http://localhost:8989/ | http://localhost:8080/camping |
| Camping | Snoop Dump | http://localhost:8989/snoop | http://localhost:8080/camping/snoop |

## Development

Expand Down
3 changes: 2 additions & 1 deletion examples/camping/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ source 'https://rubygems.org'

ruby RUBY_VERSION

gem 'camping', '< 3' # v3 requires Rack 3.x support
gem 'camping', '< 4'
gem 'rack', '~> 3.2.0'

group :development do
gem 'jruby-jars', JRUBY_VERSION
Expand Down
2 changes: 2 additions & 0 deletions examples/camping/lib/demo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ def snoop
div { dl_hash(@snoop) }
end
end

Camping.make_camp
79 changes: 0 additions & 79 deletions examples/rails7/config/environments/production.rb

This file was deleted.

13 changes: 0 additions & 13 deletions examples/rails7/config/initializers/permissions_policy.rb

This file was deleted.

1 change: 0 additions & 1 deletion examples/rails7/config/master.key

This file was deleted.

34 changes: 0 additions & 34 deletions examples/rails7/config/puma.rb

This file was deleted.

File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion examples/rails7/Gemfile → examples/rails8/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ source 'https://rubygems.org'

ruby RUBY_VERSION

gem 'rails', '~> 7.2.0'
gem 'rails', '~> 8.1.0'
gem 'rack', '~> 3.2.0'
gem 'sprockets-rails'
gem 'json', '< 3' # ActiveSupport 8.1 not compatible with json 3 yet.

group :development do
gem 'jruby-jars', JRUBY_VERSION
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def index
private
def body_size
bytes = 0
request.body.rewind # Need to rewind to re-read body with Rack 3 - and rewindable bodies are not mandatory...
while str = request.body.read(1024)
bytes += str.size
end
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Rails7
module Rails81
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.2
config.load_defaults 8.1

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
# Make code changes take effect immediately without server restart.
config.enable_reloading = true

# Do not eager load code on boot.
Expand All @@ -17,32 +15,22 @@
# Enable server timing.
config.server_timing = true

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
# Run rails dev:cache to toggle Action Controller caching.
if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true

config.cache_store = :memory_store
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
else
config.action_controller.perform_caching = false

config.cache_store = :null_store
end

# Change to :null_store to avoid any caching.
config.cache_store = :memory_store

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise

# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []

# Suppress logger output for asset requests.
config.assets.quiet = true

# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true

Expand Down
Loading
Loading