GitHub user lucarosellini opened a pull request: https://github.com/apache/flume/pull/18
Extension-friendly HttpSource 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: 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","..."); } } } You can merge this pull request into a Git repository by running: $ git pull https://github.com/keedio/flume customizable_httpsource Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flume/pull/18.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #18 ---- commit dbfa17c24e32f4c6e001c2df4343d1b5dba98ab4 Author: Luca Rosellini <luca.rosell...@gmail.com> Date: 2015-05-29T06:59:45Z HTTPSource refactor to allow third party extensions and customizations commit 9484a5fdd5f47ef2d4a2f900120a232b8737fe65 Author: Luca Rosellini <luca.rosell...@gmail.com> Date: 2015-05-29T07:28:35Z Added JavaDoc documentation ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---