class Trinidad::Lifecycle::WebApp::War

Public Instance Methods

before_init(event) click to toggle source
# File lib/trinidad/lifecycle/web_app/war.rb, line 10
def before_init(event)
  # NOTE: esp. important for .war applications that the name matches the path
  # to work-around ProxyDirContext constructor's `contextPath = contextName;`
  # @see {#adjust_context} also need to restore possible context name change!
  context = event.lifecycle
  context.name = context.path if context.name
  super
end
configure(context) click to toggle source
# File lib/trinidad/lifecycle/web_app/war.rb, line 19
def configure(context)
  super # Shared#configure
  configure_class_loader(context)
end

Protected Instance Methods

adjust_context(context) click to toggle source
# File lib/trinidad/lifecycle/web_app/war.rb, line 26
def adjust_context(context)
  name = context.name
  super
ensure # @see {#before_init}
  context.name = name
  # NOTE: mimics HostConfig#deployWAR and might/should be removed
  # once Lifecycle::Host inherits functionality from HostConfig ...
  # context_name = Trinidad::Tomcat::ContextName.new(name)
  # context.setName context_name.getName()
  # context.setPath context_name.getPath()
  # context.setWebappVersion context_name.getVersion()
  # context.setDocBase context_name.getBaseName() + '.war'
end
configure_class_loader(context) click to toggle source
# File lib/trinidad/lifecycle/web_app/war.rb, line 40
def configure_class_loader(context)
  class_loader = web_app.class_loader || JRuby.runtime.jruby_class_loader
  loader = Trinidad::Tomcat::WebappLoader.new(class_loader)
  loader.container = context
  context.loader = loader
end
remove_defaults(context = nil) click to toggle source
# File lib/trinidad/lifecycle/web_app/war.rb, line 47
def remove_defaults(context = nil)
  # NOTE: do not remove defaults (welcome files)
end