Index: [Article Count Order] [Thread]

Date: Thu, 13 Dec 2007 03:15:40 +0900
From: "GOTO Kentaro" <gotoken@gmail.com>
Subject: [webricken:166] Re: Basic Example/Tutorial Webrick Servlet forwarding to RHTML template...
To: webricken@notwork.org
Message-Id: <56838ac20712121015k250a29cfw5709926598155ff7@mail.gmail.com>
In-Reply-To: <a4e58b2b0712111449y316e9d31h40f845fca26b72e7@mail.gmail.com>
References: <a4e58b2b0712111449y316e9d31h40f845fca26b72e7@mail.gmail.com>
X-Mail-Count: 00166

Hi Sergio,

On Dec 12, 2007 7:49 AM, Sergio Oliveira <sergio.soujava@gmail.com> wrote:
> How do I do a simple forward from a ruby servlet to a rhtml file. Any link
> or tutorial that would explain me how to do that?

If you mean rhtml file will be downloaded from WEBrick::HTTPServer,
that is :MimeTypes problem.  I recently found default setting is not good.
Try this version of httpd.rb:
-----------------------------------
require "webrick"

mime = WEBrick::HTTPUtils::DefaultMimeTypes.dup
mime["rhtml"] = "text/html"

httpd = WEBrick::HTTPServer.new(
  :DocumentRoot => File::dirname(__FILE__),
  :Port         => 10080,
  :MimeTypes    => mime
)
trap(:INT){ httpd.shutdown }
httpd.start
-----------------------------------

with sample.rhtml
-----------------------------------
<title>time</title>
<%= Time.now %>
-----------------------------------

--
Gotoken