torquebox-web 3.2.0-java → 4.0.0.alpha1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90852eeae22743c797726dbfee06ab15659c0290
4
- data.tar.gz: 7b4bb0a9c2579c264aeaac65c5d3f1af8f27d7a1
3
+ metadata.gz: 55cd60b73ff00c5b70ead500b540a3157d6f62ea
4
+ data.tar.gz: f03d8c919a518bed4b6e9f62287d9b2f93ee99b7
5
5
  SHA512:
6
- metadata.gz: 6d17e3615c2dfa4b44c0c74e744b4560a9b4bc27b32444ca9f43ee29c1e17a654306836a0b45f9a95fb5eafd23d7123bb46af3afc2b6bc2cf5977af5ecfa687f
7
- data.tar.gz: 566ff54df91fd93d6c5a9d89aabc29856cb94df5c700a671e32ac090eb8f6d11b4675829391d7c9d09b5ac2fe6bc44aaec092885632884b5d02cabe709d39193
6
+ metadata.gz: ac3498da9cb459c950104e36c7758b99f457e98fc72af539331c1412389219e2162b190e04b7289a4818f5b638255bea4d8457f9d02f3666d832e653272f7dd8
7
+ data.tar.gz: 0bf863321a0e9c8bb7052bcabd8a82e7b8b8076a868abf9764b265485b4bbf596bda9e424d63c341e73bfb8d7de71650c3cfcce4c55a5aae3d8c42fdefcec5bf
@@ -0,0 +1,58 @@
1
+ # Copyright 2014 Red Hat, Inc, and individual contributors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'torquebox-web'
16
+ require 'rack/handler'
17
+
18
+ module Rack
19
+ module Handler
20
+ module TorqueBox
21
+
22
+ def self.run(app, options = {})
23
+ log_level = 'INFO'
24
+ if options[:Quiet]
25
+ log_level = 'ERROR'
26
+ elsif options[:Verbose]
27
+ log_level = 'DEBUG'
28
+ elsif options[:ReallyVerbose]
29
+ log_level = 'TRACE'
30
+ end
31
+ org.projectodd.wunderboss.WunderBoss.log_level = log_level
32
+
33
+ server_options = {
34
+ :host => options[:Host],
35
+ :port => options[:Port],
36
+ :auto_start => false,
37
+ :rack_app => app }
38
+ server = ::TorqueBox::Web.run(server_options)
39
+ yield server if block_given?
40
+
41
+ server.run_from_cli
42
+ end
43
+
44
+ def self.valid_options
45
+ defaults = ::TorqueBox::Web::DEFAULT_SERVER_OPTIONS
46
+ {
47
+ "Host=HOST" => "Hostname to listen on (default: #{defaults[:host]})",
48
+ "Port=PORT" => "Port to listen on (default: #{defaults[:port]})",
49
+ "Quiet" => "Log only errors",
50
+ "Verbose" => "Log more",
51
+ "ReallyVerbose" => "Log a lot"
52
+ }
53
+ end
54
+ end
55
+
56
+ register :torquebox, TorqueBox
57
+ end
58
+ end
@@ -1,13 +1,24 @@
1
- module TorqueboxWeb
2
- VERSION = '3.2.0'
3
- MAVEN_VERSION = '3.2.0'
4
- end
5
- begin
6
- require 'java'
7
- require File.dirname(__FILE__) + '/torquebox-web.jar'
8
- rescue LoadError
9
- puts 'JAR-based gems require JRuby to load. Please visit www.jruby.org.'
10
- raise
1
+ # Copyright 2014 Red Hat, Inc, and individual contributors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'torquebox-core'
16
+
17
+ Dir.glob("#{File.dirname(__FILE__)}/wunderboss-jars/*.jar") do |jar|
18
+ TorqueBox::Jars.register_and_require(jar)
11
19
  end
12
20
 
13
- load File.dirname(__FILE__) + '/gem_hook.rb' if File.exists?( File.dirname(__FILE__) + '/gem_hook.rb')
21
+ TorqueBox::Jars.register_and_require("#{File.dirname(__FILE__)}/wunderboss-rack.jar")
22
+ require 'wunderboss_rack_response_handler'
23
+
24
+ require 'torquebox/web'
@@ -0,0 +1,16 @@
1
+ # Copyright 2014 Red Hat, Inc, and individual contributors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'torquebox/web/cli'
16
+ require 'torquebox/web/server'
@@ -0,0 +1,83 @@
1
+ # Copyright 2014 Red Hat, Inc, and individual contributors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'torquebox/cli'
16
+ require 'torquebox-web'
17
+
18
+ module TorqueBox
19
+ module Web
20
+ # @api private
21
+ class CLI
22
+
23
+ attr_reader :options
24
+
25
+ def usage_parameters
26
+ "[options] [rackup_file]"
27
+ end
28
+
29
+ def setup_parser(parser, options)
30
+ ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'development'
31
+ parser.on '-b', '--bind-address IP', 'IP or host to bind to' do |arg|
32
+ options[:host] = arg
33
+ end
34
+ parser.on '--context-path PATH', 'Web context path to use (default: /)' do |arg|
35
+ options[:path] = arg
36
+ end
37
+ parser.on '--dir DIR', 'Change directory before starting' do |arg|
38
+ options[:root] = arg
39
+ end
40
+ parser.on('-e', '--env ENVIRONMENT',
41
+ 'Environment to run under (default: development)') do |arg|
42
+ ENV['RACK_ENV'] = ENV['RAILS_ENV'] = arg
43
+ end
44
+ parser.on '-p', '--port PORT', Integer, 'HTTP port to listen on' do |arg|
45
+ options[:port] = arg
46
+ end
47
+ parser.on '--io-threads N', Integer, 'Number of IO threads (default: # CPUs)' do |arg|
48
+ options[:io_threads] = arg
49
+ end
50
+ parser.on('--worker-threads N', Integer,
51
+ 'Number of HTTP worker threads (default: # CPUs * 8)') do |arg|
52
+ options[:worker_threads] = arg
53
+ end
54
+ parser.on('--[no-]dispatch',
55
+ 'Enable dispatching of requests to worker threads (default: enabled)') do |arg|
56
+ options[:dispatch] = arg
57
+ end
58
+ end
59
+
60
+ def run(argv, options)
61
+ unless argv.empty?
62
+ options[:rackup] = argv.shift
63
+ end
64
+
65
+ if options[:root]
66
+ org.projectodd.wunderboss.WunderBoss.put_option('root', options[:root])
67
+ end
68
+
69
+ # We always want direct control over starting / stopping
70
+ options[:auto_start] = false
71
+
72
+ @options = options
73
+ @server = ::TorqueBox::Web.run(options)
74
+ unless ENV['TORQUEBOX_CLI_SPECS']
75
+ @server.run_from_cli
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ TorqueBox::CLI.register_extension('run', TorqueBox::Web::CLI.new,
83
+ 'Run TorqueBox web server')
@@ -0,0 +1,342 @@
1
+ # Copyright 2014 Red Hat, Inc, and individual contributors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'torquebox/option_utils'
16
+ require 'torquebox/spec_helpers'
17
+
18
+ module TorqueBox
19
+
20
+ # @example Example usage of an embedded TorqueBox web server, including SockJS:
21
+ # require 'torquebox-web'
22
+ # # Serve the Rack app in the current directory
23
+ # server = TorqueBox::Web.run(:port => 8080, :auto_start => false)
24
+ # # Add a SockJS server endpoint that echoes back every message
25
+ # # sent by a client
26
+ # server.sockjs(:path => '/echo').on_connection do |conn|
27
+ # conn.on_data do |message|
28
+ # conn.write(message)
29
+ # end
30
+ # end
31
+ # server.start
32
+ module Web
33
+
34
+ # @!macro server_options
35
+ # @option options [String] :host ('localhost') the host to bind the server
36
+ # to
37
+ # @option options [Fixnum] :port (8080) the port to bind the server to
38
+ # @option options [Boolean] :auto_start (true) whether to start the web
39
+ # server as soon as an application is deployed or wait until
40
+ # {Server#start} is called.
41
+ # @option options [Undertow::Builder] :configuration if non-nil,
42
+ # the web server will be configured entirely from this
43
+ # instance, which may be conveniently created using
44
+ # {TorqueBox::Web::Undertow.builder}
45
+
46
+
47
+ DEFAULT_SERVER_OPTIONS = {
48
+ :host => 'localhost',
49
+ :port => 8080,
50
+ :configuration => nil,
51
+ :auto_start => true
52
+ }
53
+
54
+ # @!macro mount_options
55
+ # @option options [String] :root ('.') the application's root directory
56
+ # @option options [String] :path ('/') the context path to mount this
57
+ # application under
58
+ # @option options [String] :static_dir ('public') the directory containing
59
+ # static assets that should be served by TorqueBox. A value of nil
60
+ # disables static asset serving.
61
+ # @option options [String] :rackup ('config.ru') the rackup file to use
62
+ # when running the application. This is ignored if :rack_app is given.
63
+ # @option options [Object] :rack_app the Rack application to run. This
64
+ # is useful if the application is created somewhere else before handing
65
+ # the Rack application object off to TorqueBox to run.
66
+ # @option options[Boolean] :dispatch (true) Whether to dispatch requests
67
+ # to HTTP worker threads or run them directly on the IO threads
68
+
69
+
70
+ DEFAULT_MOUNT_OPTIONS = {
71
+ :root => '.',
72
+ :path => '/',
73
+ :static_dir => 'public',
74
+ :rackup => 'config.ru',
75
+ :rack_app => nil,
76
+ :dispatch => true
77
+ }
78
+
79
+ # Runs a Rack application specified by the given options.
80
+ #
81
+ # This is a shortcut for the most common pattern of calling
82
+ # {server} followed by {Server#mount}.
83
+ #
84
+ # @!macro server_options
85
+ # @!macro mount_options
86
+ # @option options [String] :server ('default') the web server to use when
87
+ # running this application. This is only needed if you want to start
88
+ # more than one server listening on different hosts or ports. When
89
+ # running inside a Servlet container, host and port options for this
90
+ # 'default' server will be ignored and it will use the container's
91
+ # web server.
92
+ #
93
+ # @return [Server]
94
+ #
95
+ # @example Run the Rack application in the current directory
96
+ # TorqueBox::Web.run
97
+ # @example Specify a custom rackup file and non-root context path
98
+ # TorqueBox::Web.run(:rackup => 'other_config.ru', :path => '/other')
99
+ # @example Run applications on multiple web servers bound to different hosts and ports
100
+ # TorqueBox::Web.run(:host => '0.0.0.0', :port => 8080)
101
+ # TorqueBox::Web.run(:server => 'another', :host => '127.0.0.1',
102
+ # :port => 8081, :root => 'admin_console/')
103
+ def self.run(options = {})
104
+ server_name = options.delete(:server) { 'default' }
105
+ server_options = options.reject { |k, v| DEFAULT_MOUNT_OPTIONS.key?(k) }
106
+ server = server(server_name, server_options)
107
+ mount_options = options.reject { |k, v| server_options.key?(k) }
108
+ server.mount(mount_options)
109
+ server
110
+ end
111
+
112
+ # Return a {Server} created from the given options
113
+ #
114
+ # If a server of the given name already exists, that server
115
+ # is returned and the passed-in create options are ignored.
116
+ #
117
+ # @!macro server_options
118
+ #
119
+ # @return [Server]
120
+ def self.server(name = 'default', options = {})
121
+ Server.new(name, options)
122
+ end
123
+
124
+ class Server
125
+ include TorqueBox::OptionUtils
126
+ java_import org.projectodd.wunderboss.rack.RackHandler
127
+ java_import org.projectodd.wunderboss.rack.RackServlet
128
+ java_import org.projectodd.sockjs.SockJsServer
129
+ java_import org.projectodd.sockjs.servlet.SockJsServlet
130
+
131
+ # @api private
132
+ WB = org.projectodd.wunderboss.WunderBoss
133
+
134
+ # @api private
135
+ WBWeb = org.projectodd.wunderboss.web.Web
136
+
137
+ # @api private
138
+ attr_accessor :web_component
139
+
140
+ # Mount a Rack application under a specific context path on this server.
141
+ #
142
+ # @!macro mount_options
143
+ def mount(options = {})
144
+ options = DEFAULT_MOUNT_OPTIONS.merge(options)
145
+ valid_keys = opts_to_set(WBWeb::RegisterOption) + DEFAULT_MOUNT_OPTIONS.keys
146
+ validate_options(options, valid_keys)
147
+ @logger.debug("Mounting context path {} with options {} on TorqueBox::Web::Server '{}'",
148
+ options[:path], options.inspect, @web_component.name)
149
+ servlet_context = WB.options.get("servlet-context-path", "")
150
+ relative_root = servlet_context + options[:path]
151
+ relative_root.chop! if relative_root.end_with?("/")
152
+ ENV["RAILS_RELATIVE_URL_ROOT"] = relative_root
153
+ if options[:rack_app].nil?
154
+ require 'rack'
155
+ rackup = File.expand_path(options[:rackup], options[:root])
156
+ options[:rack_app] = Rack::Builder.parse_file(rackup).first
157
+ end
158
+ if options[:init]
159
+ options[:init] = options[:init].to_java(java.lang.Runnable)
160
+ end
161
+ register_options = extract_options(options, WBWeb::RegisterOption)
162
+ if WB.in_container
163
+ servlet = RackServlet.new(options[:rack_app])
164
+ @logger.trace("Registering servlet at context path {}", options[:path])
165
+ @web_component.register_servlet(servlet, register_options)
166
+ else
167
+ handler = RackHandler.new(options[:rack_app])
168
+ @logger.trace("Registering handler at context path {}", options[:path])
169
+ @web_component.register_handler(handler, register_options)
170
+ end
171
+ handler
172
+ end
173
+
174
+ # @!macro mount_servlet_options
175
+ # @option options [String] :path ('/') the context path to mount this
176
+ # servlet under
177
+
178
+
179
+ DEFAULT_MOUNT_SERVLET_OPTIONS = {
180
+ :path => '/'
181
+ }
182
+
183
+ # Mount a Servlet under a specific context path on this server
184
+ #
185
+ # @param servlet [javax.servlet.Servlet] the servlet to mount
186
+ #
187
+ # @!macro mount_servlet_options
188
+ def mount_servlet(servlet, options = {})
189
+ options = DEFAULT_MOUNT_SERVLET_OPTIONS.merge(options)
190
+ valid_keys = opts_to_set(WBWeb::RegisterOption) + DEFAULT_MOUNT_SERVLET_OPTIONS.keys
191
+ validate_options(options, valid_keys)
192
+ @logger.debug("Mounting servlet {} with options {} on TorqueBox::Web::Server '{}'",
193
+ servlet, options.inspect, @web_component.name)
194
+ register_options = extract_options(options, WBWeb::RegisterOption)
195
+ @web_component.register_servlet(servlet, register_options)
196
+ end
197
+
198
+ # Unmount the Rack application or servlet at the given context path.
199
+ #
200
+ # @param path [String] the context path to unmount
201
+ def unmount(path)
202
+ @web_component.unregister(path)
203
+ end
204
+
205
+ # Mount a SockJS endpoint under a specific context path on this server
206
+ #
207
+ # @!macro mount_servlet_options
208
+ def sockjs(options = {})
209
+ sockjs_server = SockJsServer.new
210
+ # TODO: handle options
211
+ servlet = SockJsServlet.new(sockjs_server)
212
+ mount_servlet(servlet, options)
213
+ sockjs_server
214
+ end
215
+
216
+ # Start the server
217
+ def start
218
+ @logger.info("Starting TorqueBox::Web::Server '{}'",
219
+ @web_component.name)
220
+ @web_component.start
221
+ listeners.each do |listener|
222
+ @logger.info("Listening for {} requests on {}:{}",
223
+ listener[:type], listener[:host], listener[:port])
224
+ end
225
+ end
226
+
227
+ # Stop the server
228
+ def stop
229
+ @logger.info("Stopping TorqueBox::Web::Server '{}'",
230
+ @web_component.name)
231
+ @web_component.stop
232
+ end
233
+
234
+ def listeners
235
+ if @web_component.respond_to?(:undertow)
236
+ declared_classes = Java::io.undertow.Undertow.java_class.to_java.declared_classes
237
+ listener_class = declared_classes.find { |c| c.name.include?('ListenerConfig') }
238
+ host_field = listener_class.get_declared_field('host')
239
+ host_field.accessible = true
240
+ port_field = listener_class.get_declared_field('port')
241
+ port_field.accessible = true
242
+ type_field = listener_class.get_declared_field('type')
243
+ type_field.accessible = true
244
+ undertow = @web_component.undertow
245
+ undertow.listeners.map do |listener|
246
+ host = host_field.get(listener)
247
+ port = port_field.get(listener)
248
+ type = type_field.get(listener)
249
+ { :host => host, :port => port, :type => type }
250
+ end
251
+ else
252
+ []
253
+ end
254
+ end
255
+
256
+ # @api private
257
+ def run_from_cli
258
+ # Handle starting the server and listening for signals to shutdown
259
+ start
260
+ TorqueBox::SpecHelpers.booted
261
+ thread = Thread.current
262
+ Signal.trap("INT") do
263
+ org.projectodd.wunderboss.WunderBoss.shutdown_and_reset
264
+ thread.wakeup
265
+ end
266
+ Signal.trap("TERM") do
267
+ org.projectodd.wunderboss.WunderBoss.shutdown_and_reset
268
+ thread.wakeup
269
+ end
270
+ sleep
271
+ end
272
+
273
+
274
+ protected
275
+
276
+ def initialize(name, options = {})
277
+ @logger = WB.logger('TorqueBox::Web::Server')
278
+ options = DEFAULT_SERVER_OPTIONS.merge(options)
279
+ unless options[:configuration]
280
+ options = Undertow.builder(options)
281
+ end
282
+ validate_options(options, DEFAULT_SERVER_OPTIONS.keys)
283
+ create_options = extract_options(options, WBWeb::CreateOption)
284
+ web = WB.find_or_create_component(WBWeb.java_class, name,
285
+ create_options)
286
+ @logger.debug("TorqueBox::Web::Server '{}' has component {}",
287
+ name, web)
288
+ @web_component = web
289
+ end
290
+
291
+ end
292
+
293
+ module Undertow
294
+
295
+ TUNING_OPTIONS = [:io_threads,
296
+ :worker_threads,
297
+ :buffer_size,
298
+ :buffers_per_region,
299
+ :direct_buffers?]
300
+
301
+ # Exposes tuning options for an Undertow web server by returning
302
+ # an options map that includes an Undertow::Builder instance
303
+ # mapped to :configuration. It takes a superset of the options
304
+ # for {TorqueBox::Web.run} and the map it returns may be passed
305
+ # directly to run. Be sure to pass the desired :host and :port
306
+ # here, so that the proper listener will be created.
307
+ #
308
+ # @option options [Fixnum] :io_threads the number of IO threads
309
+ # defaults to available processors
310
+ # @option options [Fixnum] :worker_threads the number of worker
311
+ # threads defaults to 8 * io_threads
312
+ # @option options [Fixnum] :buffer_size in bytes
313
+ # @option options [Fixnum] :buffers_per_region defaults to
314
+ # either 10 or 20 if > 128Mb of RAM
315
+ # @option options [Boolean] :direct_buffers? defaults to true if
316
+ # > 128Mb of RAM
317
+ #
318
+ # The return value is an options map with the :configuration
319
+ # option replacing the ones relevant to an Undertow::Builder
320
+ def self.builder(options = {})
321
+ builder = Java::io.undertow.Undertow.builder
322
+ host = options[:host] || DEFAULT_SERVER_OPTIONS[:host]
323
+ port = options[:port] || DEFAULT_SERVER_OPTIONS[:port]
324
+ builder.addHttpListener(port, host)
325
+ builder.setIoThreads(options[:io_threads]) if options[:io_threads]
326
+ builder.setWorkerThreads(options[:worker_threads]) if options[:worker_threads]
327
+ builder.setBufferSize(options[:buffer_size]) if options[:buffer_size]
328
+ builder.setBuffersPerRegion(options[:buffers_per_region]) if options[:buffers_per_region]
329
+ builder.setDirectBuffers(options[:direct_buffers?]) unless options[:direct_buffers?].nil?
330
+ result = options.reject { |k, v| TUNING_OPTIONS.include?(k) }
331
+ result[:configuration] = builder
332
+ result
333
+ end
334
+
335
+ end
336
+ end
337
+ end
338
+
339
+ # @api private
340
+ class Java::IoUndertow::Undertow
341
+ field_reader :listeners
342
+ end
Binary file
@@ -0,0 +1,75 @@
1
+ # Copyright 2014 Red Hat, Inc, and individual contributors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module WunderBoss
16
+ module Rack
17
+ class ResponseHandler
18
+ def self.handle(rack_response, rack_responder)
19
+ status = rack_response[0]
20
+ headers = rack_response[1]
21
+ body = rack_response[2]
22
+
23
+ begin
24
+ rack_responder.response_code = status.to_i
25
+
26
+ transfer_encoding_value = nil
27
+ headers.each do |key, value|
28
+ rack_responder.add_header(key, value)
29
+ transfer_encoding_value = value if key == 'Transfer-Encoding'
30
+ end
31
+
32
+ chunked = 'chunked' == transfer_encoding_value
33
+ # body must respond to each and yield only String values
34
+ # TODO: check body.to_path as a more efficient way to serve files
35
+ body.each do |chunk|
36
+ output = chunked ? strip_term_markers(chunk) : chunk
37
+ unless output.nil?
38
+ rack_responder.write(output)
39
+ rack_responder.flush if chunked
40
+ end
41
+ end
42
+ rescue NativeException => e
43
+ # Don't needlessly raise errors because of client abort exceptions
44
+ raise unless e.cause.toString =~ /(clientabortexception|broken pipe)/i
45
+ ensure
46
+ body.close if body && body.respond_to?(:close)
47
+ end
48
+ end
49
+
50
+ # TODO: remove this once we upgrade to Undertow 1.0.2.Final
51
+ # https://issues.jboss.org/browse/UNDERTOW-133
52
+ def self.strip_term_markers(chunk)
53
+ # Heavily copied from jruby-rack's rack/response.rb
54
+ term = "\r\n"
55
+ tail = "0#{term}#{term}".freeze
56
+ term_regex = /^([0-9a-fA-F]+)#{Regexp.escape(term)}(.+)#{Regexp.escape(term)}/mo
57
+ if chunk == tail
58
+ # end of chunking, do nothing
59
+ nil
60
+ elsif chunk =~ term_regex
61
+ # format is (size.to_s(16)) term (chunk) term
62
+ # if the size doesn't match then this is some
63
+ # output that just happened to match our regex
64
+ if $1.to_i(16) == $2.bytesize
65
+ $2
66
+ else
67
+ chunk
68
+ end
69
+ else
70
+ chunk
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
metadata CHANGED
@@ -1,61 +1,131 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torquebox-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 4.0.0.alpha1
5
5
  platform: java
6
6
  authors:
7
7
  - The TorqueBox Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2014-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: actionpack
14
+ name: rack
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
15
23
  requirement: !ruby/object:Gem::Requirement
16
24
  requirements:
17
- - - '='
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.4.0
28
+ - - <
18
29
  - !ruby/object:Gem::Version
19
- version: 3.0.10
30
+ version: '2.0'
31
+ prerelease: false
32
+ type: :runtime
33
+ - !ruby/object:Gem::Dependency
34
+ name: torquebox-core
20
35
  version_requirements: !ruby/object:Gem::Requirement
21
36
  requirements:
22
37
  - - '='
23
38
  - !ruby/object:Gem::Version
24
- version: 3.0.10
39
+ version: 4.0.0.alpha1
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '='
43
+ - !ruby/object:Gem::Version
44
+ version: 4.0.0.alpha1
45
+ prerelease: false
46
+ type: :runtime
47
+ - !ruby/object:Gem::Dependency
48
+ name: jbundler
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
25
59
  prerelease: false
26
60
  type: :development
27
61
  - !ruby/object:Gem::Dependency
28
- name: rspec
62
+ name: rake
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
29
68
  requirement: !ruby/object:Gem::Requirement
30
69
  requirements:
31
- - - '='
70
+ - - '>='
32
71
  - !ruby/object:Gem::Version
33
- version: 2.14.1
72
+ version: '0'
73
+ prerelease: false
74
+ type: :development
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake-compiler
34
77
  version_requirements: !ruby/object:Gem::Requirement
35
78
  requirements:
36
- - - '='
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ prerelease: false
88
+ type: :development
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '2.14'
96
+ requirement: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ~>
37
99
  - !ruby/object:Gem::Version
38
- version: 2.14.1
100
+ version: '2.14'
39
101
  prerelease: false
40
102
  type: :development
41
- description: ''
42
- email:
43
- - torquebox-dev@torquebox.org
103
+ description:
104
+ email: torquebox-dev@torquebox.org
44
105
  executables: []
45
106
  extensions: []
46
107
  extra_rdoc_files: []
47
108
  files:
48
- - lib/action_controller/session/torque_box_store.rb
49
- - lib/action_dispatch/session/torque_box_store.rb
50
- - lib/gem_hook.rb
51
- - lib/torquebox-web.jar
109
+ - lib/wunderboss_rack_response_handler.rb
110
+ - lib/wunderboss-rack.jar
52
111
  - lib/torquebox-web.rb
53
- - lib/torquebox/session/servlet_store.rb
54
- - licenses/cc0-1.0.txt
55
- - spec/servlet_store_spec.rb
56
- homepage: http://torquebox.org/
112
+ - lib/rack/handler/torquebox.rb
113
+ - lib/wunderboss-jars/sockjs-servlet-0.1.2.jar
114
+ - lib/wunderboss-jars/wunderboss-web-1.x.incremental.174.jar
115
+ - lib/wunderboss-jars/jboss-servlet-api_3.1_spec-1.0.0.Final.jar
116
+ - lib/wunderboss-jars/undertow-servlet-1.1.0.Final.jar
117
+ - lib/wunderboss-jars/jboss-annotations-api_1.2_spec-1.0.0.Final.jar
118
+ - lib/wunderboss-jars/xnio-api-3.3.0.Final.jar
119
+ - lib/wunderboss-jars/undertow-core-1.1.0.Final.jar
120
+ - lib/wunderboss-jars/jboss-websocket-api_1.1_spec-1.1.0.Final.jar
121
+ - lib/wunderboss-jars/undertow-websockets-jsr-1.1.0.Final.jar
122
+ - lib/wunderboss-jars/xnio-nio-3.3.0.Final.jar
123
+ - lib/torquebox/web.rb
124
+ - lib/torquebox/web/server.rb
125
+ - lib/torquebox/web/cli.rb
126
+ homepage: http://torquebox.org/torqbox
57
127
  licenses:
58
- - Public Domain
128
+ - Apache-2.0
59
129
  metadata: {}
60
130
  post_install_message:
61
131
  rdoc_options: []
@@ -63,19 +133,22 @@ require_paths:
63
133
  - lib
64
134
  required_ruby_version: !ruby/object:Gem::Requirement
65
135
  requirements:
66
- - - ">="
136
+ - - '>='
67
137
  - !ruby/object:Gem::Version
68
- version: '0'
138
+ version: 1.9.3
69
139
  required_rubygems_version: !ruby/object:Gem::Requirement
70
140
  requirements:
71
- - - ">="
141
+ - - '>'
72
142
  - !ruby/object:Gem::Version
73
- version: '0'
74
- requirements: []
143
+ version: 1.3.1
144
+ requirements:
145
+ - jar org.projectodd.wunderboss:wunderboss-ruby, 1.x.incremental.174
146
+ - jar org.projectodd.wunderboss:wunderboss-web, 1.x.incremental.174
147
+ - jar org.projectodd.sockjs:sockjs-servlet, 0.1.2
75
148
  rubyforge_project:
76
- rubygems_version: 2.6.6
149
+ rubygems_version: 2.1.9
77
150
  signing_key:
78
151
  specification_version: 4
79
- summary: TorqueBox Web Gem
80
- test_files:
81
- - spec/servlet_store_spec.rb
152
+ summary: TorqueBox Next Generation
153
+ test_files: []
154
+ has_rdoc:
@@ -1,29 +0,0 @@
1
- # Copyright 2008-2013 Red Hat, Inc, and individual contributors.
2
- #
3
- # This is free software; you can redistribute it and/or modify it
4
- # under the terms of the GNU Lesser General Public License as
5
- # published by the Free Software Foundation; either version 2.1 of
6
- # the License, or (at your option) any later version.
7
- #
8
- # This software is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- # Lesser General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public
14
- # License along with this software; if not, write to the Free
15
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
17
-
18
- # @api private
19
- module ActionController
20
- module Session
21
- # @api public
22
- class TorqueBoxStore < TorqueBox::Session::ServletStore
23
- end
24
- end
25
- end
26
-
27
- # This assignment allows :torquebox_store to work as a symbol
28
- ActionController::Session::TorqueboxStore = ActionController::Session::TorqueBoxStore
29
-
@@ -1,29 +0,0 @@
1
- # Copyright 2008-2013 Red Hat, Inc, and individual contributors.
2
- #
3
- # This is free software; you can redistribute it and/or modify it
4
- # under the terms of the GNU Lesser General Public License as
5
- # published by the Free Software Foundation; either version 2.1 of
6
- # the License, or (at your option) any later version.
7
- #
8
- # This software is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- # Lesser General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public
14
- # License along with this software; if not, write to the Free
15
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
17
-
18
- # @api private
19
- module ActionDispatch
20
- module Session
21
- # @api public
22
- class TorqueBoxStore < TorqueBox::Session::ServletStore
23
- end
24
- end
25
- end
26
-
27
- # This assignment allows :torquebox_store to work as a symbol
28
- ActionDispatch::Session::TorqueboxStore = ActionDispatch::Session::TorqueBoxStore
29
-
@@ -1,21 +0,0 @@
1
- # Copyright 2008-2013 Red Hat, Inc, and individual contributors.
2
- #
3
- # This is free software; you can redistribute it and/or modify it
4
- # under the terms of the GNU Lesser General Public License as
5
- # published by the Free Software Foundation; either version 2.1 of
6
- # the License, or (at your option) any later version.
7
- #
8
- # This software is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- # Lesser General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public
14
- # License along with this software; if not, write to the Free
15
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
17
-
18
- require 'torquebox/session/servlet_store'
19
- require 'action_dispatch/session/torque_box_store' if defined?(ActionDispatch) || ENV['TORQUEBOX_APP_TYPE'] == 'rails'
20
- require 'action_controller/session/torque_box_store' if defined?(ActionController) || ENV['TORQUEBOX_APP_TYPE'] == 'rails'
21
-
Binary file
@@ -1,192 +0,0 @@
1
- # Copyright 2008-2013 Red Hat, Inc, and individual contributors.
2
- #
3
- # This is free software; you can redistribute it and/or modify it
4
- # under the terms of the GNU Lesser General Public License as
5
- # published by the Free Software Foundation; either version 2.1 of
6
- # the License, or (at your option) any later version.
7
- #
8
- # This software is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- # Lesser General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public
14
- # License along with this software; if not, write to the Free
15
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
17
-
18
- module TorqueBox
19
- module Session
20
- class ServletStore
21
-
22
- RAILS_SESSION_KEY = '__current_rails_session'
23
-
24
- def initialize(app, options={})
25
- @app = app
26
-
27
- if ServletStore.torquebox_available?
28
- web_context = TorqueBox::MSC.java_web_context
29
- web_context.session_timeout = options[:timeout] / 60 if options[:timeout]
30
-
31
- cookie_config = web_context.session_cookie
32
- cookie_config.name = options[:key] if options[:key]
33
- cookie_config.domain = options[:domain] if options[:domain]
34
- cookie_config.path = options[:path] if options[:path]
35
- cookie_config.http_only = !!options[:httponly]
36
- cookie_config.secure = !!options[:secure]
37
- cookie_config.max_age = options[:max_age] if options[:max_age]
38
- else
39
- # Fallback to just storing session data in a hash if we're
40
- # running outside of TorqueBox
41
- @test_session_data = SessionData.new
42
- end
43
- end
44
-
45
- def call(env)
46
- ServletStore.load_session(env)
47
- status, headers, body = @app.call(env)
48
- ServletStore.commit_session(env, status, headers, body)
49
- return [ status, headers, body ]
50
- end
51
-
52
- def self.torquebox_available?
53
- defined? TORQUEBOX_APP_NAME
54
- end
55
-
56
- def self.load_session(env)
57
- if torquebox_available?
58
- session_data = load_session_data(env['java.servlet_request'].getSession(false))
59
- else
60
- session_data = @test_session_data
61
- end
62
- env['rack.session'] = session_data
63
- env['rack.session.options' ] = {}
64
- end
65
-
66
- def self.commit_session(env, status, headers, body)
67
- session_data = env['rack.session' ]
68
- if torquebox_available?
69
- ServletStore.store_session_data(env['java.servlet_request'].getSession(true),
70
- session_data) unless session_data.empty?
71
- else
72
- @test_session_data = session_data
73
- end
74
- end
75
-
76
- def self.load_session_data(session)
77
- session_data = SessionData.new
78
- if session
79
- session_data.java_session = session
80
- session.getAttributeNames.each do |key|
81
- if ( key == RAILS_SESSION_KEY )
82
- marshalled_bytes = session.getAttribute(RAILS_SESSION_KEY)
83
- if ( marshalled_bytes )
84
- data = Marshal.load( String.from_java_bytes( marshalled_bytes ) )
85
- session_data.update( data ) if Hash === data
86
- end
87
- else
88
- session_data[key] = session.getAttribute(key)
89
- end
90
- end
91
- initial_keys = session_data.keys
92
- session_data[:session_id] = session.getId()
93
- session_data['TORQUEBOX_INITIAL_KEYS'] = initial_keys
94
- end
95
- session_data
96
- end
97
-
98
- def self.store_session_data(session, session_data)
99
- hash = session_data.to_hash
100
- # java session shouldn't be marshalled
101
- hash.java_session = nil if hash.respond_to?(:java_session=)
102
- initial_keys = hash['TORQUEBOX_INITIAL_KEYS'] || []
103
- removed_keys = initial_keys - hash.keys
104
- hash.delete('TORQUEBOX_INITIAL_KEYS')
105
- hash.delete_if do |key,value|
106
- # I don't think this guard is really necessary
107
- if ( Symbol === key or String === key)
108
- key = key.to_s
109
- case value
110
- when String, Numeric, true, false, nil
111
- session.setAttribute( key, value )
112
- true
113
- else
114
- if value.respond_to?(:java_object)
115
- session.setAttribute( key, value )
116
- true
117
- else
118
- false
119
- end
120
- end
121
- end
122
- end
123
- unless hash.empty?
124
- marshalled_string = Marshal.dump(hash)
125
- marshalled_bytes = marshalled_string.to_java_bytes
126
- session.setAttribute(RAILS_SESSION_KEY, marshalled_bytes)
127
- end
128
- removed_keys.each do |k|
129
- session.removeAttribute( k.to_s )
130
- end
131
- end
132
- end
133
-
134
- class SessionData < Hash
135
- attr_accessor :java_session
136
-
137
- def url_suffix
138
- ";jsessionid=#{self[:session_id]}"
139
- end
140
-
141
- def destroy
142
- clear
143
- @java_session.invalidate if @java_session
144
- end
145
-
146
- def update(hash)
147
- super(stringify_keys(hash))
148
- end
149
- alias :merge! :update
150
-
151
- def replace(hash)
152
- super(stringify_keys(hash))
153
- end
154
-
155
- def [](key)
156
- super(key.to_s)
157
- end
158
-
159
- def fetch(key, *args, &block)
160
- super(key.to_s, *args, &block)
161
- end
162
-
163
- def has_key?(key)
164
- super(key.to_s)
165
- end
166
- alias :key? :has_key?
167
- alias :include? :has_key?
168
-
169
- def store(key, value)
170
- super(key.to_s, value)
171
- end
172
- alias :[]= :store
173
-
174
- def delete(key)
175
- super(key.to_s)
176
- end
177
-
178
- private
179
-
180
- def stringify_keys(other)
181
- hash = {}
182
- other.each do |key, value|
183
- hash[key.to_s] = value
184
- end
185
- hash
186
- end
187
- end
188
-
189
- end
190
- end
191
-
192
-
@@ -1,121 +0,0 @@
1
- Creative Commons Legal Code
2
-
3
- CC0 1.0 Universal
4
-
5
- CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
- LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
- ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
- INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
- REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
- PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
- THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
- HEREUNDER.
13
-
14
- Statement of Purpose
15
-
16
- The laws of most jurisdictions throughout the world automatically confer
17
- exclusive Copyright and Related Rights (defined below) upon the creator
18
- and subsequent owner(s) (each and all, an "owner") of an original work of
19
- authorship and/or a database (each, a "Work").
20
-
21
- Certain owners wish to permanently relinquish those rights to a Work for
22
- the purpose of contributing to a commons of creative, cultural and
23
- scientific works ("Commons") that the public can reliably and without fear
24
- of later claims of infringement build upon, modify, incorporate in other
25
- works, reuse and redistribute as freely as possible in any form whatsoever
26
- and for any purposes, including without limitation commercial purposes.
27
- These owners may contribute to the Commons to promote the ideal of a free
28
- culture and the further production of creative, cultural and scientific
29
- works, or to gain reputation or greater distribution for their Work in
30
- part through the use and efforts of others.
31
-
32
- For these and/or other purposes and motivations, and without any
33
- expectation of additional consideration or compensation, the person
34
- associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
- is an owner of Copyright and Related Rights in the Work, voluntarily
36
- elects to apply CC0 to the Work and publicly distribute the Work under its
37
- terms, with knowledge of his or her Copyright and Related Rights in the
38
- Work and the meaning and intended legal effect of CC0 on those rights.
39
-
40
- 1. Copyright and Related Rights. A Work made available under CC0 may be
41
- protected by copyright and related or neighboring rights ("Copyright and
42
- Related Rights"). Copyright and Related Rights include, but are not
43
- limited to, the following:
44
-
45
- i. the right to reproduce, adapt, distribute, perform, display,
46
- communicate, and translate a Work;
47
- ii. moral rights retained by the original author(s) and/or performer(s);
48
- iii. publicity and privacy rights pertaining to a person's image or
49
- likeness depicted in a Work;
50
- iv. rights protecting against unfair competition in regards to a Work,
51
- subject to the limitations in paragraph 4(a), below;
52
- v. rights protecting the extraction, dissemination, use and reuse of data
53
- in a Work;
54
- vi. database rights (such as those arising under Directive 96/9/EC of the
55
- European Parliament and of the Council of 11 March 1996 on the legal
56
- protection of databases, and under any national implementation
57
- thereof, including any amended or successor version of such
58
- directive); and
59
- vii. other similar, equivalent or corresponding rights throughout the
60
- world based on applicable law or treaty, and any national
61
- implementations thereof.
62
-
63
- 2. Waiver. To the greatest extent permitted by, but not in contravention
64
- of, applicable law, Affirmer hereby overtly, fully, permanently,
65
- irrevocably and unconditionally waives, abandons, and surrenders all of
66
- Affirmer's Copyright and Related Rights and associated claims and causes
67
- of action, whether now known or unknown (including existing as well as
68
- future claims and causes of action), in the Work (i) in all territories
69
- worldwide, (ii) for the maximum duration provided by applicable law or
70
- treaty (including future time extensions), (iii) in any current or future
71
- medium and for any number of copies, and (iv) for any purpose whatsoever,
72
- including without limitation commercial, advertising or promotional
73
- purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
- member of the public at large and to the detriment of Affirmer's heirs and
75
- successors, fully intending that such Waiver shall not be subject to
76
- revocation, rescission, cancellation, termination, or any other legal or
77
- equitable action to disrupt the quiet enjoyment of the Work by the public
78
- as contemplated by Affirmer's express Statement of Purpose.
79
-
80
- 3. Public License Fallback. Should any part of the Waiver for any reason
81
- be judged legally invalid or ineffective under applicable law, then the
82
- Waiver shall be preserved to the maximum extent permitted taking into
83
- account Affirmer's express Statement of Purpose. In addition, to the
84
- extent the Waiver is so judged Affirmer hereby grants to each affected
85
- person a royalty-free, non transferable, non sublicensable, non exclusive,
86
- irrevocable and unconditional license to exercise Affirmer's Copyright and
87
- Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
- maximum duration provided by applicable law or treaty (including future
89
- time extensions), (iii) in any current or future medium and for any number
90
- of copies, and (iv) for any purpose whatsoever, including without
91
- limitation commercial, advertising or promotional purposes (the
92
- "License"). The License shall be deemed effective as of the date CC0 was
93
- applied by Affirmer to the Work. Should any part of the License for any
94
- reason be judged legally invalid or ineffective under applicable law, such
95
- partial invalidity or ineffectiveness shall not invalidate the remainder
96
- of the License, and in such case Affirmer hereby affirms that he or she
97
- will not (i) exercise any of his or her remaining Copyright and Related
98
- Rights in the Work or (ii) assert any associated claims and causes of
99
- action with respect to the Work, in either case contrary to Affirmer's
100
- express Statement of Purpose.
101
-
102
- 4. Limitations and Disclaimers.
103
-
104
- a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
- surrendered, licensed or otherwise affected by this document.
106
- b. Affirmer offers the Work as-is and makes no representations or
107
- warranties of any kind concerning the Work, express, implied,
108
- statutory or otherwise, including without limitation warranties of
109
- title, merchantability, fitness for a particular purpose, non
110
- infringement, or the absence of latent or other defects, accuracy, or
111
- the present or absence of errors, whether or not discoverable, all to
112
- the greatest extent permissible under applicable law.
113
- c. Affirmer disclaims responsibility for clearing rights of other persons
114
- that may apply to the Work or any use thereof, including without
115
- limitation any person's Copyright and Related Rights in the Work.
116
- Further, Affirmer disclaims responsibility for obtaining any necessary
117
- consents, permissions or other rights required for any use of the
118
- Work.
119
- d. Affirmer understands and acknowledges that Creative Commons is not a
120
- party to this document and has no duty or obligation with respect to
121
- this CC0 or use of the Work.
@@ -1,30 +0,0 @@
1
- require 'torquebox/session/servlet_store'
2
-
3
-
4
- describe TorqueBox::Session::SessionData do
5
-
6
- subject { TorqueBox::Session::SessionData.new }
7
-
8
- it "stores symbols as strings" do
9
- subject[:a] = "hello"
10
- subject["a"].should == "hello"
11
- end
12
-
13
- it "stores string as strings" do
14
- subject["a"] = "hello"
15
- subject["a"].should == "hello"
16
- end
17
-
18
- it "retrives strings using symbols" do
19
- subject["a"] = "hello"
20
- subject[:a].should == "hello"
21
- end
22
-
23
- it "works with symbols even though they are stored as strings" do
24
- subject[:a] = "hello"
25
- subject[:a].should == "hello"
26
- end
27
-
28
- end
29
-
30
-