Sha256: 43c8afcd5daa00df96b837434efbca05bc7c9113ab36037f05ae8d49e6ad1d05
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require 'rubygems' require 'trinidad' require File.expand_path('../../trinidad-libs/trinidad-sandbox-extension', __FILE__) module Trinidad module Extensions class SandboxServerExtension < ServerExtension VERSION = '0.2.0' def configure(tomcat) opts = prepare_options app_context = create_application_context(tomcat, opts) web_app = Trinidad::RackupWebApp.new({}, opts, 'org.jruby.trinidad.SandboxRackServlet', 'SandboxServlet') app_context.add_lifecycle_listener(WebAppLifecycleListener.new(web_app)) web_app end def prepare_options opts = { :context_path => '/sandbox', :jruby_min_runtimes => 1, :jruby_max_runtimes => 2, :libs_dir => 'libs', :classes_dir => 'classes', :public => 'app/public' } opts.deep_merge!(@options) opts[:rackup] = 'config.ru' opts[:web_app_dir] = File.expand_path('../trinidad_sandbox_extension', __FILE__) opts end def create_application_context(tomcat, opts) app_ctx = tomcat.addWebapp(opts[:context_path], opts[:web_app_dir]) app_ctx.privileged = true if opts[:username] && opts[:password] app_ctx.servlet_context.setAttribute("sandbox_username", opts[:username].to_s); app_ctx.servlet_context.setAttribute("sandbox_password", opts[:password].to_s); end app_ctx end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trinidad_sandbox_extension-0.2.0 | lib/trinidad_sandbox_extension.rb |