lib/trinidad/server.rb in trinidad-1.5.0.B1 vs lib/trinidad/server.rb in trinidad-1.5.0.B2

- old
+ new

@@ -174,10 +174,11 @@ if keystore_file = options.delete(:keystore) || options.delete(:keystore_file) options[:keystoreFile] ||= keystore_file end options[:keystorePass] ||= options.delete(:keystore_pass) if options.key?(:keystore_pass) + options[:keystoreType] ||= options.delete(:keystore_type) if options.key?(:keystore_type) # handle "custom" alternative SSL (casing) options : options[:SSLEnabled] = options.delete(:ssl_enabled) || true # always true options[:SSLCertificateFile] ||= options.delete(:ssl_certificate_file) if options.key?(:ssl_certificate_file) options[:SSLCertificateKeyFile] ||= options.delete(:ssl_certificate_key_file) if options.key?(:ssl_certificate_key_file) options[:SSLVerifyClient] ||= options.delete(:ssl_verify_client) if options.key?(:ssl_verify_client) @@ -223,11 +224,12 @@ end prev_start = host.start_children context = begin host.start_children = start unless start.nil? # public Context addWebapp(Host host, String url, String name, String docBase) - tomcat.addWebapp(host, web_app.context_path, web_app.context_name, web_app.root_dir) + context_path = web_app.context_path; context_path = '' if context_path == '/' + tomcat.addWebapp(host, context_path, web_app.context_name, web_app.root_dir) rescue Java::JavaLang::IllegalArgumentException => e if e.message =~ /addChild\:/ context_name = web_app.context_name logger.error "could not add application #{context_name.inspect} from #{web_app.root_dir}\n" << " (same context name is used for #{host.find_child(context_name).doc_base})" @@ -386,13 +388,15 @@ app_config[:host_name] = host.name end end if web_apps end + Tomcat::StandardHost.send :field_writer, :appBase + def create_host(app_base, host_config, tomcat = @tomcat) host = Tomcat::StandardHost.new - host.app_base = nil # reset default app_base + host.appBase = nil # reset default app_base host.deployXML = false # disabled by default setup_host(app_base, host_config, host) tomcat.engine.add_child host if tomcat host end @@ -570,21 +574,28 @@ raise "Unable to create keystore folder: #{keystore_dir.canonical_path}" end key_tool_args = [ "-genkey", "-alias", "localhost", - "-dname", dname = "CN=localhost, OU=Trinidad, O=Trinidad, C=ES", + "-dname", dname = "CN=localhost,OU=Trinidad,O=Trinidad,C=ES", "-keyalg", "RSA", "-validity", "365", "-storepass", "key", "-keystore", file.absolute_path, "-storepass", pass, "-keypass", pass ] logger.info "Generating a (default) keystore for localhost #{dname.inspect} at " << "#{file.canonical_path} (password: '#{pass}')" - Java::SunSecurityTools::KeyTool.main key_tool_args.to_java(:string) + key_tool = nil + begin + key_tool = Java::SunSecurityTools::KeyTool + rescue NameError # Java 8 seems to have removed it completely + `keytool #{key_tool_args.join(' ')}` # NOTE: use for all JDK versions + else + key_tool.main key_tool_args.to_java(:string) + end end def trap_signals trap('INT') { stop! } trap('TERM') { stop! }