Class: Trinidad::WarWebApp

Inherits:
WebApp
  • Object
show all
Defined in:
lib/trinidad/web_app.rb

Overview

A web application for deploying (java) .war files.

Constant Summary

Constants inherited from WebApp

Trinidad::WebApp::DEFAULT_SERVLET_CLASS, Trinidad::WebApp::DEFAULT_SERVLET_NAME, Trinidad::WebApp::JSP_SERVLET_CLASS, Trinidad::WebApp::JSP_SERVLET_NAME, Trinidad::WebApp::RACK_FILTER_CLASS, Trinidad::WebApp::RACK_FILTER_NAME, Trinidad::WebApp::RACK_SERVLET_CLASS, Trinidad::WebApp::RACK_SERVLET_NAME

Instance Attribute Summary

Attributes inherited from WebApp

#config, #default_config

Instance Method Summary collapse

Methods inherited from WebApp

#[], #[]=, #add_context_param, #aliases, #allow_linking, #app_root, #cache_max_size, #cache_object_max_size, #cache_ttl, #caching_allowed?, #class_loader!, #context_name, #context_xml, create, #default_deployment_descriptor, #default_servlet, #default_web_xml, #deployment_descriptor, #doc_base, #environment, #extensions, #generate_class_loader, #init_params, #initialize, #java_classes, #java_classes_dir, #java_lib, #java_lib_dir, #jruby_compat_version, #jruby_initial_runtimes, #jruby_max_runtimes, #jruby_min_runtimes, #jruby_runtime_acquire_timeout, #jsp_servlet, #key?, #log, #logging, #public_config, #public_dir, #public_root, #rack_listener, #rack_servlet, #reset!, #servlet, #solo?, #threadsafe?, #war?, #web_app_dir, #web_xml, #web_xml_context_param, #web_xml_environment, #web_xml_filter?, #web_xml_listener?, #web_xml_servlet?

Constructor Details

This class inherits a constructor from Trinidad::WebApp

Instance Method Details

#class_loaderObject



756
757
758
# File 'lib/trinidad/web_app.rb', line 756

def class_loader
  @class_loader ||= nil # lifecycle will setup JRuby CL
end

#context_managerObject



764
# File 'lib/trinidad/web_app.rb', line 764

def context_manager; nil end

#context_paramsObject



760
761
762
# File 'lib/trinidad/web_app.rb', line 760

def context_params
  warbler? ? super : @context_params ||= {}
end

#context_pathObject



725
726
727
728
729
730
731
# File 'lib/trinidad/web_app.rb', line 725

def context_path
  @path ||= begin
    path = File.basename(super)
    context_name = Tomcat::ContextName.new(path)
    context_name.path # removes .war handles ## versioning
  end
end

#define_lifecycleObject



770
771
772
# File 'lib/trinidad/web_app.rb', line 770

def define_lifecycle
  Lifecycle::WebApp::War.new(self)
end

#layout_classObject



766
767
768
# File 'lib/trinidad/web_app.rb', line 766

def layout_class
  'JRuby::Rack::WebInfLayout'
end

#log_dirObject



737
738
739
740
741
742
743
744
745
746
747
748
749
750
# File 'lib/trinidad/web_app.rb', line 737

def log_dir
  @log_dir ||= self[:log_dir] || begin
    if work_dir then work_dir
    else
      if root_dir[-4..-1] == '.war'
        parent_dir = File.dirname(root_dir)
        expanded_dir = File.join(parent_dir, context_path)
        File.exist?(expanded_dir) ? expanded_dir : parent_dir
      else
        File.join(root_dir, 'log')
      end
    end
  end
end

#monitorObject



752
753
754
# File 'lib/trinidad/web_app.rb', line 752

def monitor
  root_dir ? File.expand_path(root_dir) : nil # the .war file itself
end

#root_dirObject



718
719
720
721
722
723
# File 'lib/trinidad/web_app.rb', line 718

def root_dir
  @root_dir ||= ( config[:root_dir] || begin
    path = config[:context_path]
    path.to_s if path.to_s[-4..-1] == '.war'
  end || default_confit[:root_dir] )
end

#work_dirObject



733
734
735
# File 'lib/trinidad/web_app.rb', line 733

def work_dir
  self[:work_dir]
end