Index: [Article Count Order] [Thread]

Date:  Sat, 06 Apr 2002 08:37:16 +0900
From:  GOTO Kentaro <gotoken@notwork.org>
Subject:  [webricken:91] Re: "Right" way to send data to browser?
To:  webricken@notwork.org
Message-Id:  <87sn69wwcz.wl@miso.k.notwork.org>
In-Reply-To:  <p05101502b8d3df827cb8@[192.168.1.2]>
References:  <Pine.LNX.4.33.0204050019360.21171-100000@fangora.fourthcrusade.com>	<p05101501b8d3a88097ae@192.168.1.2>	<p05101502b8d3df827cb8@192.168.1.2>
X-Mail-Count: 00091

At Fri, 5 Apr 2002 18:19:47 -0500,
Brad Cox wrote:

> Does webricken provide a way to incrementally add to the response 
> output, other than += which seems wasteful?

No, unfortunately. res.body has to be given as a string.  res.body is
a writable string accessor and << is available.  The following seems
little wasteful:

  body = res.body 
  body << "<HTML>hello, world.</HTML>"
  body << "<h1>Header</h1>"
  body << "<p>blah, blah</p>"
  body << "<p>and so forth</p>"
  res['Content-Type'] = "text/html"

By the way, the name of this humble toolkit is WEBrick, not webricken :)

-- Gotoken