jruby-rack 0.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ == 0.9.6
2
+
3
+ - JRUBY_RACK-22: Ensure we call #close on the body per the Rack spec.
4
+ - Set jruby.management.enabled true when creating a runtime. JRuby 1.5
5
+ will default this flag to false, but you probably still want JMX
6
+ capability inside an appserver.
7
+ - Miscellaneous spec cleanup due to changes in JRuby 1.5
8
+
9
+ == 0.9.5
10
+
11
+ - Upgrade to Rack 1.0.0. However, if you supply Rack in your
12
+ application (either via rubygems or by vendoring it), it will take
13
+ precedence -- JRuby-Rack's bundled copy is only loaded as a
14
+ fallback. This allows you to upgrade Rack without having to wait for
15
+ a new JRuby-Rack release.
16
+ - Implement Rack-based java servlet session mechanism. You'll have to
17
+ turn on java servlet sessions by setting
18
+ ActionController::Base.session_store = :java_servlet_store
19
+ in your config/initializers/session_store.rb.
20
+ - JRUBY_RACK-7: Implement a rewindable 'rack.input' shim between the
21
+ servlet input stream and the Rack environment. Below a certain
22
+ byte-size threshold, the input is entirely buffered in memory. Above
23
+ the threshold, the input is written to a tempfile. The default
24
+ threshold is 64k, and can be controlled by the system property
25
+ 'jruby.rack.request.size.threshold.bytes'.
26
+ - The previous non-rewindable input behavior can be re-instated by
27
+ setting the system property 'jruby.rack.input.rewindable' to false.
28
+ Despite being out of spec, environments such as Google AppEngine
29
+ require this behavior because writing to a tempfile is not possible.
30
+ - JRUBY_RACK-4: deal with threading and to_io by assigning IO object
31
+ to an instance variable instead of defining a singleton method on
32
+ the metaclass/singleton class
33
+ - JRUBY_RACK-17: Fix SCRIPT_NAME/PATH_INFO in root context (Chris
34
+ Read)
35
+ - JRUBY_RACK-10, JRUBY_RACK-15: Fix request channel read issue w/
36
+ POSTs and multiparts (Michael Pitman, Lenny Marks)
37
+ - JRUBY_RACK-14: Override both Servlet service methods (Michael
38
+ Pitman)
39
+
40
+ == 0.9.4
41
+
42
+ - PLEASE NOTE: Prior to 0.9.4, jruby-rack would try to use the java
43
+ servlet session store by default. This caused more confusion than
44
+ it's worth; so the default Rails cookie session store has been
45
+ reinstated for this release.
46
+ - Upgrade bundled Rack version to 0.9.1
47
+ - Introduce RackLogger, defaults to log to servlet context but can be
48
+ made to point to stdout by setting -Djruby.rack.logging=stdout (for
49
+ Google AppEngine)
50
+ - Detect Rails 2.3 rack machinery and dispatch to it rather than the
51
+ legacy CGI shim.
52
+ - TODO: Still missing a java servlet Rack::Session adapter for Rails
53
+ 2.3. Should have it for next release.
54
+ - Update example Rails application to Rails 2.3.2, include bits for
55
+ deployment to Google AppEngine using Warbler.
56
+ - RackApplication-related core Java classes have been insulated from
57
+ the servlet API, so that (parts of) JRuby-Rack can be used outside
58
+ of a servlet container. If your application or library is coupled to
59
+ these classes, you'll likely be broken with this release. See Nick
60
+ for details.
61
+ - Fix TLD to be more compatible (Fred McHale).
62
+ - Switched main code repository to kenai.com. Github.com still
63
+ available as a mirror and for forking.
64
+ - EXPERIMENTAL: Beginnings of a JMS API (more details to come)
65
+ - REMOVAL: All the goldspike compatibility bits have been removed. You
66
+ should upgrade your application to use a web.xml similar to what
67
+ comes with Warbler.
68
+
69
+ == 0.9.3
70
+
71
+ - Merb updates for 1.0 compatibility
72
+ - Patch race condition in runtime pooling that allowed more than max
73
+ number of runtimes
74
+ - Fix bug with backref interpretation and windows paths
75
+ - JRUBY-2908: Add fallback for when servletContext.getRealPath doesn't
76
+ work (Joern Hartmann)
77
+ - Add extra prevention to ensure that IO descriptor keys do not leak in
78
+ the runtime's cache of descriptors (see also JRUBY-3185)
79
+ - Switched to dual rake/maven build process
80
+ - Switched main code repository to github (for now)
81
+
82
+ == 0.9.2
83
+
84
+ - Upgrade to Rack 0.4.0
85
+ - Only chdir at startup when the /WEB-INF directory exists (fix for jetty-rails)
86
+ - Fix typos in rails tag tld
87
+ - Add getRuntime to RackApplication for use by non-web embedded applications
88
+ - Use a shared application factory for Rails if max runtimes == 1 (to support multi-threaded Rails)
89
+ - Change from jruby.initial.runtimes to jruby.min.runtimes to be consistent w/ Warbler
90
+
91
+ == 0.9.1
92
+
93
+ - Change each runtime's notion of current directory to /WEB-INF, so you can do
94
+ loads and requires relative to WEB-INF
95
+ - JRUBY-2507: Update Rails boot override to not pre-load action_controller
96
+ - Don't assume or set cache_template_loading to true, rely on Rails to do it for us
97
+ - Set ENV['HTTPS'] = 'on' for Rails depending on servlet request scheme (Lenny Marks)
98
+ - Fix request URI -- must include query string
99
+ - Updated to be built and tested against JRuby 1.1.3
100
+ - Ensure that gem environment is set up for plain rack apps too
101
+ - JRUBY-2594: Fix URI-escaping issue (e.g., when spaces are in the path)
102
+ - Make use of 'Rails.public_path' in Rails 2.1
103
+ - JRUBY-2620: Fix issue with non-string headers
104
+ - Support integer and date headers directly
105
+ - Examples: Rails updated to 2.1, Camping and Sinatra examples added/working
106
+
107
+ == 0.9
108
+
109
+ - First public release.
@@ -0,0 +1,24 @@
1
+ #--
2
+ # The MIT License
3
+ #
4
+ # Copyright (c) 2010 Engine Yard, Inc.
5
+ # Copyright (c) 2007-2009 Sun Microsystems, Inc.
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+ #++
@@ -0,0 +1,280 @@
1
+ # JRuby-Rack
2
+
3
+ - http://jruby-rack.kenai.com/
4
+
5
+ JRuby-Rack is a lightweight adapter for the Java servlet environment
6
+ that allows any Rack-based application to run unmodified in a Java
7
+ servlet container. JRuby-Rack supports Rails, Merb, as well as any
8
+ Rack-compatible Ruby web framework.
9
+
10
+ For more information on Rack, visit http://rack.rubyforge.org.
11
+
12
+ # Getting Started
13
+
14
+ The easiest way to use JRuby-Rack is to get [Warbler][1]. Warbler
15
+ bundles the latest version of JRuby-Rack and ensures it gets placed in
16
+ your WAR file when it gets built.
17
+
18
+ If you're assembling your own WAR using other means, you'll need to
19
+ drop the [latest JRuby-Rack jar][2] into the WEB-INF/lib directory and
20
+ configure the RackFilter in your application's web.xml. Example
21
+ web.xml snippets are as follows.
22
+
23
+ ## For Rails
24
+
25
+ Here's sample web.xml configuration for Rails. Note the environment
26
+ and min/max runtime parameters. For multi-threaded Rails with a single
27
+ runtime, set min/max both to 1. Otherwise, define the size of the
28
+ runtime pool as you wish.
29
+
30
+ <context-param>
31
+ <param-name>rails.env</param-name>
32
+ <param-value>production</param-value>
33
+ </context-param>
34
+
35
+ <context-param>
36
+ <param-name>jruby.min.runtimes</param-name>
37
+ <param-value>1</param-value>
38
+ </context-param>
39
+
40
+ <context-param>
41
+ <param-name>jruby.max.runtimes</param-name>
42
+ <param-value>1</param-value>
43
+ </context-param>
44
+
45
+ <filter>
46
+ <filter-name>RackFilter</filter-name>
47
+ <filter-class>org.jruby.rack.RackFilter</filter-class>
48
+ </filter>
49
+ <filter-mapping>
50
+ <filter-name>RackFilter</filter-name>
51
+ <url-pattern>/*</url-pattern>
52
+ </filter-mapping>
53
+
54
+ <listener>
55
+ <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
56
+ </listener>
57
+
58
+ ## For Other Rack Applications
59
+
60
+ Here's a sample web.xml configuration for a Sinatra application. The
61
+ main difference is to place the rackup script for assembling the
62
+ Rack-based application in the 'rackup' parameter. Be sure to escape
63
+ angle-brackets for XML.
64
+
65
+ <context-param>
66
+ <param-name>rackup</param-name>
67
+ <param-value>
68
+ require 'rubygems'
69
+ gem 'sinatra', '~&gt; 0.9'
70
+ require './lib/demo'
71
+ set :run, false
72
+ set :environment, :production
73
+ run Sinatra::Application
74
+ </param-value>
75
+ </context-param>
76
+
77
+ <filter>
78
+ <filter-name>RackFilter</filter-name>
79
+ <filter-class>org.jruby.rack.RackFilter</filter-class>
80
+ </filter>
81
+ <filter-mapping>
82
+ <filter-name>RackFilter</filter-name>
83
+ <url-pattern>/*</url-pattern>
84
+ </filter-mapping>
85
+
86
+ <listener>
87
+ <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
88
+ </listener>
89
+
90
+ # Features
91
+
92
+ ## Servlet Filter
93
+
94
+ JRuby-Rack's main mode of operation is as a servlet filter. This
95
+ allows requests for static content to pass through and be served by
96
+ the application server. Dynamic requests only happen for URLs that
97
+ don't have a corresponding file, much like many Ruby applications
98
+ expect. The application can also be configured to dispatch through a
99
+ servlet instead of a filter if it suits your environment better.
100
+
101
+ ## Servlet environment integration
102
+
103
+ - Servlet context is accessible to any application both through the
104
+ global variable $servlet_context and the Rack environment variable
105
+ java.servlet_context.
106
+ - Servlet request object is available in the Rack environment via the
107
+ key java.servlet_request.
108
+ - Servlet request attributes are passed through to the Rack
109
+ environment.
110
+ - Rack environment variables and headers can be overridden by servlet
111
+ request attributes.
112
+ - Java servlet sessions are available as a session store for both
113
+ Rails and Merb. Session attributes with String keys and String,
114
+ numeric, boolean, or java object values are automatically copied to
115
+ the servlet session for you.
116
+
117
+ ## Rails
118
+
119
+ Several aspects of Rails are automatically set up for you.
120
+
121
+ - The Rails controller setting ActionController::Base.relative_url_root
122
+ is set for you automatically according to the context root where
123
+ your webapp is deployed.
124
+ - Rails logging output is redirected to the application server log.
125
+ - Page caching and asset directories are configured appropriately.
126
+
127
+ ## JRuby Runtime Management
128
+
129
+ JRuby runtime management and pooling is done automatically by the
130
+ framework. In the case of Rails, runtimes are pooled. For Merb and
131
+ other Rack applications, a single runtime is created and shared for
132
+ every request.
133
+
134
+ ## Servlet Context Init Parameters
135
+
136
+ JRuby-Rack can be configured by setting context init parameters in
137
+ web.xml.
138
+
139
+ - `rackup`: Rackup script for configuring how the Rack application is
140
+ mounted. Required for Rack-based applications other than Rails or
141
+ Merb. Can be omitted if a `config.ru` is included in the application
142
+ root.
143
+ - `jruby.min.runtimes`: For non-threadsafe Rails applications using a
144
+ runtime pool, specify an integer minimum number of runtimes to hold
145
+ in the pool.
146
+ - `jruby.max.runtimes`: For non-threadsafe Rails applications, an
147
+ integer maximum number of runtimes to keep in the pool.
148
+ - `jruby.init.serial`: When using runtime pooling, indicate that the
149
+ runtime pool should be created serially in the foreground rather
150
+ than spawning background threads. For environments where creating
151
+ threads is not permitted.
152
+ - `public.root`: Relative path to the location of your application's
153
+ static assets. Defaults to `/`.
154
+ - `gem.path`: Relative path to the bundled gem repository. Defaults to
155
+ `/WEB-INF/gems`.
156
+ - `rails.root`, `merb.root`: Root path to the location of the Rails or
157
+ Merb application files. Defaults to `/WEB-INF`.
158
+ - `rails.env`: Specify the Rails environment to run. Defaults
159
+ to 'production'.
160
+ - `merb.environment`: Specify the merb environment to run. Defaults to
161
+ `production`.
162
+
163
+ # Building
164
+
165
+ Checkout the JRuby Rack code and cd to that directory.
166
+
167
+ git clone git://kenai.com/jruby-rack~main jruby-rack
168
+ cd jruby-rack
169
+
170
+ You can choose to build with either Maven or Rake. Either of the
171
+ following two will suffice (but see the NOTE below).
172
+
173
+ mvn install
174
+ jruby -S rake
175
+
176
+ The generated jar should be located here: target/jruby-rack-*.jar.
177
+
178
+ ## Rails Step-by-step
179
+
180
+ This example shows how to create and deploy a simple Rails app using
181
+ the embedded Java database H2 to a WAR using Warble and JRuby Rack.
182
+ JRuby Rack is now included in the latest release of Warbler (0.9.9),
183
+ but you can build your own jar from source and substitute it if you
184
+ like.
185
+
186
+ Install Rails and the driver and ActiveRecord adapters for the H2
187
+ database:
188
+
189
+ jruby -S gem install rails activerecord-jdbch2-adapter
190
+
191
+ Install Warbler:
192
+
193
+ jruby -S gem install warbler
194
+
195
+ Make the "Blog" application
196
+
197
+ jruby -S rails blog
198
+ cd blog
199
+
200
+ Copy this configuration into config/database.yml:
201
+
202
+ development:
203
+ adapter: jdbch2
204
+ database: db/development_h2_database
205
+
206
+ test:
207
+ adapter: jdbch2
208
+ database: db/test_h2_database
209
+
210
+ production:
211
+ adapter: jdbch2
212
+ database: db/production_h2_database
213
+
214
+ Generate a scaffold for a simple model of blog comments.
215
+
216
+ jruby script/generate scaffold comment name:string body:text
217
+
218
+ Run the database migration that was just created as part of the scaffold.
219
+
220
+ jruby -S rake db:migrate
221
+
222
+ Start your application on the Rails default port 3000 using Mongrel/
223
+ and make sure it works:
224
+
225
+ jruby script/server
226
+
227
+ Generate a custom Warbler WAR configuration for the blog application
228
+
229
+ jruby -S warble config
230
+
231
+ Generate a production version of the H2 database for the blog
232
+ application:
233
+
234
+ RAILS_ENV=production jruby -S rake db:migrate
235
+
236
+ Edit this file: config/warble.rb and add the following line after
237
+ these comments:
238
+
239
+ # Additional files/directories to include, above those in config.dirs
240
+ # config.includes = FileList["db"]
241
+ config.includes = FileList["db/production_h2*"]
242
+
243
+ This will tell Warble to include the just initialized production H2
244
+ database in the WAR.
245
+
246
+ Continue editing config/warble.rb and add the following line after
247
+ these comments:
248
+
249
+ # Gems to be packaged in the webapp. Note that Rails gems are added to this
250
+ # list if vendor/rails is not present, so be sure to include rails if you
251
+ # overwrite the value
252
+ # config.gems = ["activerecord-jdbc-adapter", "jruby-openssl"]
253
+ # config.gems << "tzinfo"
254
+ # config.gems["rails"] = "1.2.3"
255
+ config.gems << "activerecord-jdbch2-adapter"
256
+
257
+ This will tell Warble to add the JDBC driver for H2 as well as the
258
+ ActiveRecord JDBC and JDBC-H2 adapter Gems.
259
+
260
+ Now generate the WAR file:
261
+
262
+ jruby -S warble war
263
+
264
+ This task generates the file: blog.war at the top level of the
265
+ application as well as an exploded version of the war located here:
266
+ tmp/war.
267
+
268
+ The war should be ready to deploy to your Java application server.
269
+
270
+ # Thanks
271
+
272
+ - All contributors! But also:
273
+ - Dudley Flanders, for the Merb support
274
+ - Robert Egglestone, for the original JRuby servlet integration
275
+ project, Goldspike
276
+ - Chris Neukirchen, for Rack
277
+ - Sun Microsystems, for early project support
278
+
279
+ [1]: http://warbler.kenai.com/pages/Home
280
+ [2]: http://repository.codehaus.org/org/jruby/rack/jruby-rack/
Binary file
@@ -0,0 +1,6 @@
1
+ require 'jruby/rack/version'
2
+ module JRubyJars
3
+ def self.jruby_rack_jar_path
4
+ File.expand_path("../jruby-rack-#{JRuby::Rack::VERSION}.jar", __FILE__)
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ #--
2
+ # Copyright (c) 2010 Engine Yard, Inc.
3
+ # Copyright (c) 2007-2009 Sun Microsystems, Inc.
4
+ # This source code is available under the MIT license.
5
+ # See the file LICENSE.txt for details.
6
+ #++
7
+
8
+ module JRuby
9
+ module Rack
10
+ VERSION = "0.9.7"
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jruby-rack
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 9
8
+ - 7
9
+ version: 0.9.7
10
+ platform: ruby
11
+ authors:
12
+ - Nick Sieger
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-05 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: JRuby-Rack is a combined Java and Ruby library that adapts the Java Servlet API to Rack. For JRuby only.
22
+ email:
23
+ - nick@nicksieger.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - ./History.txt
32
+ - ./LICENSE.txt
33
+ - ./README.md
34
+ - ./lib/jruby-rack-0.9.7.jar
35
+ - ./lib/jruby-rack.rb
36
+ - ./lib/jruby/rack/version.rb
37
+ has_rdoc: true
38
+ homepage: http://jruby.org
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ segments:
51
+ - 0
52
+ version: "0"
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project: jruby-extras
63
+ rubygems_version: 1.3.6
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Rack adapter for JRuby and Servlet Containers
67
+ test_files: []
68
+