torquebox-web 3.0.0-java → 3.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6f35e1566bb04c5dfba25ce12366ba816eed151f
4
+ data.tar.gz: a8e7fd9ae22b1a1ea0e8fa0cf922dd69e20cfcef
5
+ SHA512:
6
+ metadata.gz: df555a30d5d17708ad0d380a82841c1c8ee3d59889370a23ee8f695c43bce168cee135895e0f3018e5a22126ba184baf8f06df2f065a3ac8c39cacdcabbd2a0b
7
+ data.tar.gz: b2d966690134749d027bbbc51e3ebbe4d730f46db860af006097864c4372031c08c3ba6ee2d79126df173cd3f29e12955a2a5fb647d774ab83edcfae1d65a7a7
@@ -24,7 +24,7 @@ module TorqueBox
24
24
  def initialize(app, options={})
25
25
  @app = app
26
26
 
27
- if defined? TORQUEBOX_APP_NAME
27
+ if ServletStore.torquebox_available?
28
28
  web_context = TorqueBox::MSC.java_web_context
29
29
  web_context.session_timeout = options[:timeout] / 60 if options[:timeout]
30
30
 
@@ -35,6 +35,10 @@ module TorqueBox
35
35
  cookie_config.http_only = !!options[:httponly]
36
36
  cookie_config.secure = !!options[:secure]
37
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
38
42
  end
39
43
  end
40
44
 
@@ -45,14 +49,28 @@ module TorqueBox
45
49
  return [ status, headers, body ]
46
50
  end
47
51
 
52
+ def self.torquebox_available?
53
+ defined? TORQUEBOX_APP_NAME
54
+ end
55
+
48
56
  def self.load_session(env)
49
- env['rack.session'] = load_session_data( env['java.servlet_request'].getSession(true) )
57
+ if torquebox_available?
58
+ session_data = load_session_data(env['java.servlet_request'].getSession(true))
59
+ else
60
+ session_data = @test_session_data
61
+ end
62
+ env['rack.session'] = session_data
50
63
  env['rack.session.options' ] = {}
51
64
  end
52
65
 
53
66
  def self.commit_session(env, status, headers, body)
54
67
  session_data = env['rack.session' ]
55
- ServletStore.store_session_data( env['java.servlet_request'].getSession(true), session_data )
68
+ if torquebox_available?
69
+ ServletStore.store_session_data(env['java.servlet_request'].getSession(true),
70
+ session_data)
71
+ else
72
+ @test_session_data = session_data
73
+ end
56
74
  end
57
75
 
58
76
  def self.load_session_data(session)
@@ -119,6 +137,7 @@ module TorqueBox
119
137
  end
120
138
 
121
139
  def destroy
140
+ clear
122
141
  @java_session.invalidate if @java_session
123
142
  end
124
143
 
@@ -134,7 +153,10 @@ module TorqueBox
134
153
  def [](key)
135
154
  super(key.to_s)
136
155
  end
137
- alias :fetch :[]
156
+
157
+ def fetch(key, *args, &block)
158
+ super(key.to_s, *args, &block)
159
+ end
138
160
 
139
161
  def has_key?(key)
140
162
  super(key.to_s)
Binary file
data/lib/torquebox-web.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module TorqueboxWeb
2
- VERSION = '3.0.0'
3
- MAVEN_VERSION = '3.0.0'
2
+ VERSION = '3.0.1'
3
+ MAVEN_VERSION = '3.0.1'
4
4
  end
5
5
  begin
6
6
  require 'java'
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torquebox-web
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 3.0.0
4
+ version: 3.0.1
6
5
  platform: java
7
6
  authors:
8
7
  - The TorqueBox Team
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-28 00:00:00.000000000 Z
11
+ date: 2013-11-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: actionpack
@@ -18,13 +17,11 @@ dependencies:
18
17
  - - '='
19
18
  - !ruby/object:Gem::Version
20
19
  version: 3.0.10
21
- none: false
22
20
  requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
22
  - - '='
25
23
  - !ruby/object:Gem::Version
26
24
  version: 3.0.10
27
- none: false
28
25
  prerelease: false
29
26
  type: :development
30
27
  - !ruby/object:Gem::Dependency
@@ -34,13 +31,11 @@ dependencies:
34
31
  - - '='
35
32
  - !ruby/object:Gem::Version
36
33
  version: 2.7.0
37
- none: false
38
34
  requirement: !ruby/object:Gem::Requirement
39
35
  requirements:
40
36
  - - '='
41
37
  - !ruby/object:Gem::Version
42
38
  version: 2.7.0
43
- none: false
44
39
  prerelease: false
45
40
  type: :development
46
41
  description: ''
@@ -61,6 +56,7 @@ files:
61
56
  homepage: http://torquebox.org/
62
57
  licenses:
63
58
  - Public Domain
59
+ metadata: {}
64
60
  post_install_message:
65
61
  rdoc_options: []
66
62
  require_paths:
@@ -70,18 +66,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
66
  - - '>='
71
67
  - !ruby/object:Gem::Version
72
68
  version: '0'
73
- none: false
74
69
  required_rubygems_version: !ruby/object:Gem::Requirement
75
70
  requirements:
76
71
  - - '>='
77
72
  - !ruby/object:Gem::Version
78
73
  version: '0'
79
- none: false
80
74
  requirements: []
81
75
  rubyforge_project:
82
- rubygems_version: 1.8.24
76
+ rubygems_version: 2.1.9
83
77
  signing_key:
84
- specification_version: 3
78
+ specification_version: 4
85
79
  summary: TorqueBox Web Gem
86
80
  test_files:
87
81
  - spec/servlet_store_spec.rb