org.apache.flume.sink.solr.morphline
Class BlobHandler

java.lang.Object
  extended by org.apache.flume.sink.solr.morphline.BlobHandler
All Implemented Interfaces:
Configurable, HTTPSourceHandler

public class BlobHandler
extends Object
implements HTTPSourceHandler

BlobHandler for HTTPSource that returns event that contains the request parameters as well as the Binary Large Object (BLOB) uploaded with this request.

Note that this approach is not suitable for very large objects because it buffers up the entire BLOB.

Example client usage:

 curl --data-binary @sample-statuses-20120906-141433-medium.avro 'http://127.0.0.1:5140?resourceName=sample-statuses-20120906-141433-medium.avro' --header 'Content-Type:application/octet-stream' --verbose
 


Field Summary
static int MAX_BLOB_LENGTH_DEFAULT
           
static String MAX_BLOB_LENGTH_KEY
           
 
Constructor Summary
BlobHandler()
           
 
Method Summary
 void configure(Context context)
           Request the implementing class to (re)configure itself.
 List<Event> getEvents(javax.servlet.http.HttpServletRequest request)
          Takes an HttpServletRequest and returns a list of Flume Events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_BLOB_LENGTH_KEY

public static final String MAX_BLOB_LENGTH_KEY
See Also:
Constant Field Values

MAX_BLOB_LENGTH_DEFAULT

public static final int MAX_BLOB_LENGTH_DEFAULT
See Also:
Constant Field Values
Constructor Detail

BlobHandler

public BlobHandler()
Method Detail

configure

public void configure(Context context)
Description copied from interface: Configurable

Request the implementing class to (re)configure itself.

When configuration parameters are changed, they must be reflected by the component asap.

There are no thread safety guarrantees on when configure might be called.

Specified by:
configure in interface Configurable

getEvents

public List<Event> getEvents(javax.servlet.http.HttpServletRequest request)
                      throws Exception
Description copied from interface: HTTPSourceHandler
Takes an HttpServletRequest and returns a list of Flume Events. If this request cannot be parsed into Flume events based on the format this method will throw an exception. This method may also throw an exception if there is some sort of other error.

Specified by:
getEvents in interface HTTPSourceHandler
Parameters:
request - The request to be parsed into Flume events.
Returns:
List of Flume events generated from the request.
Throws:
HTTPBadRequestException - If the was not parsed correctly into an event because the request was not in the expected format.
Exception - If there was an unexpected error.


Copyright © 2009-2013 Apache Software Foundation. All Rights Reserved.