Hello,

I'd like to propose an addition to the Servlet specification
through the JCP, but thought I'd ask first on the tomcat-dev
list if anyone has seen a similar request.

There is currently no way in the Servlet spec to know the number
of bytes that have been read as a ServletRequest is being processed.
By the time Servlet.service() or Filter.doFilter() are called,
the *entire* InputStream has been read from the socket.

But what if one is trying to implement certain behavior after every
n bytes have been consumed? There is presently no way to do this
without writing a custom Servlet Container (or extending Coyote).

Likewise, the same holds true for knowing the number of bytes that
have been written to an OutputStream in "real-time."

I believe these capabilities can be supported with the addition of
one new EventListener interface, something like:

  public interface javax.servlet.ServletStreamListener {

    /**
     * Called repeatedly by the Servlet container
     * after n bytes have been read/written to/from a ServletRequest
     * or ServletResponse, where n is the integer returned by
     * getCallbackThreshold().
     */
    public void thresholdReached();


    /**
     * The number of bytes to read/write before calling
     * thresholdReached().
     */
    public int getCallbackThreshold();

  }

Has anyone seen this kind of specification request made before? I'd
rather not waste the time of JSR154/JCP if this is a common request that
has been previously shot down.

Thank you,

Eric H. Jung
[EMAIL PROTECTED]


-- 
http://www.fastmail.fm - IMAP accessible web-mail

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to