groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <>
Subject [jira] [Commented] (GROOVY-5227) AbstractHttpServlet should extend GenericServlet directly instead of HttpServlet
Date Thu, 22 Jun 2017 04:46:00 GMT


Paul King commented on GROOVY-5227:

I agree with John and have these additional comments:
* when updating the doco for {{GroovyServlet}} we could specifically mention that when writing
your own servlet consider extending {{AbstractHttpServlet}} to guide people in the right direction
- in case they come to {{GroovyServlet}} and want it to be more extensible for that purpose.
* we could make {{GroovyServlet}} slightly more customisable. This wouldn't be as the basis
for writing your own vanilla servlets but creating a custom Groovlet handling class. We could
create a protected {{doService}} method as suggested above, have {{service}} call it (for
BC) and also provide a protected {{doMethodDispatch}} method that called {{super.service}}.
If someone wanted Groovlets but only for say GETs, they could create a {{GetGroovyServlet}}
extending {{GroovyServlet}}, override {{service}} to call {{doMethodDispatch}} and have {{doGet}}
call {{doService}}. They could do something similar if they wanted to reactivate {{getLastModified}}.
For me, this has less priority than the doco.

> AbstractHttpServlet should extend GenericServlet directly instead of HttpServlet
> --------------------------------------------------------------------------------
>                 Key: GROOVY-5227
>                 URL:
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Groovlet / GSP
>    Affects Versions: 1.7.5
>            Reporter: Benjamin Gandon
>            Priority: Trivial
> The {{groovy.servlet.AbstractHttpServlet}} class overrides the {{service(HttpServletRequest,
HttpServletResponse)}} method.
> Thus all the circuitry implemented in the {{javax.servlet.http.HttpServlet}} superclass
is bypassed altogether, except the trivial {{service(ServletRequest, ServletResponse)}} method
which only provides a convenient call to {{service(HttpServletRequest, HttpServletResponse)}},
narrowing the request and response types to HTTP-dedicated subclasses.
> None of the doGet, getLastModified, doHead, doPost, doPut, doDelete, doOption, doTrace,
is ever called. Are they relevant to any {{AbstractHttpServlet}} subclasses? I doubt so. The
programming model of {{GroovyServlet}} currently implies re-implementing in Groovlets the
way these HTTP methods should be answered.
> Then it might be a possible optimization to have {{AbstractHttpServlet}} extend {{GenericServlet}}
directly, re-implementing in {{AbstractHttpServlet}} the trivial {{service(ServletRequest,
ServletResponse)}} method of {{HttpServlet}}. This could prevent the unnecessary loading of
the {{HttpServlet}} class in memory.

This message was sent by Atlassian JIRA

View raw message