Hi,
I am just starting in both ruby and web development so maybe the
following pieces of code seem a sin for most of you.
I am writing a HTML form in a rhtml file and pass the parameters to
antoher rhtml with embebed ruby.
The HTTP server is built as follows:
require ‘webrick’
include WEBrick
def start_webrick(config = {})
config.update(:Port => 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(‘/www’)
server.mount(“/www”, HTTPServlet::ERBHandler, ruby_dir)
server.start
end
start_webrick(:DocumentRoot => ‘/www’)
the index.htrml is like follows
METAR:
And finally the response.rhtml is
<% require 'cgi'
cgi = CGI.new
#Rest of code
%>
The webrick server shows the following info while the loading of
response.rhtml simply freezes
[2007-02-03 09:48:15] INFO WEBrick 1.3.1
[2007-02-03 09:48:15] INFO ruby 1.8.5 (2006-08-25) [i386-mswin32]
[2007-02-03 09:48:15] INFO WEBrick::HTTPServer#start: pid=1372
port=8080
nicalejo - - [03/Feb/2007:09:48:29 Romance Standard Time] “GET / HTTP/
1.1” 200 1
93
- → /
[2007-02-03 09:48:43] ERROR `/response.rhtml’ not found.
nicalejo - - [03/Feb/2007:09:48:43 Romance Standard Time] “POST /
response.rhtml
HTTP/1.1” 404 284
http://localhost:8080 → /response.rhtml
(offline mode: enter name=value pairs on standard input)
Why this offline message? Any suggestion?
Thanks in advance to the rubyists