anjana-ackroyd / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

FilterServletOutputStream does not implement Servlet 3.1 abstract methods #436

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you try and use Servlet 3.1 async methods on a ServletOutputStream that is 
wrapped with the CounterResponseWrapper (eg setWriteListener), a java exception 
is thrown complaing that the method is abstract.

This is because the Java Melody class FilterServletOutputStream does not 
implement these abstract methods, new in Servlet 3.1 spec:

    /**
     * Checks if a non-blocking write will succeed. If this returns
     * <code>false</code>, it will cause a callback to
     * {@link WriteListener#onWritePossible()} when the buffer has emptied. If
     * this method returns <code>false</code> no further data must be written
     * until the contain calls {@link WriteListener#onWritePossible()}.
     *
     * @return <code>true</code> if data can be written, else <code>false</code>
     *
     * @since Servlet 3.1
     */
    public abstract boolean isReady();

    /**
     * Sets the {@link WriteListener} for this {@link ServletOutputStream} and
     * thereby switches to non-blocking IO. It is only valid to switch to
     * non-blocking IO within async processing or HTTP upgrade processing.
     *
     * @param listener  The non-blocking IO write listener
     *
     * @throws IllegalStateException    If this method is called if neither
     *                                  async nor HTTP upgrade is in progress or
     *                                  if the {@link WriteListener} has already
     *                                  been set
     * @throws NullPointerException     If listener is null
     *
     * @since Servlet 3.1
     */
    public abstract void setWriteListener(javax.servlet.WriteListener listener);

Original issue reported on code.google.com by jon.ner...@gmail.com on 15 Sep 2014 at 4:02

GoogleCodeExporter commented 9 years ago

Original comment by evernat@free.fr on 15 Sep 2014 at 10:44

GoogleCodeExporter commented 9 years ago
It should be fixed in trunk (revision 3993) and ready for the next release 
(1.55).
And some ServletInputStream should also be fixed like ServletOutputStream in 
the same revision.

You can test a new build from trunk including the fix, which is available at:
https://javamelody.ci.cloudbees.com/job/javamelody%20ant/lastSuccessfulBuild/art
ifact/javamelody.jar

Thanks jon for the issue.

Original comment by evernat@free.fr on 13 Dec 2014 at 11:44