From d69d36a5d9a4287fe8cb7443a404c697cf93bc56 Mon Sep 17 00:00:00 2001 From: nahi Date: Sun, 15 Feb 2004 11:50:02 +0000 Subject: * sample/soap/calc/httpd.rb, sample/soap/exchange/httpd.rb, sample/soap/sampleStruct/httpd.rb, sample/wsdl/googleSearch/httpd.rb: use soap/property instead of getopts for configuring DocumentRoot and port# of httpd. see samplehttpd.conf below. * sample/soap/calc/samplehttpd.conf, sample/soap/exchange/samplehttpd.conf, sample/soap/sampleStruct/samplehttpd.conf, sample/wsdl/googleSearch/samplehttpd.conf: added. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/soap/calc/httpd.rb | 13 +++++++++---- sample/soap/calc/samplehttpd.conf | 2 ++ sample/soap/exchange/httpd.rb | 13 +++++++++---- sample/soap/exchange/samplehttpd.conf | 2 ++ sample/soap/sampleStruct/httpd.rb | 13 +++++++++---- sample/soap/sampleStruct/samplehttpd.conf | 2 ++ sample/wsdl/googleSearch/httpd.rb | 13 +++++++++---- sample/wsdl/googleSearch/samplehttpd.conf | 2 ++ 8 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 sample/soap/calc/samplehttpd.conf create mode 100644 sample/soap/exchange/samplehttpd.conf create mode 100644 sample/soap/sampleStruct/samplehttpd.conf create mode 100644 sample/wsdl/googleSearch/samplehttpd.conf (limited to 'sample') diff --git a/sample/soap/calc/httpd.rb b/sample/soap/calc/httpd.rb index ee8ab09f5..bebcff96c 100644 --- a/sample/soap/calc/httpd.rb +++ b/sample/soap/calc/httpd.rb @@ -1,14 +1,19 @@ #!/usr/bin/env ruby require 'webrick' -require 'getopts' +require 'soap/property' -getopts "", 'r:', 'p:8808' +docroot = "." +port = 8808 +if opt = SOAP::Property.loadproperty("samplehttpd.conf") + docroot = opt["docroot"] + port = Integer(opt["port"]) +end s = WEBrick::HTTPServer.new( :BindAddress => "0.0.0.0", - :Port => $OPT_p.to_i, - :DocumentRoot => $OPT_r || ".", + :Port => port, + :DocumentRoot => docroot, :CGIPathEnv => ENV['PATH'] ) trap(:INT){ s.shutdown } diff --git a/sample/soap/calc/samplehttpd.conf b/sample/soap/calc/samplehttpd.conf new file mode 100644 index 000000000..85e999502 --- /dev/null +++ b/sample/soap/calc/samplehttpd.conf @@ -0,0 +1,2 @@ +docroot = . +port = 8808 diff --git a/sample/soap/exchange/httpd.rb b/sample/soap/exchange/httpd.rb index ee8ab09f5..bebcff96c 100644 --- a/sample/soap/exchange/httpd.rb +++ b/sample/soap/exchange/httpd.rb @@ -1,14 +1,19 @@ #!/usr/bin/env ruby require 'webrick' -require 'getopts' +require 'soap/property' -getopts "", 'r:', 'p:8808' +docroot = "." +port = 8808 +if opt = SOAP::Property.loadproperty("samplehttpd.conf") + docroot = opt["docroot"] + port = Integer(opt["port"]) +end s = WEBrick::HTTPServer.new( :BindAddress => "0.0.0.0", - :Port => $OPT_p.to_i, - :DocumentRoot => $OPT_r || ".", + :Port => port, + :DocumentRoot => docroot, :CGIPathEnv => ENV['PATH'] ) trap(:INT){ s.shutdown } diff --git a/sample/soap/exchange/samplehttpd.conf b/sample/soap/exchange/samplehttpd.conf new file mode 100644 index 000000000..85e999502 --- /dev/null +++ b/sample/soap/exchange/samplehttpd.conf @@ -0,0 +1,2 @@ +docroot = . +port = 8808 diff --git a/sample/soap/sampleStruct/httpd.rb b/sample/soap/sampleStruct/httpd.rb index ee8ab09f5..bebcff96c 100644 --- a/sample/soap/sampleStruct/httpd.rb +++ b/sample/soap/sampleStruct/httpd.rb @@ -1,14 +1,19 @@ #!/usr/bin/env ruby require 'webrick' -require 'getopts' +require 'soap/property' -getopts "", 'r:', 'p:8808' +docroot = "." +port = 8808 +if opt = SOAP::Property.loadproperty("samplehttpd.conf") + docroot = opt["docroot"] + port = Integer(opt["port"]) +end s = WEBrick::HTTPServer.new( :BindAddress => "0.0.0.0", - :Port => $OPT_p.to_i, - :DocumentRoot => $OPT_r || ".", + :Port => port, + :DocumentRoot => docroot, :CGIPathEnv => ENV['PATH'] ) trap(:INT){ s.shutdown } diff --git a/sample/soap/sampleStruct/samplehttpd.conf b/sample/soap/sampleStruct/samplehttpd.conf new file mode 100644 index 000000000..85e999502 --- /dev/null +++ b/sample/soap/sampleStruct/samplehttpd.conf @@ -0,0 +1,2 @@ +docroot = . +port = 8808 diff --git a/sample/wsdl/googleSearch/httpd.rb b/sample/wsdl/googleSearch/httpd.rb index ee8ab09f5..bebcff96c 100644 --- a/sample/wsdl/googleSearch/httpd.rb +++ b/sample/wsdl/googleSearch/httpd.rb @@ -1,14 +1,19 @@ #!/usr/bin/env ruby require 'webrick' -require 'getopts' +require 'soap/property' -getopts "", 'r:', 'p:8808' +docroot = "." +port = 8808 +if opt = SOAP::Property.loadproperty("samplehttpd.conf") + docroot = opt["docroot"] + port = Integer(opt["port"]) +end s = WEBrick::HTTPServer.new( :BindAddress => "0.0.0.0", - :Port => $OPT_p.to_i, - :DocumentRoot => $OPT_r || ".", + :Port => port, + :DocumentRoot => docroot, :CGIPathEnv => ENV['PATH'] ) trap(:INT){ s.shutdown } diff --git a/sample/wsdl/googleSearch/samplehttpd.conf b/sample/wsdl/googleSearch/samplehttpd.conf new file mode 100644 index 000000000..85e999502 --- /dev/null +++ b/sample/wsdl/googleSearch/samplehttpd.conf @@ -0,0 +1,2 @@ +docroot = . +port = 8808 -- cgit