webrick help

E

Eko Budi Setiyo

Hi all,
Need help from you all
#+++++++++++++++++++++++++++++++++++++++=
#file start_webrick.rb

require 'webrick'
include WEBrick
load('class.index.rb')

def start_webrick(config = {})
config.update:)Port => 80)
config.update:)DirectoryIndex => 'coreLoader.rb')
$server = HTTPServer.new(config)
yield server if block_given?
['INT','TERM'].each { |signal|
trap(signal) {server.shutdown}
}
$server.mount('/index',Index)
$server.start
end

start_webrick:)DocumentRoot => File.dirname(__FILE__))

#++++++++++++++++++++++++++++++++++++++++
#file class.index.rb
class Index < HTTPServlet::AbstractServlet

def do_GET(req,resp)
$Layout = ''
load('coreLoader.rb')
resp.body = $Layout
end

def Index.get_instance config, *options
load __FILE__
load('coreLoader.rb')
Index.new config, *options
end

end


#+++++++++++++++++++++++++++++++++++++++++++

Any body know how to make file 'coreLoader.rb' always 're-loaded' when
browser visit http://localhost/index/xxx/yyy
The reason is 'coreLoader.rb' is the only entry for my website
framework. so the result of load('coreLoader.rb') not always the same

regards
Eko
 
A

Alexander Kellett

try using require "auto-reload.rb"
can be found in mod_ruby distribution.
btw, your email client is buggy. all
your lines are wrapping. so the source
is nonsensical.

Alex
 
E

Eko Budi Setiyo

Alexander said:
try using require "auto-reload.rb"
can be found in mod_ruby distribution.
btw, your email client is buggy. all
your lines are wrapping. so the source
is nonsensical.

Alex

Hi all,
Need help from you all
#+++++++++++++++++++++++++++++++++++++++=
#file start_webrick.rb

require 'webrick'
include WEBrick
load('class.index.rb')

def start_webrick(config = {}) config.update:)Port => 80)
config.update:)DirectoryIndex => 'coreLoader.rb')
$server = HTTPServer.new(config)
yield server if block_given?
['INT','TERM'].each { |signal|
trap(signal) {server.shutdown}
}
$server.mount('/index',Index) $server.start
end
start_webrick:)DocumentRoot => File.dirname(__FILE__))

#++++++++++++++++++++++++++++++++++++++++
#file class.index.rb
class Index < HTTPServlet::AbstractServlet
def do_GET(req,resp)
$Layout = ''
load('coreLoader.rb')
resp.body = $Layout end
def Index.get_instance config, *options
load __FILE__
load('coreLoader.rb') Index.new config,
*options end
end


#+++++++++++++++++++++++++++++++++++++++++++

Any body know how to make file 'coreLoader.rb' always 're-loaded'
when browser visit http://localhost/index/xxx/yyy
The reason is 'coreLoader.rb' is the only entry for my website
framework. so the result of load('coreLoader.rb') not always the same

regards
Eko
thanks

I will try using it
 
E

Eko Budi Setiyo

Eko said:
Alexander said:
try using require "auto-reload.rb"
can be found in mod_ruby distribution.
btw, your email client is buggy. all
your lines are wrapping. so the source
is nonsensical.

Alex

Hi all,
Need help from you all
#+++++++++++++++++++++++++++++++++++++++=
#file start_webrick.rb

require 'webrick'
include WEBrick
load('class.index.rb')

def start_webrick(config = {}) config.update:)Port => 80)
config.update:)DirectoryIndex => 'coreLoader.rb')
$server = HTTPServer.new(config)
yield server if block_given?
['INT','TERM'].each { |signal|
trap(signal) {server.shutdown}
}
$server.mount('/index',Index) $server.start
end
start_webrick:)DocumentRoot => File.dirname(__FILE__))

#++++++++++++++++++++++++++++++++++++++++
#file class.index.rb
class Index < HTTPServlet::AbstractServlet
def do_GET(req,resp)
$Layout = ''
load('coreLoader.rb')
resp.body = $Layout end
def Index.get_instance config, *options
load __FILE__
load('coreLoader.rb') Index.new config,
*options end
end


#+++++++++++++++++++++++++++++++++++++++++++

Any body know how to make file 'coreLoader.rb' always 're-loaded'
when browser visit http://localhost/index/xxx/yyy
The reason is 'coreLoader.rb' is the only entry for my website
framework. so the result of load('coreLoader.rb') not always the same

regards
Eko
thanks

I will try using it
Doesn't work

regards
Eko
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top