jetty 6.1.18.1 → 6.1.19.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Manifest.txt +3 -3
- data/README.txt +10 -10
- data/Rakefile +6 -7
- data/bin/jetty-service +4 -4
- data/lib/jetty.rb +22 -22
- data/lib/jetty/base.rb +1 -1
- data/lib/jetty/gravitext-testservlets-1.0.jar +0 -0
- data/lib/jetty/{jetty-6.1.18.jar → jetty-6.1.19.jar} +0 -0
- data/lib/jetty/{jetty-rewrite-handler-6.1.18.jar → jetty-rewrite-handler-6.1.19.jar} +0 -0
- data/lib/jetty/{jetty-util-6.1.18.jar → jetty-util-6.1.19.jar} +0 -0
- data/lib/jetty/test-servlets.rb +1 -1
- data/pom.xml +4 -4
- data/src/main/java/com/gravitext/testservlets/PerfTestServlet.java +23 -23
- data/src/main/java/com/gravitext/testservlets/SnoopServlet.java +7 -7
- data/test/test_jetty.rb +7 -10
- data/webapps/test.war +0 -0
- metadata +20 -17
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -16,8 +16,8 @@ test/test.txt
|
|
16
16
|
webapps/test.war
|
17
17
|
webapps/test/WEB-INF/web.xml
|
18
18
|
webapps/test/index.html
|
19
|
-
lib/jetty/jetty-6.1.
|
20
|
-
lib/jetty/jetty-util-6.1.
|
21
|
-
lib/jetty/jetty-rewrite-handler-6.1.
|
19
|
+
lib/jetty/jetty-6.1.19.jar
|
20
|
+
lib/jetty/jetty-util-6.1.19.jar
|
21
|
+
lib/jetty/jetty-rewrite-handler-6.1.19.jar
|
22
22
|
lib/jetty/servlet-api-2.5-20081211.jar
|
23
23
|
lib/jetty/gravitext-testservlets-1.0.jar
|
data/README.txt
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
== Description
|
7
7
|
|
8
|
-
A gem packaging of the {Jetty Web Server}[http://www.mortbay.org/jetty/]
|
8
|
+
A gem packaging of the {Jetty Web Server}[http://www.mortbay.org/jetty/]
|
9
9
|
for JRuby:
|
10
10
|
|
11
11
|
* Provides jetty, jetty-util, servlet-api, and jetty-rewrite-handler
|
12
12
|
jars.
|
13
|
-
* A Jetty::ServerFactory for simple programmatic server setup in ruby.
|
13
|
+
* A Jetty::ServerFactory for simple programmatic server setup in ruby.
|
14
14
|
* A set of Jetty::TestServlets containing a SnoopServlet and
|
15
15
|
PerfTestServlet (implemented in Java).
|
16
16
|
* A jetty-service bin script for easy testing from the command line.
|
@@ -47,8 +47,8 @@ or
|
|
47
47
|
|
48
48
|
No hard requirements, however:
|
49
49
|
|
50
|
-
* To load webapps with JSPs, the jetty-jsp[http://rjack.rubyforge.org/jetty-jsp/]
|
51
|
-
gem must be loaded.
|
50
|
+
* To load webapps with JSPs, the jetty-jsp[http://rjack.rubyforge.org/jetty-jsp/]
|
51
|
+
gem must be loaded.
|
52
52
|
* Jetty will log to slf4j[http://rjack.rubyforge.org/slf4j] if
|
53
53
|
loaded. The jetty-service script will attempt to load
|
54
54
|
logback[http://rjack.rubyforge.org/logback], and thus slf4j, if
|
@@ -79,7 +79,7 @@ Copyright (c) 1995-2006 Mort Bay Consulting Pty Ltd
|
|
79
79
|
Licensed under the Apache License, Version 2.0 (the "License");
|
80
80
|
you may not use this file except in compliance with the License.
|
81
81
|
You may obtain a copy of the License at
|
82
|
-
|
82
|
+
|
83
83
|
http://www.apache.org/licenses/LICENSE-2.0
|
84
84
|
|
85
85
|
Unless required by applicable law or agreed to in writing, software
|
@@ -92,16 +92,16 @@ The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
|
|
92
92
|
unless otherwise noted. It is licensed under the apache 2.0
|
93
93
|
license.
|
94
94
|
|
95
|
-
The javax.servlet package used by Jetty is copyright
|
96
|
-
Sun Microsystems, Inc and Apache Software Foundation. It is
|
95
|
+
The javax.servlet package used by Jetty is copyright
|
96
|
+
Sun Microsystems, Inc and Apache Software Foundation. It is
|
97
97
|
distributed under the Common Development and Distribution License.
|
98
|
-
You can obtain a copy of the license at
|
98
|
+
You can obtain a copy of the license at
|
99
99
|
https://glassfish.dev.java.net/public/CDDLv1.0.html.
|
100
100
|
|
101
101
|
The UnixCrypt.java code ~Implements the one way cryptography used by
|
102
102
|
Unix systems for simple password protection. Copyright 1996 Aki Yoshida,
|
103
103
|
modified April 2001 by Iris Van den Broeke, Daniel Deville.
|
104
|
-
Permission to use, copy, modify and distribute UnixCrypt
|
104
|
+
Permission to use, copy, modify and distribute UnixCrypt
|
105
105
|
for non-commercial or commercial purposes and without fee is
|
106
106
|
granted provided that the copyright notice appears in all copies.
|
107
107
|
|
@@ -110,7 +110,7 @@ from project Glassfish http://glassfish.dev.java.net. Copyright 2005
|
|
110
110
|
Sun Microsystems, Inc. and portions Copyright Apache Software Foundation.
|
111
111
|
|
112
112
|
Some portions of the code are Copyright:
|
113
|
-
2006 Tim Vernum
|
113
|
+
2006 Tim Vernum
|
114
114
|
1999 Jason Gilbert.
|
115
115
|
|
116
116
|
The jboss integration module contains some LGPL code.
|
data/Rakefile
CHANGED
@@ -23,17 +23,16 @@ require 'hoe'
|
|
23
23
|
$LOAD_PATH << './lib'
|
24
24
|
require 'jetty/base'
|
25
25
|
|
26
|
-
JARS = %w{ jetty jetty-util jetty-rewrite-handler }.map do |n|
|
27
|
-
"#{n}-#{ Jetty::JETTY_VERSION }.jar"
|
26
|
+
JARS = %w{ jetty jetty-util jetty-rewrite-handler }.map do |n|
|
27
|
+
"#{n}-#{ Jetty::JETTY_VERSION }.jar"
|
28
28
|
end
|
29
29
|
JARS << "servlet-api-#{ Jetty::SERVLET_API_VERSION }-#{ Jetty::SERVLET_API_DATE }.jar"
|
30
30
|
JARS << 'gravitext-testservlets-1.0.jar'
|
31
31
|
JAR_FILES = JARS.map { |jar| "lib/jetty/#{jar}" }
|
32
32
|
|
33
|
-
|
34
33
|
desc "Update the Manifest with actual jars"
|
35
34
|
task :manifest do
|
36
|
-
out = File.new( 'Manifest.txt', 'w' )
|
35
|
+
out = File.new( 'Manifest.txt', 'w' )
|
37
36
|
begin
|
38
37
|
out.write <<END
|
39
38
|
History.txt
|
@@ -63,9 +62,9 @@ end
|
|
63
62
|
|
64
63
|
ASSEMBLY = "target/gravitext-testservlets-1.0-bin.dir"
|
65
64
|
|
66
|
-
file 'webapps/test.war' => [ 'webapps/test/index.html',
|
65
|
+
file 'webapps/test.war' => [ 'webapps/test/index.html',
|
67
66
|
'webapps/test/WEB-INF/web.xml' ] do
|
68
|
-
sh( 'jar cvf webapps/test.war ' +
|
67
|
+
sh( 'jar cvf webapps/test.war ' +
|
69
68
|
'-C webapps/test index.html -C webapps/test WEB-INF/web.xml' )
|
70
69
|
end
|
71
70
|
|
@@ -85,7 +84,7 @@ task :mvn_clean do
|
|
85
84
|
rm_f( JAR_FILES + [ 'webapps/test.war' ] )
|
86
85
|
sh( 'mvn clean' )
|
87
86
|
end
|
88
|
-
task :clean => :mvn_clean
|
87
|
+
task :clean => :mvn_clean
|
89
88
|
|
90
89
|
task :tag do
|
91
90
|
tag = "jetty-#{Jetty::VERSION}"
|
data/bin/jetty-service
CHANGED
@@ -21,7 +21,7 @@ $LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
|
|
21
21
|
require 'rubygems'
|
22
22
|
|
23
23
|
begin
|
24
|
-
gem 'logback'
|
24
|
+
gem 'logback'
|
25
25
|
require 'logback'
|
26
26
|
Logback.configure do
|
27
27
|
console = Logback::ConsoleAppender.new do |a|
|
@@ -52,15 +52,15 @@ factory = Jetty::ServerFactory.new
|
|
52
52
|
factory.webapp_contexts[ '/' ] = Jetty::TestServlets::WEBAPP_TEST_EXPANDED
|
53
53
|
|
54
54
|
OptionParser.new do |opts|
|
55
|
-
opts.on( "-p", "--port N", Integer,
|
55
|
+
opts.on( "-p", "--port N", Integer,
|
56
56
|
"Port to listen on (default: auto)" ) do |v|
|
57
57
|
factory.port = v
|
58
58
|
end
|
59
|
-
opts.on( "-t", "--threads N", Integer,
|
59
|
+
opts.on( "-t", "--threads N", Integer,
|
60
60
|
"Maximum pool threads (default: #{factory.max_threads})" ) do |v|
|
61
61
|
factory.max_threads = v
|
62
62
|
end
|
63
|
-
opts.on( "-w", "--webapp PATH",
|
63
|
+
opts.on( "-w", "--webapp PATH",
|
64
64
|
"Load PATH as root context webapp. (default: gem test.war)" ) do |v|
|
65
65
|
factory.webapp_contexts[ '/' ] = v
|
66
66
|
end
|
data/lib/jetty.rb
CHANGED
@@ -27,7 +27,7 @@ module Jetty
|
|
27
27
|
require_jar 'jetty'
|
28
28
|
require_jar 'jetty-util'
|
29
29
|
|
30
|
-
require File.join( JETTY_DIR,
|
30
|
+
require File.join( JETTY_DIR,
|
31
31
|
"servlet-api-#{ SERVLET_API_VERSION }-#{ SERVLET_API_DATE }.jar" )
|
32
32
|
|
33
33
|
import 'org.mortbay.jetty.Connector'
|
@@ -45,7 +45,7 @@ module Jetty
|
|
45
45
|
import 'org.mortbay.jetty.servlet.ServletHolder'
|
46
46
|
import 'org.mortbay.jetty.webapp.WebAppContext'
|
47
47
|
import 'org.mortbay.thread.QueuedThreadPool'
|
48
|
-
|
48
|
+
|
49
49
|
# A factory for creating complete org.morbay.jetty.Server
|
50
50
|
# instances. Provides a general purpose facade for setup including
|
51
51
|
# the Server, a ThreadPool, a Connector, and various Handlers. It
|
@@ -60,7 +60,7 @@ module Jetty
|
|
60
60
|
#
|
61
61
|
# # Set static resource context mapping URI to directory
|
62
62
|
# factory.static_contexts[ '/html' ] = '/var/www/html'
|
63
|
-
#
|
63
|
+
#
|
64
64
|
# # Implement custom handler and register it.
|
65
65
|
# import 'org.mortbay.jetty.handler.AbstractHandler'
|
66
66
|
# class RedirectHandler < AbstractHandler
|
@@ -73,17 +73,17 @@ module Jetty
|
|
73
73
|
# def handle( target, request, response, dispatch )
|
74
74
|
# goto = @redirects[ target ]
|
75
75
|
# unless goto.nil?
|
76
|
-
# response.send_redirect( goto )
|
76
|
+
# response.send_redirect( goto )
|
77
77
|
# request.handled = true
|
78
78
|
# end
|
79
79
|
# end
|
80
80
|
# end
|
81
|
-
#
|
81
|
+
#
|
82
82
|
# def factory.create_pre_handlers
|
83
83
|
# [ RedirectHandler.new( '/' => '/html/' ) ] + super
|
84
84
|
# end
|
85
85
|
#
|
86
|
-
# # Create a webapp context (war file or webapp expanded)
|
86
|
+
# # Create a webapp context (war file or webapp expanded)
|
87
87
|
# factory.webapp_contexts[ '/test' ] = Jetty::TestServlets::WEBAPP_TEST_WAR
|
88
88
|
#
|
89
89
|
# # Create a context for a custom HelloServlet
|
@@ -94,9 +94,9 @@ module Jetty
|
|
94
94
|
# response.writer.write( 'Hello World!' )
|
95
95
|
# end
|
96
96
|
# end
|
97
|
-
#
|
97
|
+
#
|
98
98
|
# factory.set_context_servlets( '/hello', { '/*' => HelloServlet.new } )
|
99
|
-
#
|
99
|
+
#
|
100
100
|
# # Create, start, and join (wait for shutdown)
|
101
101
|
# server = factory.create
|
102
102
|
# server.start
|
@@ -113,10 +113,10 @@ module Jetty
|
|
113
113
|
|
114
114
|
def initialize
|
115
115
|
@port = 0 # Use any available port
|
116
|
-
@max_threads = 20
|
116
|
+
@max_threads = 20
|
117
117
|
@low_threads = 0 # No low thread threshold
|
118
118
|
@min_threads = nil # Compute from max_threads
|
119
|
-
@max_idle_time_ms = 10000
|
119
|
+
@max_idle_time_ms = 10000
|
120
120
|
@static_contexts = {}
|
121
121
|
@static_welcome_files = [ 'index.html' ]
|
122
122
|
@webapp_contexts = {}
|
@@ -124,7 +124,7 @@ module Jetty
|
|
124
124
|
@servlet_contexts = {}
|
125
125
|
@stop_at_shutdown = true
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
# Returns a new org.morbay.jetty.Server that is ready to
|
129
129
|
# be started.
|
130
130
|
def create
|
@@ -137,13 +137,13 @@ module Jetty
|
|
137
137
|
hcol = HandlerCollection.new
|
138
138
|
hcol.handlers = create_handlers.compact.to_java( Handler )
|
139
139
|
server.handler = hcol
|
140
|
-
|
140
|
+
|
141
141
|
server.stop_at_shutdown = @stop_at_shutdown
|
142
142
|
|
143
143
|
server
|
144
144
|
end
|
145
|
-
|
146
|
-
# Return a org.mortbay.thread.ThreadPool implementation.
|
145
|
+
|
146
|
+
# Return a org.mortbay.thread.ThreadPool implementation.
|
147
147
|
#
|
148
148
|
# This implementation creates a QueuedThreadPool with min_threads
|
149
149
|
# (default max_threads / 4), any low_threads, and max_threads
|
@@ -169,7 +169,7 @@ module Jetty
|
|
169
169
|
end
|
170
170
|
|
171
171
|
# Returns an Array of org.mortbay.jetty.Handler instances.
|
172
|
-
#
|
172
|
+
#
|
173
173
|
# This implementation concatenates create_pre_handlers and
|
174
174
|
# create_post_handlers.
|
175
175
|
def create_handlers
|
@@ -187,21 +187,21 @@ module Jetty
|
|
187
187
|
create_context_handlers( ctx_handlers )
|
188
188
|
h = ctx_handlers.handlers
|
189
189
|
if( h.nil? || h.length == 0 )
|
190
|
-
[ ]
|
190
|
+
[ ]
|
191
191
|
else
|
192
192
|
[ ctx_handlers ]
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
196
|
# Returns an Array of "post" org.mortbay.jetty.Handler instances.
|
197
|
-
#
|
197
|
+
#
|
198
198
|
# This implementation returns a DefaultHandler instance, and any
|
199
199
|
# handler returned by create_request_log_handler.
|
200
200
|
def create_post_handlers
|
201
201
|
[ DefaultHandler.new, # Handle errors, etc.
|
202
202
|
create_request_log_handler ]
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
# Create context handlers on the provided ContextHandlerCollection
|
206
206
|
#
|
207
207
|
# This implementation calls create_static_contexts,
|
@@ -218,14 +218,14 @@ module Jetty
|
|
218
218
|
ch = ContextHandler.new( context_handler_collection, ctx )
|
219
219
|
ch.resource_base = rpath
|
220
220
|
ch.handler = ResourceHandler.new
|
221
|
-
ch.handler.welcome_files =
|
221
|
+
ch.handler.welcome_files =
|
222
222
|
@static_welcome_files.to_java( java.lang.String )
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
226
|
# Set a context of servlets given context_path, a servlets hash
|
227
227
|
# (mapping path to Servlet), and options.
|
228
|
-
def set_context_servlets( context_path, servlets,
|
228
|
+
def set_context_servlets( context_path, servlets,
|
229
229
|
options = Context::NO_SESSIONS )
|
230
230
|
@servlet_contexts[ context_path ] = [ servlets, options ]
|
231
231
|
end
|
@@ -246,7 +246,7 @@ module Jetty
|
|
246
246
|
@webapp_contexts.each do |ctx, webapp_path|
|
247
247
|
WebAppContext.new( context_handler_collection, webapp_path, ctx )
|
248
248
|
end
|
249
|
-
end
|
249
|
+
end
|
250
250
|
|
251
251
|
# Create RequestLogHandler from any set request_log_file
|
252
252
|
def create_request_log_handler
|
@@ -264,6 +264,6 @@ module Jetty
|
|
264
264
|
log.append = true;
|
265
265
|
log
|
266
266
|
end
|
267
|
-
|
267
|
+
|
268
268
|
end
|
269
269
|
end
|
data/lib/jetty/base.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/jetty/test-servlets.rb
CHANGED
data/pom.xml
CHANGED
@@ -12,19 +12,19 @@
|
|
12
12
|
<dependency>
|
13
13
|
<groupId>org.mortbay.jetty</groupId>
|
14
14
|
<artifactId>jetty</artifactId>
|
15
|
-
<version>6.1.
|
15
|
+
<version>6.1.19</version>
|
16
16
|
</dependency>
|
17
17
|
|
18
18
|
<dependency>
|
19
19
|
<groupId>org.mortbay.jetty</groupId>
|
20
20
|
<artifactId>jetty-util</artifactId>
|
21
|
-
<version>6.1.
|
21
|
+
<version>6.1.19</version>
|
22
22
|
</dependency>
|
23
23
|
|
24
24
|
<dependency>
|
25
25
|
<groupId>org.mortbay.jetty</groupId>
|
26
26
|
<artifactId>jetty-rewrite-handler</artifactId>
|
27
|
-
<version>6.1.
|
27
|
+
<version>6.1.19</version>
|
28
28
|
</dependency>
|
29
29
|
|
30
30
|
</dependencies>
|
@@ -64,4 +64,4 @@
|
|
64
64
|
</plugins>
|
65
65
|
</build>
|
66
66
|
|
67
|
-
</project>
|
67
|
+
</project>
|
@@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
27
27
|
import javax.servlet.http.HttpServletResponse;
|
28
28
|
|
29
29
|
/**
|
30
|
-
* Servlet for perform and chunked output testing.
|
30
|
+
* Servlet for perform and chunked output testing.
|
31
31
|
* @author David Kellum
|
32
32
|
*/
|
33
33
|
public class PerfTestServlet extends HttpServlet
|
@@ -39,13 +39,13 @@ public class PerfTestServlet extends HttpServlet
|
|
39
39
|
{
|
40
40
|
int delayConst = getParam( req, "delay", 0 );
|
41
41
|
int delayRandom = getParam( req, "rdelay", 0 );
|
42
|
-
|
42
|
+
|
43
43
|
int burnConst = getParam( req, "burn", 0 );
|
44
44
|
int burnRandom = getParam( req, "rburn", 0 );
|
45
|
-
|
45
|
+
|
46
46
|
int size = getParam( req, "size", 0 );
|
47
47
|
int sizeRandom = getParam( req, "rsize", 0 );
|
48
|
-
|
48
|
+
|
49
49
|
int count = getParam( req, "count", 0 );
|
50
50
|
count += random( getParam( req, "rcount", 0 ) );
|
51
51
|
|
@@ -68,16 +68,16 @@ public class PerfTestServlet extends HttpServlet
|
|
68
68
|
out.println( "<tr><td>burn</td><td>Constant chunk CPU burn time in ms</td></tr>" );
|
69
69
|
out.println( "<tr><td>rburn</td><td>Random [0,n) chunk burn time in ms</td></tr>" );
|
70
70
|
out.println( "</table>" );
|
71
|
-
|
71
|
+
|
72
72
|
out.println( "<h2>Output</h2>" );
|
73
73
|
out.flush();
|
74
|
-
|
74
|
+
|
75
75
|
out.println( "<p>Writing " + count + " (delayed) chunks...</p>" );
|
76
76
|
out.flush();
|
77
77
|
|
78
78
|
try {
|
79
79
|
for( int b = 0; b < count; ++b ) {
|
80
|
-
|
80
|
+
|
81
81
|
long delay = delayConst + random( delayRandom );
|
82
82
|
if( delay > 0 ) Thread.sleep( delay );
|
83
83
|
|
@@ -85,7 +85,7 @@ public class PerfTestServlet extends HttpServlet
|
|
85
85
|
if( burn > 0 ) {
|
86
86
|
delay += burnTime( burn );
|
87
87
|
}
|
88
|
-
|
88
|
+
|
89
89
|
out.println( "<p>(Delayed " + delay + " ms) " );
|
90
90
|
|
91
91
|
int f = size + random( sizeRandom );
|
@@ -103,7 +103,7 @@ public class PerfTestServlet extends HttpServlet
|
|
103
103
|
out.println( "</html>" );
|
104
104
|
out.flush();
|
105
105
|
}
|
106
|
-
|
106
|
+
|
107
107
|
private long burnTime( int burn_ms )
|
108
108
|
{
|
109
109
|
long prime = 2;
|
@@ -112,7 +112,7 @@ public class PerfTestServlet extends HttpServlet
|
|
112
112
|
long last = 0;
|
113
113
|
do {
|
114
114
|
prime = BigInteger.probablePrime( 64, new Random() ).longValue();
|
115
|
-
last = System.currentTimeMillis();
|
115
|
+
last = System.currentTimeMillis();
|
116
116
|
} while( last < endTime );
|
117
117
|
|
118
118
|
if( prime == 2 ) {
|
@@ -121,32 +121,32 @@ public class PerfTestServlet extends HttpServlet
|
|
121
121
|
return last - begin;
|
122
122
|
}
|
123
123
|
|
124
|
-
private int getParam( HttpServletRequest req, String name, int defVal )
|
124
|
+
private int getParam( HttpServletRequest req, String name, int defVal )
|
125
125
|
{
|
126
126
|
int value = defVal;
|
127
127
|
String strVal = req.getParameter( name );
|
128
128
|
if( strVal != null ) {
|
129
|
-
value = Integer.parseInt( strVal );
|
129
|
+
value = Integer.parseInt( strVal );
|
130
130
|
}
|
131
|
-
|
131
|
+
|
132
132
|
return value;
|
133
133
|
}
|
134
|
-
|
134
|
+
|
135
135
|
private int random( int range )
|
136
136
|
{
|
137
137
|
Random _random = new Random();
|
138
138
|
if( range > 0 ) return _random.nextInt( range );
|
139
139
|
return 0;
|
140
140
|
}
|
141
|
-
|
142
|
-
private static final String FILLER =
|
143
|
-
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
|
144
|
-
"sed do eiusmod tempor incididunt ut labore et dolore magna " +
|
145
|
-
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation " +
|
146
|
-
"ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis " +
|
147
|
-
"aute irure dolor in reprehenderit in voluptate velit esse cillum " +
|
148
|
-
"dolore eu fugiat nulla pariatur. Excepteur sint occaecat " +
|
149
|
-
"cupidatat non proident, sunt in culpa qui officia deserunt " +
|
141
|
+
|
142
|
+
private static final String FILLER =
|
143
|
+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
|
144
|
+
"sed do eiusmod tempor incididunt ut labore et dolore magna " +
|
145
|
+
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation " +
|
146
|
+
"ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis " +
|
147
|
+
"aute irure dolor in reprehenderit in voluptate velit esse cillum " +
|
148
|
+
"dolore eu fugiat nulla pariatur. Excepteur sint occaecat " +
|
149
|
+
"cupidatat non proident, sunt in culpa qui officia deserunt " +
|
150
150
|
"mollit anim id est laborum. ";
|
151
151
|
|
152
152
|
private static final long serialVersionUID = 1L;
|
@@ -30,7 +30,7 @@ public class SnoopServlet extends HttpServlet
|
|
30
30
|
{
|
31
31
|
|
32
32
|
@Override
|
33
|
-
protected void doGet( HttpServletRequest request,
|
33
|
+
protected void doGet( HttpServletRequest request,
|
34
34
|
HttpServletResponse response )
|
35
35
|
throws ServletException, IOException
|
36
36
|
{
|
@@ -56,7 +56,7 @@ public class SnoopServlet extends HttpServlet
|
|
56
56
|
writeRow( out, "Auth Type", request.getAuthType() );
|
57
57
|
writeRow( out, "Remote User", request.getRemoteUser() );
|
58
58
|
out.println( "</table>" );
|
59
|
-
|
59
|
+
|
60
60
|
writeTableHeader( out, "Request Headers", "Header" );
|
61
61
|
Enumeration<?> hNames = request.getHeaderNames();
|
62
62
|
while( hNames.hasMoreElements() ) {
|
@@ -65,7 +65,7 @@ public class SnoopServlet extends HttpServlet
|
|
65
65
|
writeRow( out, hname, hvalue );
|
66
66
|
}
|
67
67
|
out.println( "</table>" );
|
68
|
-
|
68
|
+
|
69
69
|
Cookie[] cookies = request.getCookies();
|
70
70
|
if (cookies != null) {
|
71
71
|
writeTableHeader( out, "Cookies", "Cookie" );
|
@@ -74,13 +74,13 @@ public class SnoopServlet extends HttpServlet
|
|
74
74
|
}
|
75
75
|
out.println( "</table>" );
|
76
76
|
}
|
77
|
-
|
77
|
+
|
78
78
|
out.println( "</body>" );
|
79
79
|
out.println( "</html>" );
|
80
80
|
out.close();
|
81
81
|
}
|
82
82
|
|
83
|
-
private void writeTableHeader( PrintWriter out,
|
83
|
+
private void writeTableHeader( PrintWriter out,
|
84
84
|
String heading, String name )
|
85
85
|
{
|
86
86
|
out.println( "<h2>" + heading + "</h2>" );
|
@@ -89,9 +89,9 @@ public class SnoopServlet extends HttpServlet
|
|
89
89
|
|
90
90
|
private void writeRow( PrintWriter out, String name, String value )
|
91
91
|
{
|
92
|
-
out.println( String.format( "<tr><td>%s</td><td>%s</td></tr>",
|
92
|
+
out.println( String.format( "<tr><td>%s</td><td>%s</td></tr>",
|
93
93
|
name, value ) );
|
94
94
|
}
|
95
|
-
|
95
|
+
|
96
96
|
private static final long serialVersionUID = 1L;
|
97
97
|
}
|
data/test/test_jetty.rb
CHANGED
@@ -26,7 +26,7 @@ require 'rubygems'
|
|
26
26
|
begin
|
27
27
|
gem( 'slf4j', '~> 1.5' )
|
28
28
|
require 'slf4j'
|
29
|
-
require 'slf4j/nop'
|
29
|
+
require 'slf4j/nop'
|
30
30
|
rescue Gem::LoadError
|
31
31
|
end
|
32
32
|
|
@@ -68,7 +68,6 @@ class TestJetty < Test::Unit::TestCase
|
|
68
68
|
server.stop
|
69
69
|
end
|
70
70
|
|
71
|
-
|
72
71
|
import 'org.mortbay.jetty.handler.AbstractHandler'
|
73
72
|
class TestHandler < AbstractHandler
|
74
73
|
TEST_TEXT = 'test handler text'
|
@@ -80,7 +79,6 @@ class TestJetty < Test::Unit::TestCase
|
|
80
79
|
end
|
81
80
|
end
|
82
81
|
|
83
|
-
|
84
82
|
def test_custom_handler
|
85
83
|
factory = default_factory
|
86
84
|
def factory.create_pre_handlers
|
@@ -89,12 +87,11 @@ class TestJetty < Test::Unit::TestCase
|
|
89
87
|
server = factory.create
|
90
88
|
server.start
|
91
89
|
port = server.connectors[0].local_port
|
92
|
-
assert_equal( TestHandler::TEST_TEXT,
|
90
|
+
assert_equal( TestHandler::TEST_TEXT,
|
93
91
|
Net::HTTP.get( 'localhost', '/whatever', port ) )
|
94
92
|
server.stop
|
95
93
|
end
|
96
94
|
|
97
|
-
|
98
95
|
import 'javax.servlet.http.HttpServlet'
|
99
96
|
class TestServlet < HttpServlet
|
100
97
|
def initialize( text )
|
@@ -110,11 +107,11 @@ class TestJetty < Test::Unit::TestCase
|
|
110
107
|
|
111
108
|
def test_servlet_handler
|
112
109
|
factory = default_factory
|
113
|
-
factory.set_context_servlets( '/some',
|
110
|
+
factory.set_context_servlets( '/some',
|
114
111
|
{ '/test' => TestServlet.new( 'resp-test' ),
|
115
112
|
'/other' => TestServlet.new( 'resp-other' ) } )
|
116
113
|
|
117
|
-
factory.set_context_servlets( '/',
|
114
|
+
factory.set_context_servlets( '/',
|
118
115
|
{ '/one' => TestServlet.new( 'resp-one' ),
|
119
116
|
'/snoop' => Jetty::TestServlets::SnoopServlet.new } )
|
120
117
|
|
@@ -124,11 +121,11 @@ class TestJetty < Test::Unit::TestCase
|
|
124
121
|
|
125
122
|
assert_equal( 'resp-test',
|
126
123
|
Net::HTTP.get( 'localhost', '/some/test', port ) )
|
127
|
-
assert_equal( 'resp-other',
|
124
|
+
assert_equal( 'resp-other',
|
128
125
|
Net::HTTP.get( 'localhost', '/some/other', port ) )
|
129
126
|
assert_equal( 'resp-one',
|
130
127
|
Net::HTTP.get( 'localhost', '/one', port ) )
|
131
|
-
|
128
|
+
|
132
129
|
response = Net::HTTP.get_response( 'localhost', '/', port )
|
133
130
|
assert( response.is_a?( Net::HTTPNotFound ) )
|
134
131
|
|
@@ -140,7 +137,7 @@ class TestJetty < Test::Unit::TestCase
|
|
140
137
|
|
141
138
|
def test_webapp
|
142
139
|
factory = default_factory
|
143
|
-
index_html = File.read(
|
140
|
+
index_html = File.read(
|
144
141
|
File.join( Jetty::TestServlets::WEBAPP_TEST_EXPANDED, 'index.html' ) )
|
145
142
|
|
146
143
|
factory.webapp_contexts[ '/test' ] = Jetty::TestServlets::WEBAPP_TEST_WAR
|
data/webapps/test.war
CHANGED
Binary file
|
metadata
CHANGED
@@ -9,8 +9,9 @@ email:
|
|
9
9
|
- dek-oss@gravitext.com
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
summary: 'A gem packaging of the {Jetty Web Server}[http://www.mortbay.org/jetty/]
|
13
|
-
JRuby: * Provides jetty, jetty-util, servlet-api, and jetty-rewrite-handler
|
12
|
+
summary: 'A gem packaging of the {Jetty Web Server}[http://www.mortbay.org/jetty/]
|
13
|
+
for JRuby: * Provides jetty, jetty-util, servlet-api, and jetty-rewrite-handler
|
14
|
+
jars'
|
14
15
|
post_install_message:
|
15
16
|
extra_rdoc_files:
|
16
17
|
- History.txt
|
@@ -22,18 +23,20 @@ name: jetty
|
|
22
23
|
rdoc_options:
|
23
24
|
- --main
|
24
25
|
- README.txt
|
25
|
-
autorequire:
|
26
26
|
rubyforge_project: rjack
|
27
|
+
autorequire:
|
28
|
+
licenses: []
|
29
|
+
|
27
30
|
executables:
|
28
31
|
- jetty-service
|
29
|
-
description:
|
30
|
-
JRuby
|
31
|
-
* A Jetty::ServerFactory for simple programmatic server setup in ruby
|
32
|
-
of Jetty::TestServlets containing a SnoopServlet and
|
33
|
-
in Java)
|
34
|
-
that JSP support is provided separately in the companion
|
35
|
-
gem.
|
36
|
-
specification_version:
|
32
|
+
description: "A gem packaging of the {Jetty Web Server}[http://www.mortbay.org/jetty/]\n\
|
33
|
+
for JRuby:\n\n* Provides jetty, jetty-util, servlet-api, and jetty-rewrite-handler\n\
|
34
|
+
\ jars.\n* A Jetty::ServerFactory for simple programmatic server setup in ruby.\n\
|
35
|
+
* A set of Jetty::TestServlets containing a SnoopServlet and\n PerfTestServlet \
|
36
|
+
(implemented in Java).\n* A jetty-service bin script for easy testing from the command \
|
37
|
+
line.\n\nNote that JSP support is provided separately in the companion\njetty-jsp[http://rjack.rubyforge.org/jetty-jsp/] \
|
38
|
+
gem."
|
39
|
+
specification_version: 3
|
37
40
|
default_executable:
|
38
41
|
files:
|
39
42
|
- History.txt
|
@@ -54,9 +57,9 @@ files:
|
|
54
57
|
- webapps/test.war
|
55
58
|
- webapps/test/WEB-INF/web.xml
|
56
59
|
- webapps/test/index.html
|
57
|
-
- lib/jetty/jetty-6.1.
|
58
|
-
- lib/jetty/jetty-util-6.1.
|
59
|
-
- lib/jetty/jetty-rewrite-handler-6.1.
|
60
|
+
- lib/jetty/jetty-6.1.19.jar
|
61
|
+
- lib/jetty/jetty-util-6.1.19.jar
|
62
|
+
- lib/jetty/jetty-rewrite-handler-6.1.19.jar
|
60
63
|
- lib/jetty/servlet-api-2.5-20081211.jar
|
61
64
|
- lib/jetty/gravitext-testservlets-1.0.jar
|
62
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -67,17 +70,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
70
|
version:
|
68
71
|
extensions: []
|
69
72
|
|
70
|
-
rubygems_version: 1.3.
|
73
|
+
rubygems_version: 1.3.3
|
71
74
|
requirements: []
|
72
75
|
|
73
76
|
authors:
|
74
77
|
- David Kellum
|
75
|
-
date: 2009-
|
78
|
+
date: 2009-07-22 07:00:00 +00:00
|
76
79
|
platform: ruby
|
77
80
|
test_files:
|
78
81
|
- test/test_jetty.rb
|
79
82
|
version: !ruby/object:Gem::Version
|
80
|
-
version: 6.1.
|
83
|
+
version: 6.1.19.1
|
81
84
|
require_paths:
|
82
85
|
- lib
|
83
86
|
dependencies:
|