Sha256: 5f183332e1a72635c2d8e1b5a826b0f10a2b613f0b290bb39467ff87d4190166
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
require 'delegate' require 'cgi' require File.expand_path('../../helpers/sandbox', __FILE__) module Trinidad module Sandbox class ApplicationContext < DelegateClass(Trinidad::Tomcat::Context) extend Trinidad::Sandbox::Helpers::Context def self.all apps = host ? host.find_children : [] apps.select {|app| app.name != sandbox_context.name }. map {|app| ApplicationContext.new(app) } end def self.find(name) name = '/' + name unless name[0..1] == '/' path = CGI.unescape(name) context = host.findChild(path) ApplicationContext.new(context) if context end def initialize(context) super(context) end def slug @slug ||= CGI.escape(name.sub('/', '')) end def self_path @self_path ||= "#{ApplicationContext.sandbox_context.path}/apps/#{slug}" end def actions [ {:rel => 'start', :href => "#{self_path}/start"}, {:rel => 'stop', :href => "#{self_path}/stop"} ] end def parameters @parameters ||= find_parameters end end end end
Version data entries
3 entries across 3 versions & 1 rubygems