flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject git commit: FLUME-1659: JSON Handler should return simple events, not JSONEvents
Date Mon, 29 Oct 2012 21:05:02 GMT
Updated Branches:
  refs/heads/flume-1.4 5d7bcd85d -> 5c65867cf


FLUME-1659: JSON Handler should return simple events, not JSONEvents

(Hari Shreedharan via Brock Noland)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/5c65867c
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/5c65867c
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/5c65867c

Branch: refs/heads/flume-1.4
Commit: 5c65867cfbdb21c4690e7eb5c1b02b8d739fb818
Parents: 5d7bcd8
Author: Brock Noland <brock@apache.org>
Authored: Mon Oct 29 16:03:39 2012 -0500
Committer: Brock Noland <brock@apache.org>
Committed: Mon Oct 29 16:03:55 2012 -0500

----------------------------------------------------------------------
 .../org/apache/flume/source/http/JSONHandler.java  |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/5c65867c/flume-ng-core/src/main/java/org/apache/flume/source/http/JSONHandler.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/main/java/org/apache/flume/source/http/JSONHandler.java b/flume-ng-core/src/main/java/org/apache/flume/source/http/JSONHandler.java
index 9e1af7a..197f66a 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/source/http/JSONHandler.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/source/http/JSONHandler.java
@@ -29,6 +29,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import org.apache.flume.Context;
 import org.apache.flume.Event;
+import org.apache.flume.event.EventBuilder;
 import org.apache.flume.event.JSONEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -121,10 +122,18 @@ public class JSONHandler implements HTTPSourceHandler {
     for (Event e : eventList) {
       ((JSONEvent) e).setCharset(charset);
     }
-    return eventList;
+    return getSimpleEvents(eventList);
   }
 
   @Override
   public void configure(Context context) {
   }
+
+  private List<Event> getSimpleEvents(List<Event> events) {
+    List<Event> newEvents = new ArrayList<Event>(events.size());
+    for(Event e:events) {
+      newEvents.add(EventBuilder.withBody(e.getBody(), e.getHeaders()));
+    }
+    return newEvents;
+  }
 }


Mime
View raw message