trinidad 0.9.12 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/lib/trinidad/command_line_parser.rb +2 -0
- data/lib/trinidad/server.rb +29 -59
- data/lib/trinidad/war_web_app.rb +11 -0
- data/lib/trinidad/web_app.rb +16 -8
- data/lib/trinidad.rb +5 -3
- metadata +99 -114
- data/lib/trinidad/web_app_lifecycle_listener.rb +0 -88
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 1.0.0 (2010-11-04)
|
2
|
+
|
3
|
+
* Warbler support
|
4
|
+
* Add APR listener to run under native connectors
|
5
|
+
* fixes #24: setting address doesn't affect listening socket
|
6
|
+
* fix issues configuring the logger out of the lifecycle listener
|
7
|
+
|
1
8
|
== 0.9.12 (2010-10-21)
|
2
9
|
|
3
10
|
* fix problems loading tomcat classes from rack application
|
@@ -30,6 +30,8 @@ module Trinidad
|
|
30
30
|
end
|
31
31
|
|
32
32
|
if default_options.has_key?(:config)
|
33
|
+
default_options[:config] = File.expand_path(default_options[:config], default_options[:web_app_dir] || Dir.pwd)
|
34
|
+
|
33
35
|
config_options = YAML.load_file(default_options[:config])
|
34
36
|
default_options.deep_merge!(config_options.symbolize!)
|
35
37
|
end
|
data/lib/trinidad/server.rb
CHANGED
@@ -31,10 +31,10 @@ module Trinidad
|
|
31
31
|
|
32
32
|
def load_tomcat_server
|
33
33
|
@tomcat = Trinidad::Tomcat::Tomcat.new
|
34
|
+
@tomcat.base_dir = Dir.pwd
|
34
35
|
@tomcat.hostname = @config[:address]
|
35
36
|
@tomcat.server.address = @config[:address]
|
36
37
|
@tomcat.port = @config[:port].to_i
|
37
|
-
@tomcat.base_dir = Dir.pwd
|
38
38
|
@tomcat.host.app_base = @config[:apps_base] || Dir.pwd
|
39
39
|
@tomcat.enable_naming
|
40
40
|
|
@@ -46,6 +46,11 @@ module Trinidad
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def create_web_apps
|
49
|
+
create_from_web_apps
|
50
|
+
create_from_apps_base
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_from_web_apps
|
49
54
|
if @config[:web_apps]
|
50
55
|
@config[:web_apps].each do |name, app_config|
|
51
56
|
app_config[:context_path] ||= (name.to_s == 'default' ? '/' : "/#{name.to_s}")
|
@@ -54,11 +59,17 @@ module Trinidad
|
|
54
59
|
create_web_app(app_config)
|
55
60
|
end
|
56
61
|
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_from_apps_base
|
57
65
|
if @config[:apps_base]
|
58
|
-
apps_path = Dir.glob(File.join(@config[:apps_base], '*')).
|
66
|
+
apps_path = Dir.glob(File.join(@config[:apps_base], '*')).
|
67
|
+
select {|path| !(path =~ /tomcat\.\d+$/) }
|
68
|
+
|
69
|
+
apps_path.reject! {|path| apps_path.include?(path + '.war') }
|
59
70
|
|
60
71
|
apps_path.each do |path|
|
61
|
-
if File.directory?(path)
|
72
|
+
if (File.directory?(path) || path =~ /\.war$/)
|
62
73
|
name = File.basename(path)
|
63
74
|
app_config = {
|
64
75
|
:context_path => (name == 'default' ? '/' : "/#{name.to_s}"),
|
@@ -72,19 +83,19 @@ module Trinidad
|
|
72
83
|
end
|
73
84
|
|
74
85
|
def create_web_app(app_config)
|
75
|
-
|
76
|
-
|
86
|
+
web_app = WebApp.create(@config, app_config)
|
87
|
+
|
88
|
+
app_context = @tomcat.addWebapp(web_app.context_path, web_app.web_app_dir)
|
89
|
+
app_context.work_dir = web_app.work_dir
|
77
90
|
|
78
|
-
|
79
|
-
configure_logging(web_app)
|
91
|
+
Trinidad::Extensions.configure_webapp_extensions(web_app.extensions, @tomcat, app_context)
|
80
92
|
|
81
|
-
|
82
|
-
|
93
|
+
lifecycle = web_app.war? ? Lifecycle::War.new(web_app) : Lifecycle::Default.new(web_app)
|
94
|
+
app_context.add_lifecycle_listener(lifecycle)
|
83
95
|
end
|
84
96
|
|
85
97
|
def add_service_connector(options, protocol = nil)
|
86
98
|
connector = Trinidad::Tomcat::Connector.new(protocol)
|
87
|
-
|
88
99
|
opts = options.dup
|
89
100
|
|
90
101
|
connector.scheme = opts.delete(:scheme) if opts[:scheme]
|
@@ -124,11 +135,16 @@ module Trinidad
|
|
124
135
|
end
|
125
136
|
|
126
137
|
def add_http_connector
|
127
|
-
options = @config[:http]
|
138
|
+
options = @config[:http] || {}
|
139
|
+
options[:address] ||= @config[:address] if @config[:address] != 'localhost'
|
128
140
|
options[:port] = @config[:port]
|
129
141
|
options[:protocol_handler] = 'org.apache.coyote.http11.Http11NioProtocol' if options[:nio]
|
130
142
|
|
131
|
-
|
143
|
+
if options[:apr]
|
144
|
+
@tomcat.server.add_lifecycle_listener(Trinidad::Tomcat::AprLifecycleListener.new)
|
145
|
+
end
|
146
|
+
|
147
|
+
connector = add_service_connector(options, options[:protocol_handler] || 'HTTP/1.1')
|
132
148
|
@tomcat.connector = connector
|
133
149
|
end
|
134
150
|
|
@@ -141,7 +157,7 @@ module Trinidad
|
|
141
157
|
end
|
142
158
|
|
143
159
|
def http_configured?
|
144
|
-
@config.has_key?(:http)
|
160
|
+
@config.has_key?(:http) || @config[:address] != 'localhost'
|
145
161
|
end
|
146
162
|
|
147
163
|
def create_default_keystore(config)
|
@@ -184,51 +200,5 @@ module Trinidad
|
|
184
200
|
config[:web_apps] = { :default => default_app }
|
185
201
|
end
|
186
202
|
end
|
187
|
-
|
188
|
-
def remove_defaults(app_context)
|
189
|
-
default_servlet = app_context.find_child('default')
|
190
|
-
app_context.remove_child(default_servlet) if default_servlet
|
191
|
-
|
192
|
-
jsp_servlet = app_context.find_child('jsp')
|
193
|
-
app_context.remove_child(jsp_servlet) if jsp_servlet
|
194
|
-
|
195
|
-
app_context.remove_servlet_mapping('/')
|
196
|
-
app_context.remove_servlet_mapping('*.jspx')
|
197
|
-
app_context.remove_servlet_mapping('*.jsp')
|
198
|
-
|
199
|
-
app_context.process_tlds = false
|
200
|
-
end
|
201
|
-
|
202
|
-
def configure_logging(web_app)
|
203
|
-
log_path = File.join(web_app.web_app_dir, 'log', "#{web_app.environment}.log")
|
204
|
-
log_file = java.io.File.new(log_path)
|
205
|
-
|
206
|
-
unless log_file.exists
|
207
|
-
log_file.parent_file.mkdirs
|
208
|
-
log_file.create_new_file
|
209
|
-
end
|
210
|
-
|
211
|
-
jlogging = java.util.logging
|
212
|
-
|
213
|
-
log_handler = jlogging.FileHandler.new(log_path, true)
|
214
|
-
logger = jlogging.Logger.get_logger("")
|
215
|
-
|
216
|
-
log_level = web_app.log
|
217
|
-
unless %w{ALL CONFIG FINE FINER FINEST INFO OFF SEVERE WARNING}.include?(log_level)
|
218
|
-
puts "Invalid log level #{log_level}, using default: INFO"
|
219
|
-
log_level = 'INFO'
|
220
|
-
end
|
221
|
-
|
222
|
-
level = jlogging.Level.parse(log_level)
|
223
|
-
|
224
|
-
logger.handlers.each do |handler|
|
225
|
-
handler.level = level
|
226
|
-
end
|
227
|
-
|
228
|
-
logger.level = level
|
229
|
-
|
230
|
-
log_handler.formatter = jlogging.SimpleFormatter.new
|
231
|
-
logger.add_handler(log_handler)
|
232
|
-
end
|
233
203
|
end
|
234
204
|
end
|
data/lib/trinidad/web_app.rb
CHANGED
@@ -3,7 +3,16 @@ module Trinidad
|
|
3
3
|
attr_reader :config, :app_config, :class_loader, :servlet
|
4
4
|
|
5
5
|
def self.create(config, app_config)
|
6
|
-
|
6
|
+
war?(app_config) ? WarWebApp.new(config, app_config) :
|
7
|
+
rackup?(app_config) ? RackupWebApp.new(config, app_config) : RailsWebApp.new(config, app_config)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.rackup?(app_config)
|
11
|
+
app_config.has_key?(:rackup) || !Dir['WEB-INF/**/config.ru'].empty?
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.war?(app_config)
|
15
|
+
app_config[:context_path] =~ /\.war$/
|
7
16
|
end
|
8
17
|
|
9
18
|
def initialize(config, app_config, servlet_class = 'org.jruby.rack.RackServlet', servlet_name = 'RackServlet')
|
@@ -30,7 +39,7 @@ module Trinidad
|
|
30
39
|
|
31
40
|
def default_deployment_descriptor
|
32
41
|
@deployment_descriptor ||= if default_web_xml
|
33
|
-
file = File.expand_path(File.join(
|
42
|
+
file = File.expand_path(File.join(work_dir, default_web_xml))
|
34
43
|
File.exist?(file) ? file : nil
|
35
44
|
end
|
36
45
|
end
|
@@ -53,7 +62,7 @@ module Trinidad
|
|
53
62
|
@app_config[:public] || @config[:public] || 'public'
|
54
63
|
end
|
55
64
|
|
56
|
-
%w{web_app_dir libs_dir classes_dir default_web_xml environment
|
65
|
+
%w{context_path web_app_dir libs_dir classes_dir default_web_xml environment
|
57
66
|
jruby_min_runtimes jruby_max_runtimes rackup log}.each do |method_name|
|
58
67
|
define_method method_name do
|
59
68
|
sym = method_name.to_sym
|
@@ -69,6 +78,9 @@ module Trinidad
|
|
69
78
|
end
|
70
79
|
end
|
71
80
|
|
81
|
+
def war?; WebApp.war?(app_config); end
|
82
|
+
def work_dir; web_app_dir; end
|
83
|
+
|
72
84
|
protected
|
73
85
|
def add_parameter_unless_exist(param_name, param_value)
|
74
86
|
@params[param_name] = param_value unless web_context_param(param_name)
|
@@ -80,7 +92,7 @@ module Trinidad
|
|
80
92
|
@web_xml ||=
|
81
93
|
begin
|
82
94
|
require 'rexml/document'
|
83
|
-
REXML::Document.new(
|
95
|
+
REXML::Document.new(File.read(default_deployment_descriptor))
|
84
96
|
rescue REXML::ParseException => e
|
85
97
|
puts "WARNING: invalid deployment descriptor:[#{default_deployment_descriptor}]"
|
86
98
|
puts e.message
|
@@ -102,9 +114,5 @@ module Trinidad
|
|
102
114
|
end
|
103
115
|
@servlet = {:class => servlet_class, :name => servlet_name}
|
104
116
|
end
|
105
|
-
|
106
|
-
def self.rackup?(app_config)
|
107
|
-
app_config.has_key?(:rackup) || !Dir['WEB-INF/**/config.ru'].empty?
|
108
|
-
end
|
109
117
|
end
|
110
118
|
end
|
data/lib/trinidad.rb
CHANGED
@@ -15,12 +15,14 @@ require 'trinidad/extensions'
|
|
15
15
|
require 'trinidad/command_line_parser'
|
16
16
|
require 'trinidad/jars'
|
17
17
|
require 'trinidad/server'
|
18
|
-
require 'trinidad/
|
18
|
+
require 'trinidad/lifecycle/lifecycle_listener_base'
|
19
|
+
require 'trinidad/lifecycle/lifecycle_listener_default'
|
20
|
+
require 'trinidad/lifecycle/lifecycle_listener_war'
|
19
21
|
require 'trinidad/web_app'
|
20
22
|
require 'trinidad/rails_web_app'
|
21
23
|
require 'trinidad/rackup_web_app'
|
22
|
-
|
24
|
+
require 'trinidad/war_web_app'
|
23
25
|
|
24
26
|
module Trinidad
|
25
|
-
VERSION = '0.
|
27
|
+
VERSION = '1.0.0'
|
26
28
|
end
|
metadata
CHANGED
@@ -1,151 +1,136 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinidad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 35
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
version: 0.
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
|
-
- David Calavera
|
12
|
+
- David Calavera
|
14
13
|
autorequire:
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-11-04 00:00:00 -07:00
|
19
18
|
default_executable: trinidad
|
20
19
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
- !ruby/object:Gem::
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
none: false
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
hash: 3
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
version: "0"
|
93
|
-
type: :development
|
94
|
-
version_requirements: *id005
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: trinidad_jars
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 3
|
30
|
+
- 0
|
31
|
+
version: 0.3.0
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: jruby-rack
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 0
|
44
|
+
- 2
|
45
|
+
version: 1.0.2
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id003
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: mocha
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
70
|
+
type: :development
|
71
|
+
version_requirements: *id004
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: fakefs
|
74
|
+
prerelease: false
|
75
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
type: :development
|
83
|
+
version_requirements: *id005
|
95
84
|
description: Trinidad allows you to run a rails or rackup applications within an embedded Apache Tomcat container
|
96
85
|
email: calavera@apache.org
|
97
86
|
executables:
|
98
|
-
- trinidad
|
87
|
+
- trinidad
|
99
88
|
extensions: []
|
100
89
|
|
101
90
|
extra_rdoc_files:
|
102
|
-
- README.rdoc
|
103
|
-
- LICENSE
|
91
|
+
- README.rdoc
|
92
|
+
- LICENSE
|
104
93
|
files:
|
105
|
-
- bin/trinidad
|
106
|
-
- lib/trinidad.rb
|
107
|
-
- History.txt
|
108
|
-
- LICENSE
|
109
|
-
- README.rdoc
|
110
|
-
- lib/trinidad/command_line_parser.rb
|
111
|
-
- lib/trinidad/core_ext.rb
|
112
|
-
- lib/trinidad/extensions.rb
|
113
|
-
- lib/trinidad/rackup_web_app.rb
|
114
|
-
- lib/trinidad/rails_web_app.rb
|
115
|
-
- lib/trinidad/server.rb
|
116
|
-
- lib/trinidad/
|
117
|
-
- lib/trinidad/
|
94
|
+
- bin/trinidad
|
95
|
+
- lib/trinidad.rb
|
96
|
+
- History.txt
|
97
|
+
- LICENSE
|
98
|
+
- README.rdoc
|
99
|
+
- lib/trinidad/command_line_parser.rb
|
100
|
+
- lib/trinidad/core_ext.rb
|
101
|
+
- lib/trinidad/extensions.rb
|
102
|
+
- lib/trinidad/rackup_web_app.rb
|
103
|
+
- lib/trinidad/rails_web_app.rb
|
104
|
+
- lib/trinidad/server.rb
|
105
|
+
- lib/trinidad/war_web_app.rb
|
106
|
+
- lib/trinidad/web_app.rb
|
118
107
|
has_rdoc: true
|
119
108
|
homepage: http://github.com/calavera/trinidad
|
120
109
|
licenses: []
|
121
110
|
|
122
111
|
post_install_message:
|
123
112
|
rdoc_options:
|
124
|
-
- --charset=UTF-8
|
113
|
+
- --charset=UTF-8
|
125
114
|
require_paths:
|
126
|
-
- lib
|
115
|
+
- lib
|
127
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
117
|
requirements:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
version: "0"
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
version: "0"
|
136
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
124
|
requirements:
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
version: "0"
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
version: "0"
|
145
130
|
requirements: []
|
146
131
|
|
147
132
|
rubyforge_project: trinidad
|
148
|
-
rubygems_version: 1.3.
|
133
|
+
rubygems_version: 1.3.6
|
149
134
|
signing_key:
|
150
135
|
specification_version: 2
|
151
136
|
summary: Simple library to run rails applications into an embedded Tomcat
|
@@ -1,88 +0,0 @@
|
|
1
|
-
module Trinidad
|
2
|
-
class WebAppLifecycleListener
|
3
|
-
include Trinidad::Tomcat::LifecycleListener
|
4
|
-
|
5
|
-
attr_reader :context
|
6
|
-
|
7
|
-
def initialize(webapp)
|
8
|
-
@webapp = webapp
|
9
|
-
end
|
10
|
-
|
11
|
-
def lifecycleEvent(event)
|
12
|
-
if Trinidad::Tomcat::Lifecycle::BEFORE_START_EVENT == event.type
|
13
|
-
init_defaults(event.lifecycle)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def init_defaults(context)
|
18
|
-
@context = context
|
19
|
-
|
20
|
-
deployment_descriptor = configure_deployment_descriptor
|
21
|
-
unless deployment_descriptor
|
22
|
-
configure_rack_servlet
|
23
|
-
configure_rack_listener
|
24
|
-
end
|
25
|
-
configure_init_params
|
26
|
-
configure_context_loader
|
27
|
-
end
|
28
|
-
|
29
|
-
def configure_deployment_descriptor
|
30
|
-
if descriptor = @webapp.default_deployment_descriptor
|
31
|
-
@context.setDefaultWebXml(descriptor)
|
32
|
-
|
33
|
-
context_config = Trinidad::Tomcat::ContextConfig.new
|
34
|
-
context_config.setDefaultWebXml(descriptor)
|
35
|
-
|
36
|
-
@context.addLifecycleListener(context_config)
|
37
|
-
end
|
38
|
-
descriptor
|
39
|
-
end
|
40
|
-
|
41
|
-
def configure_rack_servlet
|
42
|
-
wrapper = @context.create_wrapper
|
43
|
-
wrapper.servlet_class = @webapp.servlet[:class]
|
44
|
-
wrapper.name = @webapp.servlet[:name]
|
45
|
-
|
46
|
-
@context.add_child(wrapper)
|
47
|
-
@context.add_servlet_mapping('/*', wrapper.name)
|
48
|
-
end
|
49
|
-
|
50
|
-
def configure_rack_listener
|
51
|
-
@context.addApplicationListener(@webapp.rack_listener)
|
52
|
-
end
|
53
|
-
|
54
|
-
def configure_init_params
|
55
|
-
@webapp.init_params.each do |name, value|
|
56
|
-
@context.addParameter(name, value)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def configure_context_loader
|
61
|
-
class_loader = @webapp.class_loader
|
62
|
-
|
63
|
-
add_application_jars(class_loader)
|
64
|
-
add_application_java_classes(class_loader)
|
65
|
-
|
66
|
-
loader = Trinidad::Tomcat::WebappLoader.new(class_loader)
|
67
|
-
loader.container = @context
|
68
|
-
@context.loader = loader
|
69
|
-
end
|
70
|
-
|
71
|
-
def add_application_jars(class_loader)
|
72
|
-
return unless @webapp.libs_dir
|
73
|
-
|
74
|
-
resources_dir = File.join(@webapp.web_app_dir, @webapp.libs_dir, '**', '*.jar')
|
75
|
-
|
76
|
-
Dir[resources_dir].each do |resource|
|
77
|
-
class_loader.addURL(java.io.File.new(resource).to_url)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def add_application_java_classes(class_loader)
|
82
|
-
return unless @webapp.classes_dir
|
83
|
-
|
84
|
-
resources_dir = File.join(@webapp.web_app_dir, @webapp.classes_dir)
|
85
|
-
class_loader.addURL(java.io.File.new(resources_dir).to_url)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|