jetty-rails 0.7 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/TODO.txt +1 -3
- data/lib/jetty_rails/handler/web_app_handler.rb +25 -9
- data/lib/jetty_rails/jars.rb +1 -0
- data/lib/jetty_rails/runner.rb +1 -1
- data/lib/jetty_rails/version.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/TODO.txt
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
== TODO never ends...
|
2
2
|
|
3
3
|
* Improve RDocs
|
4
|
-
* configuration defaults (web.xml, classes dir, lib dir, ...)
|
5
4
|
* integration test for lib_dir jars loading
|
6
5
|
* read configuration from warble.rb
|
7
6
|
* install custom resources from warbler configuration
|
8
|
-
* more command line options: --daemon, --num-instances
|
9
7
|
* add custom classes from warble.rb to the context classpath
|
10
8
|
* add custom jars from warble.rb to the context classpath
|
11
|
-
*
|
9
|
+
* support config/web.xml.erb
|
12
10
|
* read any custom jetty.xml
|
13
11
|
* support jetty-plus features (i.e.: jndi)
|
@@ -7,23 +7,23 @@ module JettyRails
|
|
7
7
|
super("/", config[:context_path])
|
8
8
|
@config = config
|
9
9
|
|
10
|
-
|
11
|
-
self.
|
12
|
-
|
13
|
-
self.resource_base = config[:base]
|
10
|
+
self.class_loader = each_context_has_its_own_classloader
|
11
|
+
self.resource_base = "#{config[:base]}/public"
|
14
12
|
self.descriptor = config[:web_xml]
|
15
13
|
|
16
14
|
add_classes_dir_to_classpath(config)
|
17
15
|
add_lib_dir_jars_to_classpath(config)
|
18
|
-
|
16
|
+
|
19
17
|
@adapter = adapter_for(config[:adapter])
|
20
18
|
self.init_params = @adapter.init_params
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
unless File.exist?(self.descriptor)
|
21
|
+
@adapter.event_listeners.each do |listener|
|
22
|
+
add_event_listener(listener)
|
23
|
+
end
|
25
24
|
|
26
|
-
|
25
|
+
add_filter(rack_filter, "/*", Jetty::Context::DEFAULT)
|
26
|
+
end
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.add_adapter(adapter_key, adapter)
|
@@ -40,6 +40,13 @@ module JettyRails
|
|
40
40
|
def adapters
|
41
41
|
self.class.adapters
|
42
42
|
end
|
43
|
+
|
44
|
+
alias :get_from_public_otherwise :getResource
|
45
|
+
|
46
|
+
def getResource(resource)
|
47
|
+
return fix_for_base_url if resource == '/'
|
48
|
+
get_from_public_otherwise resource
|
49
|
+
end
|
43
50
|
|
44
51
|
protected
|
45
52
|
def rack_filter
|
@@ -51,6 +58,10 @@ module JettyRails
|
|
51
58
|
end
|
52
59
|
|
53
60
|
private
|
61
|
+
def fix_for_base_url
|
62
|
+
Jetty::FileResource.new(java.io.File.new(config[:base]).to_url)
|
63
|
+
end
|
64
|
+
|
54
65
|
def add_lib_dir_jars_to_classpath(config)
|
55
66
|
lib_dir = "#{config[:base]}/#{config[:lib_dir]}/**/*.jar"
|
56
67
|
Dir[lib_dir].each do |jar|
|
@@ -58,11 +69,16 @@ module JettyRails
|
|
58
69
|
self.class_loader.add_url(url)
|
59
70
|
end
|
60
71
|
end
|
72
|
+
|
61
73
|
def add_classes_dir_to_classpath(config)
|
62
74
|
classes_dir = "#{config[:base]}/#{config[:classes_dir]}"
|
63
75
|
url = java.io.File.new(classes_dir).to_url
|
64
76
|
self.class_loader.add_url(url)
|
65
77
|
end
|
78
|
+
|
79
|
+
def each_context_has_its_own_classloader()
|
80
|
+
org.jruby.util.JRubyClassLoader.new(JRuby.runtime.jruby_class_loader)
|
81
|
+
end
|
66
82
|
end
|
67
83
|
end
|
68
84
|
end
|
data/lib/jetty_rails/jars.rb
CHANGED
@@ -11,6 +11,7 @@ module JettyRails
|
|
11
11
|
include_package "org.mortbay.jetty"
|
12
12
|
include_package "org.mortbay.jetty.servlet"
|
13
13
|
include_package "org.mortbay.jetty.nio"
|
14
|
+
include_package "org.mortbay.resource"
|
14
15
|
module Handler
|
15
16
|
include_package "org.mortbay.jetty.handler"
|
16
17
|
include_package "org.mortbay.jetty.webapp"
|
data/lib/jetty_rails/runner.rb
CHANGED
data/lib/jetty_rails/version.rb
CHANGED
metadata
CHANGED
@@ -6,11 +6,11 @@ executables:
|
|
6
6
|
- jetty_merb
|
7
7
|
- jetty_rails
|
8
8
|
version: !ruby/object:Gem::Version
|
9
|
-
version: "0.
|
9
|
+
version: "0.8"
|
10
10
|
post_install_message: |
|
11
11
|
|
12
12
|
For more information on jetty-rails, see http://jetty-rails.rubyforge.org
|
13
|
-
date: 2008-
|
13
|
+
date: 2008-12-02 02:00:00 +00:00
|
14
14
|
files:
|
15
15
|
- History.txt
|
16
16
|
- Licenses.txt
|