Sha256: 817e2f1b07b5604ee64cd70a4c141ffb335f27145dc0372144039a856dbf63a1

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

module Trinidad
  module Lifecycle
    module WebApp
      # Shared web application lifecycle hook, 
      # does #configure before the context starts.
      module Shared

        attr_reader :web_app
        alias_method :webapp, :web_app

        def initialize(web_app)
          @web_app = web_app
        end

        # @see Trinidad::Lifecycle::Base#before_start
        def before_start(event)
          super
          configure(event.lifecycle)
        end

        # Configure the web application before it's started.
        def configure(context)
          remove_defaults(context)
          configure_logging(context)
        end

        protected

        def configure_logging(context)
          Trinidad::Logging.configure_web_app(web_app, context)
        end

        private

        def remove_defaults(context)
          context.remove_welcome_file('index.jsp')
          context.remove_welcome_file('index.htm')
          context.remove_welcome_file('index.html')

          jsp_servlet = context.find_child('jsp')
          context.remove_child(jsp_servlet) if jsp_servlet

          context.remove_servlet_mapping('*.jspx')
          context.remove_servlet_mapping('*.jsp')

          context.process_tlds = false
          context.xml_validation = false
        end
        
      end
    end 
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trinidad-1.4.1 lib/trinidad/lifecycle/web_app/shared.rb
trinidad-1.4.0 lib/trinidad/lifecycle/web_app/shared.rb
trinidad-1.4.0.RC lib/trinidad/lifecycle/web_app/shared.rb