WriteListener (Servlet 4.0 API Documentation - Apache Tomcat 9.0.37)

javax.servlet

## Interface WriteListener

- All Superinterfaces:
    java.util.EventListener

      public interface WriteListener
      extends java.util.EventListener

  Receives notification of write events when using non-blocking IO.
  Since:
    Servlet 3.1

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onError(java.lang.Throwable throwable)` Invoked if an error occurs while writing the response.
    `void` | `onWritePossible()` Invoked when it it possible to write data without blocking.

- - ### Method Detail

    - #### onWritePossible

          void onWritePossible()
                        throws java.io.IOException

      Invoked when it it possible to write data without blocking. The container will invoke this method the first time for a request as soon as data can be written. Subsequent invocations will only occur if a call to `ServletOutputStream.isReady()` has returned false and it has since become possible to write data.
      Throws:
        `java.io.IOException` - if an I/O error occurs while processing this event

    - #### onError

          void onError(java.lang.Throwable throwable)

      Invoked if an error occurs while writing the response.
      Parameters:
        `throwable` - The throwable that represents the error that occurred

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.