users@servlet-spec.java.net

[servlet-spec users] Re: 141-GenericFilter and HttpFilter (was: Re: Default methods for event listeners?)

From: Edward Burns <edward.burns_at_oracle.com>
Date: Mon, 28 Sep 2015 15:44:49 -0700

>>>>> On Thu, 24 Sep 2015 10:02:33 +0200, Eirik Bjørsnøs <eirbjo_at_gmail.com> said:

Eirik> * Should HttpFilter::filter be abstract nor not? I kind of like
Eirik> the idea of having a no-op filter, but it also has benefits to
[...]
Eirik> least document in Javadoc that "There's almost no reason to
Eirik> override the filter(ServletRequest method.."), like HttpServlet
Eirik> documents for the service method.)

I've added that "there's no need to override this method. Also, I made
doFilter(HttpServletRequest req, HttpServletResponse resp) protected, to
match the way we do it on HttpServlet.

Eirik> * GenericFilter::getFilterInfo: I guess you added this to reflect
Eirik> Servlet::getServletInfo. But Filter has no getFilterInfo, so how
Eirik> much sense does it make to add it in GenericFilter? I suggest we
Eirik> skip it unless there are compelling reasons to include it.

I've dropped it.

Eirik> Otherwise, thank you for your quick turnaround on this!

You're too charitable. I hardly think nearly a year is quick
turnaround!

>>>>> On Thu, 24 Sep 2015 11:28:45 +0200, Eirik Bjørsnøs <eirbjo_at_gmail.com> said:

EB> Ed,
EB> I noticed that HttpFilter.service(ServletRequest..) throws a
EB> ServletException if the request/response are not
EB> HttpServletRe[quest|sponse].

EB> Should HttpFilter.doFilter do the same?

EB> I don't know if / when this will ever happen. But I guess consistency never
EB> hurts.

More than that. In specs, consistency is essential. I assume you mean
HttpServlet.service(ServletRequest...)? While it is true that the API
implementation does that, the javadoc doesn't say it does that. I think
that should be in the spec and I've created SERVLET_SPEC-143 for that.

I've committed it to the topic branch and also uploaded a new SNAPSHOT
[1].

Let me confer with Shing-wai and see if it's ready for the EG.

Thanks,

Ed

-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| 28 Business days til JavaOne 2015
| 43 Business days til DOAG 2015
[1] https://maven.java.net/service/local/repositories/snapshots/archive/javax/servlet/javax.servlet-api/4.0.0-b01-SERVLET_SPEC-141-SNAPSHOT/javax.servlet-api-4.0.0-b01-SERVLET_SPEC-141-20150928.223651-2-javadoc.jar/!/index.html