Class JettyRails::Handler::WebAppHandler
In: lib/jetty_rails/handler/web_app_handler.rb
Parent: Jetty::Handler::WebAppContext

Methods

External Aliases

getResource -> get_from_public_otherwise

Attributes

adapter  [R] 
config  [R] 

Public Class methods

[Source]

# File lib/jetty_rails/handler/web_app_handler.rb, line 33
      def self.adapters
        @adapters ||= {
          :rails => JettyRails::Adapters::RailsAdapter,
          :merb => JettyRails::Adapters::MerbAdapter
        }
      end

[Source]

# File lib/jetty_rails/handler/web_app_handler.rb, line 29
      def self.add_adapter(adapter_key, adapter)
        adapters[adapter_key] = adapter
      end

[Source]

# 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

Public Instance methods

[Source]

# File lib/jetty_rails/handler/web_app_handler.rb, line 40
      def adapters
        self.class.adapters
      end

[Source]

# 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

Protected Instance methods

[Source]

# File lib/jetty_rails/handler/web_app_handler.rb, line 56
      def adapter_for(kind)
        adapters[kind.to_sym].new(@config)
      end

[Source]

# File lib/jetty_rails/handler/web_app_handler.rb, line 52
      def rack_filter
        Jetty::FilterHolder.new(Rack::RackFilter.new)
      end

[Validate]