ASStreamOut is for allowing flexibility in when the response is sent to the
client.  It allows the response to start going to the client before the
servlet is finished processing.

If you call ASStreamOut.flush(), it will start sending the response data it
has accumulated so far.  By default, it holds all of the response data until
the servlet is finished processing and then sends it all at once (more or
less).

The PushServlet tests this by using the x-mixed-replace content type.  This
content type tells the browser that the server is going to be sending
multiple pages that should be displayed in full as they are received.  So
the Servlet sends page one, the browser displays it, the servlet waits a
second then sends page two, the browser replaces page one with page two,
etc.  MSFT IE doesn't support this content type, so you just see text
streaming down the browser.  Oh well.

Jay

> -----Original Message-----
> From: Titus Brown [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 17, 2002 9:31 PM
> To: [EMAIL PROTECTED]
> Subject: [Webware-discuss] PyWX adapter for Webware.
> 
> 
> Hi all,
> 
> I spent some time today bashing on a rewrite of the PyWX adapter for
> Webware (which none of you have ever seen, anyway ;).  I have some
> questions for y'all.
> 
> Some background: PyWX is an embedding of Python in AOLserver, a
> high-performance multi-threaded Web server.  The goal of the PyWX
> adapter for Webware is to run an actual ApplicationServer inside of
> PyWX, so that you avoid the latencies of communicating with 
> the AppServer.
> 
> The main code is below. This code goes in a file that is 
> imported once, at
> the start of the Web server; 'handle' is called once for 
> every connection
> under '/w/' on the server.
> 
> ============================================
> 
> class PyWXAppServer(AppServer):
>     def isPersistent(self):
>         return 1
> 
>     def dispatchRawRequest(self, newRequestDict, strmOut):
>         return self._app.dispatchRawRequest(newRequestDict, strmOut)
> 
> appServer = PyWXAppServer()           # start the AppServer
> 
> def handle(conn):
>     # get a handle to the AOLserver connection that looks 
> like a file handle
>     buff = PyWX_buffer.GetBuff()
> 
>     # Create a fake CGI-like environment to pass in to Webware:
>     env = {}
>     ns_setup.create_cgi_environ(conn, env)
>     env['SCRIPT_NAME'] = '/w'
>     env['PATH_INFO'] = conn.request.url[2:]
>    
>     # Create the dictionary that 'we
>     d = {}
>     d['format'] = 'CGI'
>     d['time'] = asctime(localtime(time()))
>     d['environ'] = env
>     d['input'] = buff.read()
> 
>     # Create an output stream for the app server:
>     out = ASStreamOut()
> 
>     # Call the app server
>     appServer.dispatchRawRequest(d, out)
> 
>     # Output the results!
>     buff.write(out._buffer)
>     buff.close()
> 
> ============================================
> 
> OK, so a couple of questions (because I'm lazy and sick of reading
> code today ;):
> 
> * what's the most efficient way to pass information in to 
> Webware?  What
>       are the various formats (d['format'], above) that can be used,
>       and which one should I use?
> 
> * what the hell is ASStreamOut for?  (OK, that's somewhat 
> rhetorical - I know
>       what it's for, but if someone could give me a 
> one-paragraph history
>       of why it's needed, I would appreciate it.)
> 
> * I can't get PushServlet to work.  What is it supposed to 
> do?  What am I
>       screwing up?
> 
> Err, I guess that's it.  I would welcome any suggestions; I 
> sort of hacked
> this together today after working on some other things, and 
> so I'm aware it's
> probably not optimal.  Let's make it optimal! -- this should 
> easily be faster
> than any other Webware adapter, because it's all running in-process...
> 
> --titus
> 
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
> 


----------------------------------------------------------------------------

This e-mail and any attachments may be confidential or legally privileged.
If you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein.  Please inform us of the erroneous delivery by return
e-mail. 

Thank you for your cooperation.

----------------------------------------------------------------------------



_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to