Class: JettyRails::Handler::WebAppHandler
- Inherits:
-
Jetty::Handler::WebAppContext
- Object
- Jetty::Handler::WebAppContext
- JettyRails::Handler::WebAppHandler
- Defined in:
- lib/jetty_rails/handler/web_app_handler.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #adapters ⇒ Object
- #get_from_public_otherwise ⇒ Object
- #getResource(resource) ⇒ Object
-
#initialize(config) ⇒ WebAppHandler
constructor
A new instance of WebAppHandler.
Constructor Details
#initialize(config) ⇒ WebAppHandler
Returns a new instance of WebAppHandler.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jetty_rails/handler/web_app_handler.rb', line 6 def initialize(config) super("/", config[:context_path]) @config = config self.class_loader = each_context_has_its_own_classloader self.resource_base = "#{config[:base]}/public" self.descriptor = config[:web_xml] add_classes_dir_to_classpath(config) add_lib_dir_jars_to_classpath(config) @adapter = adapter_for(config[:adapter]) self.init_params = @adapter.init_params unless File.exist?(self.descriptor) @adapter.event_listeners.each do |listener| add_event_listener(listener) end add_filter(rack_filter, "/*", Jetty::Context::DEFAULT) end end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
4 5 6 |
# File 'lib/jetty_rails/handler/web_app_handler.rb', line 4 def adapter @adapter end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/jetty_rails/handler/web_app_handler.rb', line 4 def config @config end |
Class Method Details
.adapters ⇒ Object
33 34 35 36 37 38 |
# File 'lib/jetty_rails/handler/web_app_handler.rb', line 33 def self.adapters @adapters ||= { :rails => JettyRails::Adapters::RailsAdapter, :merb => JettyRails::Adapters::MerbAdapter } end |
.add_adapter(adapter_key, adapter) ⇒ Object
29 30 31 |
# File 'lib/jetty_rails/handler/web_app_handler.rb', line 29 def self.add_adapter(adapter_key, adapter) adapters[adapter_key] = adapter end |
Instance Method Details
#adapters ⇒ Object
40 41 42 |
# File 'lib/jetty_rails/handler/web_app_handler.rb', line 40 def adapters self.class.adapters end |
#get_from_public_otherwise ⇒ Object
44 |
# File 'lib/jetty_rails/handler/web_app_handler.rb', line 44 alias :get_from_public_otherwise :getResource |
#getResource(resource) ⇒ Object
46 47 48 49 |
# File 'lib/jetty_rails/handler/web_app_handler.rb', line 46 def getResource(resource) return fix_for_base_url if resource == '/' get_from_public_otherwise resource end |