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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.7 (UNRELEASED)

- Fix ability to include and forward to JSPs under Rails (#370)

## 1.2.6

- Add missing block-only signature for debug logging
Expand Down
31 changes: 18 additions & 13 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,24 @@ 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:8080/snoop | http://localhost:8080/rails7/snoop |
| Rails 7 | Embedded JSP (non-functional) | http://localhost:8080/jsp/ | http://localhost:8080/rails7/jsp/ |
| 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 |
| 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 |
| Sinatra | Streaming Demo | http://localhost:8080/stream | http://localhost:8080/sinatra/stream |
| Camping | Demo Index | http://localhost:8080/ | http://localhost:8080/camping |
| Camping | Snoop Dump | http://localhost:8080/snoop | http://localhost:8080/camping/snoop |
| 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/ |
| 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 |
| Sinatra | JSP (render) | http://localhost:8080/jsp/index.jsp | http://localhost:8080/sinatra/jsp/index.jsp |
| Sinatra | JSP (forward to) | http://localhost:8080/jsp_forward | http://localhost:8080/sinatra/jsp_forward |
| Sinatra | JSP (include) | http://localhost:8080/jsp_include | http://localhost:8080/sinatra/jsp_include |
| Sinatra | Streaming Demo | http://localhost:8080/stream | http://localhost:8080/sinatra/stream |
| Camping | Demo Index | http://localhost:8080/ | http://localhost:8080/camping |
| Camping | Snoop Dump | http://localhost:8080/snoop | http://localhost:8080/camping/snoop |

## Development

Expand Down
16 changes: 13 additions & 3 deletions src/main/ruby/jruby/rack/rack_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
module JRuby
module Rack
module RackExt
module Request
module RequestHelpers
java_import org.jruby.rack.servlet.ServletRackIncludedResponse

def forward_to(path, params={})
Expand All @@ -38,8 +38,18 @@ def render(path, params={})
end
end

::Rack::Request.module_eval do
include ::JRuby::Rack::RackExt::Request
if JRUBY_VERSION >= '9.4'
::Rack::Request::Helpers.module_eval do
include ::JRuby::Rack::RackExt::RequestHelpers
end
else
::Rack::Request.module_eval do
include ::JRuby::Rack::RackExt::RequestHelpers
end

::ActionDispatch::Request.module_eval do
include ::JRuby::Rack::RackExt::RequestHelpers
end if defined?(::ActionDispatch::Request)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/spec/ruby/jruby/rack/rack_ext_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require File.expand_path('spec_helper', File.dirname(__FILE__) + '/../..')
require 'jruby/rack/rack_ext'

describe Rack::Request do
describe JRuby::Rack::RackExt do
before :each do
@servlet_request = double("servlet_request")
@servlet_response = double("servlet_response")
Expand Down