jetty-rails 0.7 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 0.8
2
+ * reading config/web.xml file (not yet supporting config/web.xml.erb)
3
+ * supporting /public/WEB-INF dir for custom web resources (config files and taglibs)
4
+
1
5
  == 0.7
2
6
  * Merb 1.0 support!
3
7
  * jruby-rack updated to the latest release (0.9.3)
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
- * load web.xml (or web.erb.xml) from config/web.xml
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
- # create an isolated classloader per application context
11
- self.class_loader = org.jruby.util.JRubyClassLoader.new(JRuby.runtime.jruby_class_loader)
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
- @adapter.event_listeners.each do |listener|
23
- add_event_listener(listener)
24
- end
20
+ unless File.exist?(self.descriptor)
21
+ @adapter.event_listeners.each do |listener|
22
+ add_event_listener(listener)
23
+ end
25
24
 
26
- add_filter(rack_filter, "/*", Jetty::Context::DEFAULT)
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
@@ -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"
@@ -28,7 +28,7 @@ module JettyRails
28
28
  def start
29
29
  server_threads = ThreadGroup.new
30
30
  @servers.each do |base, server|
31
- log("starting #{base}")
31
+ log("Starting server #{base}")
32
32
  server_threads.add(Thread.new do
33
33
  server.start
34
34
  end)
@@ -1,7 +1,7 @@
1
1
  module JettyRails #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 7
4
+ MINOR = 8
5
5
 
6
6
  STRING = [MAJOR, MINOR].join('.')
7
7
  end
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.7"
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-11-28 02:00:00 +00:00
13
+ date: 2008-12-02 02:00:00 +00:00
14
14
  files:
15
15
  - History.txt
16
16
  - Licenses.txt