rjack-jetty 9.2.10.0-java → 9.2.11.0-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: 68f0affca82a46a5b974cb2200cb9b783fb97449
4
- data.tar.gz: de1202f5b1f96549860bdd872da99a480b36d1c3
3
+ metadata.gz: ad2dffe9d1d4c37ecc8d26346efecdc97d70a750
4
+ data.tar.gz: 2952848c6582f314535a93c69588da3c5379e0c2
5
5
  SHA512:
6
- metadata.gz: 7a9931a8bc363de0d3a8b5fddf5ace183f3967621411774a43cd8301bc47f6ae702280da5b60e08c44284961668235d35e7258ebf4d00aeed0295f27dd1c5568
7
- data.tar.gz: ed441ef7239cc75aa1dcfaabd927d391fc1e47a481d18e5de230c22e3d226ae89ce90739f4ae5fe0fb272465115b5dd855278766eb98230e55936ca9ef0f82ec
6
+ metadata.gz: 4120cecce548b85398d5653bf6ec3e36b0e12a98c63f0f1812f360a607c7e54db1c4184b0f678afb1105e80ae592517048d38ca9a0e6aa0d61f345e8a8b0490c
7
+ data.tar.gz: 8192602f3006e10538e3cf3f51a6fb6482bae3c12ef18e4f97d509817ad8289af2995a2e1c24438bf8451106c5de51fa50dfb934d1d462b8da3bc22201f4c0f0
data/History.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ === 9.2.11.0 (2015-6-1)
2
+ * Update to Jetty 9.2.11.v20150529
3
+ * Add ServerFactory#connections (and host) properties for creating
4
+ multiple tcp/ssl connectors (backport from 9.3.0)
5
+
1
6
  === 9.2.10.0 (2015-3-30)
2
7
  * Update to Jetty 9.2.10.v20150310
3
8
 
data/Manifest.txt CHANGED
@@ -10,21 +10,22 @@ lib/rjack-jetty.rb
10
10
  lib/rjack-jetty/client.rb
11
11
  lib/rjack-jetty/rewrite.rb
12
12
  lib/rjack-jetty/test-servlets.rb
13
+ test/keystore
13
14
  test/test.txt
14
15
  test/test_jetty.rb
15
16
  webapps/test/index.html
16
17
  webapps/test/WEB-INF/web.xml
17
18
  webapps/test.war
18
19
  lib/rjack-jetty/javax.servlet-api-3.1.0.jar
19
- lib/rjack-jetty/jetty-client-9.2.10.v20150310.jar
20
- lib/rjack-jetty/jetty-continuation-9.2.10.v20150310.jar
21
- lib/rjack-jetty/jetty-http-9.2.10.v20150310.jar
22
- lib/rjack-jetty/jetty-io-9.2.10.v20150310.jar
23
- lib/rjack-jetty/jetty-rewrite-9.2.10.v20150310.jar
24
- lib/rjack-jetty/jetty-security-9.2.10.v20150310.jar
25
- lib/rjack-jetty/jetty-server-9.2.10.v20150310.jar
26
- lib/rjack-jetty/jetty-servlet-9.2.10.v20150310.jar
27
- lib/rjack-jetty/jetty-util-9.2.10.v20150310.jar
28
- lib/rjack-jetty/jetty-webapp-9.2.10.v20150310.jar
29
- lib/rjack-jetty/jetty-xml-9.2.10.v20150310.jar
20
+ lib/rjack-jetty/jetty-client-9.2.11.v20150529.jar
21
+ lib/rjack-jetty/jetty-continuation-9.2.11.v20150529.jar
22
+ lib/rjack-jetty/jetty-http-9.2.11.v20150529.jar
23
+ lib/rjack-jetty/jetty-io-9.2.11.v20150529.jar
24
+ lib/rjack-jetty/jetty-rewrite-9.2.11.v20150529.jar
25
+ lib/rjack-jetty/jetty-security-9.2.11.v20150529.jar
26
+ lib/rjack-jetty/jetty-server-9.2.11.v20150529.jar
27
+ lib/rjack-jetty/jetty-servlet-9.2.11.v20150529.jar
28
+ lib/rjack-jetty/jetty-util-9.2.11.v20150529.jar
29
+ lib/rjack-jetty/jetty-webapp-9.2.11.v20150529.jar
30
+ lib/rjack-jetty/jetty-xml-9.2.11.v20150529.jar
30
31
  lib/rjack-jetty/rjack-jetty-1.0.jar
data/lib/rjack-jetty.rb CHANGED
@@ -14,6 +14,7 @@
14
14
  # permissions and limitations under the License.
15
15
  #++
16
16
 
17
+ require 'uri'
17
18
  require 'rjack-jetty/base'
18
19
 
19
20
  require 'java'
@@ -40,10 +41,14 @@ module RJack
40
41
 
41
42
  require File.join( JETTY_DIR, "javax.servlet-api-#{ SERVLET_API_VERSION }.jar" )
42
43
 
44
+ import 'org.eclipse.jetty.http.HttpVersion'
43
45
  import 'org.eclipse.jetty.server.Connector'
44
46
  import 'org.eclipse.jetty.server.Handler'
47
+ import 'org.eclipse.jetty.server.HttpConfiguration'
45
48
  import 'org.eclipse.jetty.server.NCSARequestLog'
49
+ import 'org.eclipse.jetty.server.SecureRequestCustomizer'
46
50
  import 'org.eclipse.jetty.server.Server'
51
+ import 'org.eclipse.jetty.server.SslConnectionFactory'
47
52
  import 'org.eclipse.jetty.server.handler.AbstractHandler'
48
53
  import 'org.eclipse.jetty.server.handler.ContextHandler'
49
54
  import 'org.eclipse.jetty.server.handler.ContextHandlerCollection'
@@ -51,10 +56,12 @@ module RJack
51
56
  import 'org.eclipse.jetty.server.handler.HandlerCollection'
52
57
  import 'org.eclipse.jetty.server.handler.RequestLogHandler'
53
58
  import 'org.eclipse.jetty.server.handler.ResourceHandler'
59
+ import 'org.eclipse.jetty.server.HttpConnectionFactory'
54
60
  import 'org.eclipse.jetty.server.ServerConnector'
55
61
  import 'org.eclipse.jetty.servlet.ServletContextHandler'
56
62
  import 'org.eclipse.jetty.servlet.ServletHolder'
57
63
  import 'org.eclipse.jetty.webapp.WebAppContext'
64
+ import 'org.eclipse.jetty.util.ssl.SslContextFactory'
58
65
  import 'org.eclipse.jetty.util.thread.QueuedThreadPool'
59
66
 
60
67
  # A factory for creating complete org.morbay.jetty.Server
@@ -114,18 +121,70 @@ module RJack
114
121
  # server.join
115
122
  #
116
123
  class ServerFactory
117
- attr_accessor( :port, :max_idle_time_ms,
118
- :max_threads, :min_threads,
119
- :static_contexts, :static_welcome_files,
120
- :webapp_contexts,
121
- :servlet_contexts,
122
- :stop_at_shutdown )
124
+
125
+ # Default port number or 0 to use any available port, for a
126
+ # single connection. Default: 0
127
+ # Deprecated: use #connections instead.
128
+ attr_accessor :port
129
+
130
+ # Default interface to bind to. Default: nil -> 0.0.0.0 -> all
131
+ # Use #connections instead.
132
+ attr_accessor :host
133
+
134
+ # Default idle time in milliseconds to use for all connections.
135
+ # Default: 10,000 ms
136
+ attr_accessor :max_idle_time_ms
137
+
138
+ # Maximum number of threads. A minimum value of 7 is used, based
139
+ # on the testing with the current Jetty version. Default: 20
140
+ attr_accessor :max_threads
141
+
142
+ # Minimum number of threads. A minimum value of 4 is
143
+ # used. Default: max_threads / 4
144
+ attr_accessor :min_threads
145
+
146
+ # Hash of request path prefixes to local file systems paths for
147
+ # static content. Default: {}
148
+ attr_accessor :static_contexts
149
+
150
+ # Array of welcome file names. Default: [ 'index.html' ]
151
+ attr_accessor :static_welcome_files
152
+
153
+ # Hash of request path prefexes to java webapp paths
154
+ # Default: {} (none)
155
+ attr_accessor :webapp_contexts
156
+
157
+ # Hash of request path prefexes to servlet paths. Default: {}
158
+ attr_accessor :servlet_contexts
159
+
160
+ # Explicitly and gracefully stop the server on shutdown?
161
+ # Default: true
162
+ attr_accessor :stop_at_shutdown
123
163
 
124
164
  # Request log output to :stderr or file name (default: nil, no log)
125
165
  attr_accessor :request_log_file
126
166
 
167
+ # An array of connection options, each member being a hash with
168
+ # the following properties or an equivalent URI string:
169
+ #
170
+ # :scheme:: Values 'tcp' or 'ssl'
171
+ # :host:: The local interface to bind Default: 0.0.0.0 (all)
172
+ # :port:: Port number or 0 to select an available port
173
+ # (Default: top level #port for first connection, 0 )
174
+ # :max_idle_time_ms:: See above
175
+ # :key_store_path:: For ssl, the path to the (Java JKS) keystore
176
+ # :key_store_password:: For ssl, the password to the keystore
177
+ #
178
+ # URI examples:
179
+ #
180
+ # tcp://127.0.0.1
181
+ # ssl://0.0.0.0:8443?key_store_path=test/keystore&key_store_password=399as8d9
182
+ #
183
+ attr_accessor :connections
184
+
127
185
  def initialize
128
186
  @port = 0 # Use any available port
187
+ @host = nil
129
188
  @max_threads = 20
130
189
  @min_threads = nil # Compute from max_threads
131
190
  @max_idle_time_ms = 10000
@@ -135,6 +194,7 @@ module RJack
135
194
  @request_log_file = nil
136
195
  @servlet_contexts = {}
137
196
  @stop_at_shutdown = true
197
+ @connections = nil
138
198
  end
139
199
 
140
200
  # Returns a new org.morbay.jetty.Server that is ready to
@@ -166,15 +226,62 @@ module RJack
166
226
  end
167
227
 
168
228
  # Return array of org.eclipse.jetty.Connector instances.
169
- #
170
- # This implementation returns a single ServerConnector
171
- # listening to the given port or an auto-selected avaiable
172
- # port. Connections are retained for max_idle_time_ms.
173
229
  def create_connectors( server )
174
- connector = ServerConnector.new( server )
175
- connector.port = @port
176
- connector.idle_timeout = @max_idle_time_ms
177
- [ connector ]
230
+ first = true
231
+ ( connections || [{ scheme: 'tcp' }] ).map do |opts|
232
+ opts = parse_connection_uri( opts ) if opts.is_a?( String )
233
+
234
+ connector = case opts[:scheme]
235
+ when 'ssl'
236
+ create_https_connector( server, opts )
237
+ when 'tcp'
238
+ create_http_connector( server, opts )
239
+ else
240
+ raise "Unsupported connection scheme '#{opts[:scheme]}'"
241
+ end
242
+ h = opts[:host] || @host
243
+ connector.host = h if h
244
+ connector.port = opts[:port] || ( first && @port ) || 0
245
+ connector.idle_timeout = opts[:max_idle_time_ms] || @max_idle_time_ms
246
+ first = false
247
+ connector
248
+ end
249
+ end
250
+
251
+ def parse_connection_uri( uri )
252
+ u = URI.parse( uri )
253
+ opts = { scheme: u.scheme,
254
+ host: u.host,
255
+ port: u.port }
256
+
257
+ if u.query
258
+ params = URI.decode_www_form( u.query )
259
+ params = params.inject({}) { |m,(k,v)| m[k.to_sym] = v; m }
260
+ opts.merge!( params )
261
+ end
262
+
263
+ opts
264
+ end
265
+ def create_http_connector( server, opts = {} )
266
+ ServerConnector.new( server )
267
+ end
268
+
269
+ def create_https_connector( server, opts = {} )
270
+ ctx_f = SslContextFactory.new
271
+ if opts[:key_store_path]
272
+ ctx_f.key_store_path = opts[:key_store_path]
273
+ end
274
+ if opts[:key_store_password]
275
+ ctx_f.key_store_password = opts[:key_store_password]
276
+ end
277
+ ssl_con_f = SslConnectionFactory.new(ctx_f, HttpVersion::HTTP_1_1.to_s)
278
+
279
+ conf = HttpConfiguration.new
280
+ conf.add_customizer( SecureRequestCustomizer.new )
281
+ http_con_f = HttpConnectionFactory.new( conf )
282
+
283
+ ServerConnector.new( server, ssl_con_f, http_con_f )
284
+
178
285
  end
179
286
 
180
287
  # Returns an Array of org.eclipse.jetty.Handler instances.
@@ -16,9 +16,9 @@
16
16
 
17
17
  module RJack
18
18
  module Jetty
19
- JETTY_VERSION = '9.2.10'
19
+ JETTY_VERSION = '9.2.11'
20
20
  VERSION = JETTY_VERSION + '.0'
21
- JETTY_BUILD = 'v20150310'
21
+ JETTY_BUILD = 'v20150529'
22
22
  SERVLET_API_VERSION = '3.1.0'
23
23
 
24
24
  JETTY_DIR = File.dirname( __FILE__ ) # :nodoc:
Binary file
data/pom.xml CHANGED
@@ -16,43 +16,43 @@
16
16
  <dependency>
17
17
  <groupId>org.eclipse.jetty</groupId>
18
18
  <artifactId>jetty-servlet</artifactId>
19
- <version>9.2.10.v20150310</version>
19
+ <version>9.2.11.v20150529</version>
20
20
  </dependency>
21
21
 
22
22
  <dependency>
23
23
  <groupId>org.eclipse.jetty</groupId>
24
24
  <artifactId>jetty-server</artifactId>
25
- <version>9.2.10.v20150310</version>
25
+ <version>9.2.11.v20150529</version>
26
26
  </dependency>
27
27
 
28
28
  <dependency>
29
29
  <groupId>org.eclipse.jetty</groupId>
30
30
  <artifactId>jetty-webapp</artifactId>
31
- <version>9.2.10.v20150310</version>
31
+ <version>9.2.11.v20150529</version>
32
32
  </dependency>
33
33
 
34
34
  <dependency>
35
35
  <groupId>org.eclipse.jetty</groupId>
36
36
  <artifactId>jetty-util</artifactId>
37
- <version>9.2.10.v20150310</version>
37
+ <version>9.2.11.v20150529</version>
38
38
  </dependency>
39
39
 
40
40
  <dependency>
41
41
  <groupId>org.eclipse.jetty</groupId>
42
42
  <artifactId>jetty-rewrite</artifactId>
43
- <version>9.2.10.v20150310</version>
43
+ <version>9.2.11.v20150529</version>
44
44
  </dependency>
45
45
 
46
46
  <dependency>
47
47
  <groupId>org.eclipse.jetty</groupId>
48
48
  <artifactId>jetty-client</artifactId>
49
- <version>9.2.10.v20150310</version>
49
+ <version>9.2.11.v20150529</version>
50
50
  </dependency>
51
51
 
52
52
  <dependency>
53
53
  <groupId>org.eclipse.jetty</groupId>
54
54
  <artifactId>jetty-continuation</artifactId>
55
- <version>9.2.10.v20150310</version>
55
+ <version>9.2.11.v20150529</version>
56
56
  </dependency>
57
57
 
58
58
  </dependencies>
data/test/keystore ADDED
Binary file
data/test/test_jetty.rb CHANGED
@@ -73,6 +73,36 @@ class TestJetty < MiniTest::Unit::TestCase
73
73
  server.join
74
74
  end
75
75
 
76
+ def test_static_ssl
77
+ factory = default_factory
78
+ factory.connections = [ { scheme: 'tcp' },
79
+ { scheme: 'ssl',
80
+ key_store_path: 'test/keystore',
81
+ key_store_password: 'password'} ]
82
+ factory.static_contexts[ '/' ] = TEST_DIR
83
+ server = factory.create
84
+ server.start
85
+ port = server.connectors[1].local_port
86
+ test_text = get( '/test.txt', port, :ssl ).body
87
+ assert_equal( File.read( File.join( TEST_DIR, 'test.txt' ) ), test_text )
88
+ server.stop
89
+ server.join
90
+ end
91
+
92
+ def test_static_ssl_uri
93
+ factory = default_factory
94
+ factory.connections = [ 'tcp://0.0.0.0',
95
+ 'ssl://127.0.0.1?key_store_path=test/keystore&key_store_password=password' ]
96
+ factory.static_contexts[ '/' ] = TEST_DIR
97
+ server = factory.create
98
+ server.start
99
+ port = server.connectors[1].local_port
100
+ test_text = get( '/test.txt', port, :ssl ).body
101
+ assert_equal( File.read( File.join( TEST_DIR, 'test.txt' ) ), test_text )
102
+ server.stop
103
+ server.join
104
+ end
105
+
76
106
  class TestHandler < AbstractHandler
77
107
  TEST_TEXT = 'test handler text'
78
108
 
@@ -157,8 +187,12 @@ class TestJetty < MiniTest::Unit::TestCase
157
187
  server.join
158
188
  end
159
189
 
160
- def get( path, port )
161
- Net::HTTP.start( 'localhost', port ) do |http|
190
+ def get( path, port, scheme = :tcp )
191
+ args = [ 'localhost', port, nil, nil, nil, nil ]
192
+ if scheme == :ssl
193
+ args << { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE }
194
+ end
195
+ Net::HTTP.start( *args ) do |http|
162
196
  http.open_timeout = 1.0
163
197
  http.read_timeout = 1.0
164
198
  http.get( path )
data/webapps/test.war CHANGED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjack-jetty
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.10.0
4
+ version: 9.2.11.0
5
5
  platform: java
6
6
  authors:
7
7
  - David Kellum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-30 00:00:00.000000000 Z
11
+ date: 2015-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -106,21 +106,22 @@ files:
106
106
  - lib/rjack-jetty/base.rb
107
107
  - lib/rjack-jetty/client.rb
108
108
  - lib/rjack-jetty/javax.servlet-api-3.1.0.jar
109
- - lib/rjack-jetty/jetty-client-9.2.10.v20150310.jar
110
- - lib/rjack-jetty/jetty-continuation-9.2.10.v20150310.jar
111
- - lib/rjack-jetty/jetty-http-9.2.10.v20150310.jar
112
- - lib/rjack-jetty/jetty-io-9.2.10.v20150310.jar
113
- - lib/rjack-jetty/jetty-rewrite-9.2.10.v20150310.jar
114
- - lib/rjack-jetty/jetty-security-9.2.10.v20150310.jar
115
- - lib/rjack-jetty/jetty-server-9.2.10.v20150310.jar
116
- - lib/rjack-jetty/jetty-servlet-9.2.10.v20150310.jar
117
- - lib/rjack-jetty/jetty-util-9.2.10.v20150310.jar
118
- - lib/rjack-jetty/jetty-webapp-9.2.10.v20150310.jar
119
- - lib/rjack-jetty/jetty-xml-9.2.10.v20150310.jar
109
+ - lib/rjack-jetty/jetty-client-9.2.11.v20150529.jar
110
+ - lib/rjack-jetty/jetty-continuation-9.2.11.v20150529.jar
111
+ - lib/rjack-jetty/jetty-http-9.2.11.v20150529.jar
112
+ - lib/rjack-jetty/jetty-io-9.2.11.v20150529.jar
113
+ - lib/rjack-jetty/jetty-rewrite-9.2.11.v20150529.jar
114
+ - lib/rjack-jetty/jetty-security-9.2.11.v20150529.jar
115
+ - lib/rjack-jetty/jetty-server-9.2.11.v20150529.jar
116
+ - lib/rjack-jetty/jetty-servlet-9.2.11.v20150529.jar
117
+ - lib/rjack-jetty/jetty-util-9.2.11.v20150529.jar
118
+ - lib/rjack-jetty/jetty-webapp-9.2.11.v20150529.jar
119
+ - lib/rjack-jetty/jetty-xml-9.2.11.v20150529.jar
120
120
  - lib/rjack-jetty/rewrite.rb
121
121
  - lib/rjack-jetty/rjack-jetty-1.0.jar
122
122
  - lib/rjack-jetty/test-servlets.rb
123
123
  - pom.xml
124
+ - test/keystore
124
125
  - test/test.txt
125
126
  - test/test_jetty.rb
126
127
  - webapps/test.war
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
148
  version: '0'
148
149
  requirements: []
149
150
  rubyforge_project:
150
- rubygems_version: 2.4.5
151
+ rubygems_version: 2.4.6
151
152
  signing_key:
152
153
  specification_version: 4
153
154
  summary: A gem packaging of the Jetty Web Server for JRuby.