Skip to content
Draft
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.0.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.0.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 @@ -3,8 +3,9 @@ version_spec = ->(prefix, desc) { "~> #{desc.split(prefix).last.insert(1, ".")}.
# Rails version -> rack versions in format
# rails#{MAJOR}#{MINOR} => %w[ rack#{MAJOR}#{MINOR} ]
{
"rails72" => %w[rack22],
"rails80" => %w[rack22]
"rails72" => %w[rack22 rack31],
"rails80" => %w[rack22 rack31 rack32],
"rails81" => %w[rack31 rack32],
}.each do |rails_desc, rack_descs|
rack_descs.each do |rack_desc|

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 1.3.0 (UNRELEASED)

- Officially support Javax Servlet API 4.0 (JEE 8)
- Support Rack 3.0 -> 3.2 (default vendored Rack is still 2.2)

Breaking compatibility changes
- Drop support for JRuby 9.x
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ For more information on Rack, visit http://rack.github.io/.

| JRuby-Rack Series | Status | Rack | JRuby | Java | Rails | Target Servlet API | Notes |
|----------------------------------------------------------------|---------------|-----------|-------------|------|-----------|---------------------|----------------------------------------------------------------|
| **2.0 (_planned_, _unreleased_)** | Dev | 2.2 | 10.0 → 10.1 | 8+ | 7.2 → 8.0 | 5.0+ (Jakarta EE 9) | ❌ Servlet < 5.0 containers will not work |
| **1.3 (master, _unreleased_)** | Dev | 2.2 | 10.0 → 10.1 | 8+ | 7.2 → 8.0 | 4.0 (Java EE 8) | ✅ _Unofficial_: Servlet 2.5 → 3.1 & Rails 6.1 likely working |
| **2.0 (_planned_, _unreleased_)** | Dev | 2.2 → 3.2 | 10.0 → 10.1 | 8+ | 7.2 → 8.1 | 5.0+ (Jakarta EE 9) | ❌ Servlet < 5.0 containers will not work |
| **1.3 (master, _unreleased_)** | Dev | 2.2 → 3.2 | 10.0 → 10.1 | 8+ | 7.2 → 8.1 | 4.0 (Java EE 8) | ✅ _Unofficial_: Servlet 2.5 → 3.1 & Rails 6.1 likely working |
| [**1.2**](https://github.com/jruby/jruby-rack/tree/1.2-stable) | Maintained | 2.2 | 9.3 → 10.1 | 8+ | 5.0 → 8.0 | 3.0 (Java EE 6) | ✅ _Unofficial_: Servlet 3.1 → 4.0 also OK with most containers |
| [**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 (Java EE 5) | ✅ _Unofficial_: Servlet 3.0 → 4.0 also OK with most containers |
| [**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 @@ -363,7 +363,7 @@ Releasing must be done by users authorized to push to the `org.jruby` group ID o
```shell
VERSION=rails72
cd src/spec/stub
rm -rf $VERSION && BUNDLE_GEMFILE=~/Projects/community/jruby-rack/gemfiles/${VERSION}_rack22.gemfile bundle exec rails new $VERSION --minimal --skip-git --skip-docker --skip-active-model --skip-active-record --skip-test --skip-system-test --skip-dev-gems --skip-bundle --skip-keeps --skip-asset-pipeline --skip-ci --skip-brakeman --skip-rubocop
rm -rf $VERSION && BUNDLE_GEMFILE=~/Projects/community/jruby-rack/gemfiles/${VERSION}_rack32.gemfile bundle exec rails new $VERSION --minimal --skip-git --skip-docker --skip-active-model --skip-active-record --skip-test --skip-system-test --skip-dev-gems --skip-bundle --skip-keeps --skip-asset-pipeline --skip-ci --skip-brakeman --skip-rubocop
```
* Manual changes to make to support testing
* In `config/production.rb` comment out the default `config.logger` value so jruby-rack applies its own `RailsLogger`.
Expand Down
16 changes: 8 additions & 8 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This directory includes samples using JRuby-Rack to build Rack web applications
into Java app servers.

- All use [Warbler](https://github.com/jruby/warbler) to do so for easy of packaging.
- Require JRuby `10.0` and a compatible JVM (Java `21` -> `25`).
- Require JRuby `10.x` and a compatible JVM (Java `21` -> `25`).

### Building/running

Expand All @@ -30,13 +30,13 @@ As an executable jar within Jetty:

| 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:8080/snoop | http://localhost:8080/rails7/snoop |
| Rails 7 | Simple Form submission | http://localhost:8080/simple_form | http://localhost:8080/rails7/simple_form |
| Rails 7 | Body Posts | http://localhost:8080/body | http://localhost:8080/rails7/body |
| Rails 7 | JSP (render) | http://localhost:8080/jsp/ | http://localhost:8080/rails7/jsp/ |
| Rails 7 | JSP (forward to) | http://localhost:8080/jsp-forward/ | http://localhost:8080/rails7/jsp-forward/ |
| Rails 7 | JSP (include) | http://localhost:8080/jsp-include/ | http://localhost:8080/rails7/jsp-include/ |
| Rails 8 | Status Page | http://localhost:8080/up | http://localhost:8080/rails7/up |
| Rails 8 | Snoop Dump | http://localhost:8080/snoop | http://localhost:8080/rails7/snoop |
| Rails 8 | Simple Form submission | http://localhost:8080/simple_form | http://localhost:8080/rails7/simple_form |
| Rails 8 | Body Posts | http://localhost:8080/body | http://localhost:8080/rails7/body |
| Rails 8 | JSP (render) | http://localhost:8080/jsp/ | http://localhost:8080/rails7/jsp/ |
| Rails 8 | JSP (forward to) | http://localhost:8080/jsp-forward/ | http://localhost:8080/rails7/jsp-forward/ |
| Rails 8 | JSP (include) | http://localhost:8080/jsp-include/ | http://localhost:8080/rails7/jsp-include/ |
| Sinatra | Demo Index | http://localhost:8080/ | http://localhost:8080/sinatra |
| Sinatra | Info | http://localhost:8080/info | http://localhost:8080/sinatra/info |
| Sinatra | Snoop Dump | http://localhost:8080/env | http://localhost:8080/sinatra/env |
Expand Down
2 changes: 1 addition & 1 deletion examples/camping/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
ruby RUBY_VERSION

gem 'camping', '< 3'
gem 'rack', '~> 2.2.0'
gem 'rack', '~> 3.2.0'

group :development do
if !ENV['WARBLER_SRC']; gem 'warbler' else gem 'warbler', path: '../../../warbler' end
Expand Down
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.
4 changes: 2 additions & 2 deletions examples/rails7/Gemfile → examples/rails8/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ source 'https://rubygems.org'

ruby RUBY_VERSION

gem 'rails', '~> 7.2.0'
gem 'rack', '~> 2.2.0'
gem 'rails', '~> 8.1.0'
gem 'rack', '~> 3.2.0'
gem 'sprockets-rails'

group :development do
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
73 changes: 73 additions & 0 deletions examples/rails8/config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
require "active_support/core_ext/integer/time"

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Code is not reloaded between requests.
config.enable_reloading = false

# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
config.eager_load = true

# Full error reports are disabled.
config.consider_all_requests_local = false

# Turn on fragment caching in view templates.
config.action_controller.perform_caching = true

# Cache digest stamped assets for far-future expiry.
# Short cache for others: robots.txt, sitemap.xml, 404.html, etc.
config.public_file_server.headers = {
"cache-control" => lambda do |path, _|
if path.start_with?("/assets/")
# Files in /assets/ are expected to be fully immutable.
# If the content change the URL too.
"public, immutable, max-age=#{1.year.to_i}"
else
# For anything else we cache for 1 minute.
"public, max-age=#{1.minute.to_i}, stale-while-revalidate=#{5.minutes.to_i}"
end
end
}

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"

# Assume all access to the app is happening through a SSL-terminating reverse proxy.
config.assume_ssl = false

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = false

# Skip http-to-https redirect for the default health check endpoint.
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }

# Log to STDOUT with the current request id as a default log tag.
config.log_tags = [ :request_id ]
# config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)

# Change to "debug" to log everything (including potentially personally-identifiable information!).
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")

# Prevent health checks from clogging up the logs.
config.silence_healthcheck_path = "/up"

# Don't log any deprecations.
config.active_support.report_deprecations = false

# Replace the default in-process memory cache store with a durable alternative.
# config.cache_store = :mem_cache_store

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true

# Enable DNS rebinding protection and other `Host` header attacks.
# config.hosts = [
# "example.com", # Allow requests from example.com
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
# ]
#
# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
end
Loading