flume-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bessenyei Balázs Donát (JIRA) <j...@apache.org>
Subject [jira] [Commented] (FLUME-2782) Extension-friendly HttpSource
Date Wed, 02 Nov 2016 21:55:58 GMT

    [ https://issues.apache.org/jira/browse/FLUME-2782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15630660#comment-15630660
] 

Bessenyei Balázs Donát commented on FLUME-2782:
-----------------------------------------------

[~lrosellini@keedio.com], [~tmgstev], [~denes]: the only references I remember about PR-s
for Flume is at https://github.com/apache/flume/pull/52 and https://issues.apache.org/jira/browse/FLUME-2922
.

(As per [https://community.apache.org/newbiefaq.html#is-there-a-code-of-conduct-for-apache-projects],
we should discuss this on the dev@ list if we want to have consensus on it.)

(I personally prefer PR-s to reviewboard or attached patches.)

> 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)

Mime
View raw message