[ https://issues.apache.org/jira/browse/FLUME-2782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15629355#comment-15629355 ]
Denes Arvay commented on FLUME-2782: ------------------------------------ I'm a bit concerned about exposing the whole {{FlumeHTTPServlet}}, so what about moving the {{customizeServletResponse()}} to the {{HTTPSource}} class itself? The {{FlumeHTTPServlet}} is able to access it as it's a non-static inner class. We would hit two birds with one stone: the {{FlumeHTTPServlet}} wouldn't be exposed and the custom {{HTTPSource}} implementation would be simpler: there wouldn't be need for creating a subclass for the {{FlumeHTTPServlet}} as both of the customization methods could be overwritten in the {{HTTPSource}} subclass. Btw, what are the potential use-cases for this? I'm just wondering whether the same result can be achieved by http servlet filters. Not sure though. Regarding to the PR/Reviewboard: I don't know the historical reasons of preferring Reviewboard over GitHub PRs, but now we are moving towards GitHub as it seems to be more convenient to use. > Extension-friendly HttpSource > ----------------------------- > > Key: FLUME-2782 > URL: https://issues.apache.org/jira/browse/FLUME-2782 > Project: Flume > Issue Type: Improvement > Components: Sinks+Sources > Affects Versions: v1.6.0, v1.5.2 > Reporter: Luca Rosellini > Labels: HTTP, Source > Attachments: extensible-flume-HttpSource.patch > > > This patch allows third-party to developers extend HttpSource behavior > easily, without having to reimplement the whole thing. > More specifically: > * Adds an hook to customize {{org.mortbay.jetty.servlet.Context}}. > * Delegates the HttpServlet instance creation to a protected factory method. > * Changes FlumeHttpServlet visibility to {{protected}}, to let third party > developers extend from it. > * Adds an hook in {{FlumeHTTPServlet}} to customize {{HttpServletResponse}} > before it is flushed. > We developed this patch because we had to add a custom servlet filter to the > Jetty context. > Having this patch applied, a third-party developer could easily extend > {{HttpSource}} like this: > {code:title=CustomHTTPSource.java|borderStyle=solid} > public class CustomHTTPSource extends HTTPSource { > @Override > protected void customizeServletContext(Context context) { > super.customizeServletContext(context); > context.addFilter(MyCustomHttpServletFilter.class,"/*",0); > } > @Override > protected HttpServlet getServlet() { > return new KeedioFlumeHTTPServlet(); > } > protected class KeedioFlumeHTTPServlet extends FlumeHTTPServlet{ > @Override > protected void customizeServletResponse(HttpServletRequest request, > HttpServletResponse response) { > super.customizeServletResponse(request, response); > response.addHeader("Accept-Encoding","..."); > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)