users@servlet-spec.java.net

[servlet-spec users] Re: Default methods for event listeners?

From: Eirik Bjørsnøs <eirbjo_at_gmail.com>
Date: Wed, 23 Sep 2015 14:10:14 +0200

Then perhaps also consider empty default methods for Filter.init and
Filter.destroy?

A year ago I proposed adding an abstract HttpFilter class for symmetry with
HttpServlet. I'm kind of tired of casting ServletRequest/Response to their
Http subtypes _every_ time I write a filter.

Here's my proposal from October last year:

https://java.net/projects/servlet-spec/lists/users/archive/2014-10/message/1

I did not get any kind of feedback on that proposal. I guess experts don't
write filters ;-)

Cheers,
Eirik.

On Wed, Sep 23, 2015 at 2:01 PM, Mark Thomas <markt_at_apache.org> wrote:

> On 23/09/2015 12:33, arjan tijms wrote:
> > Hi,
> >
> > The Servlet event listener interfaces, such as e.g.
> > ServletRequestListener, or AsyncListener have multiple methods that
> > implementations must implement.
> >
> > However, in many cases implementations are only interested in one
> > event. E.g. I may be interested in requestInitialized, but I still
> > have to provide an empty method for requestDestroyed.
> >
> > Using JDK 8 default methods this can be easily overcome; provide
> > (empty) default methods for all interface methods and then
> > applications only have to implement what they're interested in.
> >
> > Thoughts?
>
> +1
>
> Mark
>
>