[plt-scheme] accessing output port of servlet?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Apr 2 12:38:49 EDT 2007

Here is a simple one:

(require (lib "servlet-sig.ss" "web-server")
         (lib "unit.ss"))

(unit
  (import servlet^)
  (export)

  (send/finish
   (make-html-response/incremental
    (lambda (output-chunk)
      (output-chunk "<html><head><title>"
                    "my-title</title></head>\n")
      (output-chunk "<body><p>The first paragraph</p>\n")
      (sleep 4)
      (output-chunk "<p>The second paragraph</p></body></html>\n")))))

On 3/28/07, Yin-So Chen <yinso.chen at gmail.com> wrote:
> Thanks - I will give it a try.  I couldn't find an example on how the
> function (gen output) is written - would you happen to have an example?
>
> Thanks,
> yinso
>
>
> On 3/28/07, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> > Not directly, but perhaps make-response/incremental is what you need.
> >
> >
> http://download.plt-scheme.org/doc/360/html/web-server/web-server-Z-H-12.html#node_sec_10.1.3
> >
> > Jay
> >
> > On 3/27/07, Yin-So Chen <yinso.chen at gmail.com> wrote:
> > > Hi -
> > >
> > > how can I access the output-port within a servlet?  The scenario is when
> I
> > > have a large file that shouldn't be held in memory but better accessed
> via a
> > > pipe between input and output port.  As far as I can tell the request
> object
> > > doesn't take a port for body content.  Let me know if I missed anything,
> > > thanks.
> > >
> > > yinso
> > >
> > > --
> > > http://www.yinsochen.com
> > > ...continuous learning...
> > > _________________________________________________
> > >   For list-related administrative tasks:
> > >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> > >
> > >
> >
> >
> > --
> > Jay McCarthy < jay.mccarthy at gmail.com>
> > http://jay.teammccarthy.org
> >
>
>
>
> --
>
>  http://www.yinsochen.com
> ...continuous learning...


-- 
Jay McCarthy <jay.mccarthy at gmail.com>
http://jay.teammccarthy.org


Posted on the users mailing list.