[plt-scheme] Servlet communication

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Apr 23 08:34:25 EDT 2007

Here's a simple example:

(module count mzscheme
 (require (lib "servlet.ss" "web-server"))
 (provide (all-defined))
 (define interface-version 'v1)
 (define timeout 60)
 (define count (box 0))
 (define (start _)
  (set-box! count (add1 (unbox count))
  `(html (head (title "Example"))
           (body (p "This servlet has been viewed " ,(number->string
(unbox count)) " times.")))))

You can use imperative features of the language to store things.
Similarly, you could write:

(define queue (make-kill-safe-message-queue))


There's nothing special you need to do because you are writing a servlet.


nb. This is sharing between servlet instances, sharing between
servlets (i.e. a.ss and b.ss) is more complicated.

On 4/23/07, Aycan iRiCAN <aycan.irican at core.gen.tr> wrote:
> "Jay McCarthy" <jay.mccarthy at gmail.com> writes:
> > I'm not quite sure what you mean. Can you be more specific in what
> > you'd like to accomplish?
> >
> > Jay
> >
> > On 4/22/07, Aycan iRiCAN <aycan.irican at core.gen.tr> wrote:
> >>
> >> How two servlets communicate? Share things?
> I want to share a list of things between servlet instances. For
> example, students queue questions to a list. And teachers dequeue a
> question from this list and post an answer.
> Another example might be a kill-safe message queue which can be used
> to send messages between servlet instances (or users).
> Best Regards,
> --
> Aycan iRiCAN
> KOR Bilişim Teknolojileri
> http://www.core.gen.tr/

Jay McCarthy <jay.mccarthy at gmail.com>

Posted on the users mailing list.