Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > not using offline mode in webrick

Reply
Thread Tools

not using offline mode in webrick

 
 
Max Benjamin
Guest
Posts: n/a
 
      03-26-2007
Hello list,
I'm using webrick to serve up rhtml pages and can't seem to access cgi
variables. My very very simple server looks like this:
########################
require 'webrick'
include WEBrick

def start_webrick(config = {})
config.update(ort => 8080)
config.update(:MimeTypes => {'rhtml' => 'text/html'})
server = HTTPServer.new(config)
yield server if block_given?
['INT', 'TERM'].each {|signal|
trap(signal) {server.shutdown}
}
ruby_dir = File.expand_path('html')
server.mount("html", HTTPServlet::ERBHandler, ruby_dir)
server.start
end

start_webrick(ocumentRoot => 'html')
#########################

When I attempt to get cgi variables I receive the following message:
(offline mode: enter name=value pairs on standard input)

How do I run the program in "non-offline" mode?

Thanks for the help!

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Eric Hodel
Guest
Posts: n/a
 
      03-28-2007
On Mar 26, 2007, at 11:37, Max Benjamin wrote:

> Hello list,
> I'm using webrick to serve up rhtml pages and can't seem to access cgi
> variables. My very very simple server looks like this:
> ########################
> require 'webrick'
> include WEBrick
>
> def start_webrick(config = {})
> config.update(ort => 8080)
> config.update(:MimeTypes => {'rhtml' => 'text/html'})
> server = HTTPServer.new(config)
> yield server if block_given?
> ['INT', 'TERM'].each {|signal|
> trap(signal) {server.shutdown}
> }
> ruby_dir = File.expand_path('html')
> server.mount("html", HTTPServlet::ERBHandler, ruby_dir)
> server.start
> end
>
> start_webrick(ocumentRoot => 'html')
> #########################
>
> When I attempt to get cgi variables I receive the following message:
> (offline mode: enter name=value pairs on standard input)
>
> How do I run the program in "non-offline" mode?


Don't use CGI variables, use objects handed to the ERb page by
WEBrick. I think they're in meta_vars and query.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WEBrick: Has anyone used WEBrick::Session? Lloyd Zusman Ruby 2 02-21-2013 06:49 PM
re: mmm-mode, python-mode and doctest-mode? Edward Loper Python 0 08-07-2007 08:58 AM
WEBrick::Daemon and WEBrick Aaron Smith Ruby 2 03-18-2007 03:47 AM
mmm-mode, python-mode and doctest-mode? John J Lee Python 3 12-01-2005 08:35 PM
Safe Mode (?) - It is meant to be normal mode but looks like safe mode English Patient Computer Support 3 10-03-2004 11:10 PM



Advertisments