# Webrick help

**URL:** <https://rubytalk.org/t/webrick-help/16693>\
**Category:** ruby-talk\
**Created:** [25 February 2005 00:51 UTC](https://rubytalk.org/t/webrick-help/16693 "2005-02-25T00:51:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eko\_Budi\_Setiyo](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@Eko\_Budi\_Setiyo](https://rubytalk.org/u/Eko_Budi_Setiyo)\
**Post date:** [25 February 2005 00:51 UTC](https://rubytalk.org/t/webrick-help/16693/1 "2005-02-25T00:51:46Z")

</div>

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)  
> &nbsp;&nbsp;&nbsp;&nbsp;config.update(:DirectoryIndex =\> 'coreLoader.rb')  
> &nbsp;&nbsp;&nbsp;&nbsp;$server = HTTPServer.new(config)  
> &nbsp;&nbsp;&nbsp;&nbsp;yield server if block\_given?  
> &nbsp;&nbsp;&nbsp;&nbsp;['INT','TERM'].each { |signal|  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trap(signal) {server.shutdown}  
> &nbsp;&nbsp;&nbsp;&nbsp;}  
> &nbsp;&nbsp;&nbsp;&nbsp;$server.mount('/index',Index) $server.start  
> end  
> &nbsp;&nbsp;&nbsp;start\_webrick(:DocumentRoot =\> File.dirname(\_\_FILE\_\_))
> 
> #++++++++++++++++++++++++++++++++++++++++  
> #file class.index.rb  
> class Index \< HTTPServlet::AbstractServlet  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def do\_GET(req,resp)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Layout = ''  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load('coreLoader.rb')  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resp.body = $Layout end  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def Index.get\_instance config, \*options  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load \_\_FILE\_\_  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load('coreLoader.rb') Index.new config, \*options end  
> &nbsp;&nbsp;&nbsp;end
> 
> #+++++++++++++++++++++++++++++++++++++++++++
> 
> Any body know how to make file 'coreLoader.rb' always 're-loaded' when browser visit [http://localhost/index/xxx/yyy](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

---

<div class="post-metadata">

**Author:** ![Alexander\_Kellett2](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@Alexander\_Kellett2](https://rubytalk.org/u/Alexander_Kellett2)\
**Post date:** [25 February 2005 09:30 UTC](https://rubytalk.org/t/webrick-help/16693/2 "2005-02-25T09:30:21Z")

</div>

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

> **···**
>
> On Feb 25, 2005, at 1:51 AM, Eko Budi Setiyo wrote:
> 
> > 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)  
> > &nbsp;&nbsp;&nbsp;config.update(:DirectoryIndex =\> 'coreLoader.rb')  
> > &nbsp;&nbsp;&nbsp;$server = HTTPServer.new(config)  
> > &nbsp;&nbsp;&nbsp;yield server if block\_given?  
> > &nbsp;&nbsp;&nbsp;['INT','TERM'].each { |signal|  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trap(signal) {server.shutdown}  
> > &nbsp;&nbsp;&nbsp;}  
> > &nbsp;&nbsp;&nbsp;$server.mount('/index',Index) $server.start  
> > end  
> > &nbsp;&nbsp;start\_webrick(:DocumentRoot =\> File.dirname(\_\_FILE\_\_))
> > 
> > #++++++++++++++++++++++++++++++++++++++++  
> > #file class.index.rb  
> > class Index \< HTTPServlet::AbstractServlet  
> > &nbsp;&nbsp;&nbsp;def do\_GET(req,resp)  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Layout = ''  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load('coreLoader.rb')  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resp.body = $Layout end  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def Index.get\_instance config, \*options  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load \_\_FILE\_\_  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load('coreLoader.rb') Index.new config, \*options end  
> > &nbsp;&nbsp;end
> > 
> > #+++++++++++++++++++++++++++++++++++++++++++
> > 
> > Any body know how to make file 'coreLoader.rb' always 're-loaded' when browser visit [http://localhost/index/xxx/yyy](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

---

<div class="post-metadata">

**Author:** ![Eko\_Budi\_Setiyo](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@Eko\_Budi\_Setiyo](https://rubytalk.org/u/Eko_Budi_Setiyo)\
**Post date:** [25 February 2005 09:40 UTC](https://rubytalk.org/t/webrick-help/16693/3 "2005-02-25T09:40:10Z")

</div>

Alexander Kellett wrote:

> 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)  
> > &nbsp;&nbsp;&nbsp;config.update(:DirectoryIndex =\> 'coreLoader.rb')  
> > &nbsp;&nbsp;&nbsp;$server = HTTPServer.new(config)  
> > &nbsp;&nbsp;&nbsp;yield server if block\_given?  
> > &nbsp;&nbsp;&nbsp;['INT','TERM'].each { |signal|  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trap(signal) {server.shutdown}  
> > &nbsp;&nbsp;&nbsp;}  
> > &nbsp;&nbsp;&nbsp;$server.mount('/index',Index) $server.start  
> > end  
> > &nbsp;&nbsp;start\_webrick(:DocumentRoot =\> File.dirname(\_\_FILE\_\_))
> > 
> > #++++++++++++++++++++++++++++++++++++++++  
> > #file class.index.rb  
> > class Index \< HTTPServlet::AbstractServlet  
> > &nbsp;&nbsp;&nbsp;def do\_GET(req,resp)  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Layout = ''  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load('coreLoader.rb')  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resp.body = $Layout end  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def Index.get\_instance config, \*options  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load \_\_FILE\_\_  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load('coreLoader.rb') Index.new config, \*options end  
> > &nbsp;&nbsp;end
> > 
> > #+++++++++++++++++++++++++++++++++++++++++++
> > 
> > Any body know how to make file 'coreLoader.rb' always 're-loaded' when browser visit [http://localhost/index/xxx/yyy](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

> **···**
>
> > On Feb 25, 2005, at 1:51 AM, Eko Budi Setiyo wrote:

---

<div class="post-metadata">

**Author:** ![Eko\_Budi\_Setiyo](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@Eko\_Budi\_Setiyo](https://rubytalk.org/u/Eko_Budi_Setiyo)\
**Post date:** [28 February 2005 01:20 UTC](https://rubytalk.org/t/webrick-help/16693/4 "2005-02-28T01:20:54Z")

</div>

Eko Budi Setiyo wrote:

> Alexander Kellett wrote:
> 
> > 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)  
> > > &nbsp;&nbsp;&nbsp;config.update(:DirectoryIndex =\> 'coreLoader.rb')  
> > > &nbsp;&nbsp;&nbsp;$server = HTTPServer.new(config)  
> > > &nbsp;&nbsp;&nbsp;yield server if block\_given?  
> > > &nbsp;&nbsp;&nbsp;['INT','TERM'].each { |signal|  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trap(signal) {server.shutdown}  
> > > &nbsp;&nbsp;&nbsp;}  
> > > &nbsp;&nbsp;&nbsp;$server.mount('/index',Index) $server.start  
> > > end  
> > > &nbsp;&nbsp;start\_webrick(:DocumentRoot =\> File.dirname(\_\_FILE\_\_))
> > > 
> > > #++++++++++++++++++++++++++++++++++++++++  
> > > #file class.index.rb  
> > > class Index \< HTTPServlet::AbstractServlet  
> > > &nbsp;&nbsp;&nbsp;def do\_GET(req,resp)  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Layout = ''  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load('coreLoader.rb')  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resp.body = $Layout end  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def Index.get\_instance config, \*options  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load \_\_FILE\_\_  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load('coreLoader.rb') Index.new config, \*options end  
> > > &nbsp;&nbsp;end
> > > 
> > > #+++++++++++++++++++++++++++++++++++++++++++
> > > 
> > > Any body know how to make file 'coreLoader.rb' always 're-loaded' when browser visit [http://localhost/index/xxx/yyy](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

> **···**
>
> > > On Feb 25, 2005, at 1:51 AM, Eko Budi Setiyo wrote:
