@InputRequirement(value=INPUT_FORBIDDEN) @Tags(value={"http","https","request","listen","ingress","web service"}) @CapabilityDescription(value="Starts an HTTP Server and listens for HTTP Requests. For each request, creates a FlowFile and transfers to \'success\'. This Processor is designed to be used in conjunction with the HandleHttpResponse Processor in order to create a Web Service") @WritesAttribute(attribute="http.context.identifier",description="An identifier that allows the HandleHttpRequest and HandleHttpResponse to coordinate which FlowFile belongs to which HTTP Request/Response.") @WritesAttribute(attribute="mime.type",description="The MIME Type of the data, according to the HTTP Header \"Content-Type\"") @WritesAttribute(attribute="http.servlet.path",description="The part of the request URL that is considered the Servlet Path") @WritesAttribute(attribute="http.context.path",description="The part of the request URL that is considered to be the Context Path") @WritesAttribute(attribute="http.method",description="The HTTP Method that was used for the request, such as GET or POST") @WritesAttribute(attribute="http.query.string",description="The query string portion of hte Request URL") @WritesAttribute(attribute="http.remote.host",description="The hostname of the requestor") @WritesAttribute(attribute="http.remote.addr",description="The hostname:port combination of the requestor") @WritesAttribute(attribute="http.remote.user",description="The username of the requestor") @WritesAttribute(attribute="http.request.uri",description="The full Request URL") @WritesAttribute(attribute="http.auth.type",description="The type of HTTP Authorization used") @WritesAttribute(attribute="http.principal.name",description="The name of the authenticated user making the request") @WritesAttribute(attribute="http.subject.dn",description="The Distinguished Name of the requestor. This value will not be populated unless the Processor is configured to use an SSLContext Service") @WritesAttribute(attribute="http.issuer.dn",description="The Distinguished Name of the entity that issued the Subject\'s certificate. This value will not be populated unless the Processor is configured to use an SSLContext Service") @WritesAttribute(attribute="http.headers.XXX",description="Each of the HTTP Headers that is received in the request will be added as an attribute, prefixed with \"http.headers.\" For example, if the request contains an HTTP Header named \"x-my-header\", then the value will be added to an attribute named \"http.headers.x-my-header\"") @SeeAlso(value=HandleHttpResponse.class, classNames={"org.apache.nifi.http.StandardHttpContextMap","org.apache.nifi.ssl.StandardSSLContextService"}) public class HandleHttpRequest extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
private static class |
HandleHttpRequest.HttpRequestContainer |
Modifier and Type | Field and Description |
---|---|
static PropertyDescriptor |
ADDITIONAL_METHODS |
static PropertyDescriptor |
ALLOW_DELETE |
static PropertyDescriptor |
ALLOW_GET |
static PropertyDescriptor |
ALLOW_HEAD |
static PropertyDescriptor |
ALLOW_OPTIONS |
static PropertyDescriptor |
ALLOW_POST |
static PropertyDescriptor |
ALLOW_PUT |
static PropertyDescriptor |
CLIENT_AUTH |
static AllowableValue |
CLIENT_NEED |
static AllowableValue |
CLIENT_NONE |
static AllowableValue |
CLIENT_WANT |
private BlockingQueue<HandleHttpRequest.HttpRequestContainer> |
containerQueue |
static PropertyDescriptor |
HOSTNAME |
static String |
HTTP_CONTEXT_ID |
static PropertyDescriptor |
HTTP_CONTEXT_MAP |
private AtomicBoolean |
initialized |
static PropertyDescriptor |
PATH_REGEX |
static PropertyDescriptor |
PORT |
static Relationship |
REL_SUCCESS |
private org.eclipse.jetty.server.Server |
server |
static PropertyDescriptor |
SSL_CONTEXT |
static PropertyDescriptor |
URL_CHARACTER_SET |
private static Pattern |
URL_QUERY_PARAM_DELIMITER |
Constructor and Description |
---|
HandleHttpRequest() |
Modifier and Type | Method and Description |
---|---|
void |
clearInit() |
private org.eclipse.jetty.util.ssl.SslContextFactory |
createSslFactory(SSLContextService sslService,
boolean needClientAuth,
boolean wantClientAuth) |
protected int |
getPort() |
Set<Relationship> |
getRelationships() |
protected int |
getRequestQueueSize() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
private void |
initializeServer(ProcessContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
private void |
putAttribute(Map<String,String> map,
String key,
Object value) |
private void |
putAttribute(Map<String,String> map,
String key,
String value) |
void |
shutdown() |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, init, initialize, isScheduled, toString, updateScheduledFalse, updateScheduledTrue
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
public static final String HTTP_CONTEXT_ID
private static final Pattern URL_QUERY_PARAM_DELIMITER
public static final AllowableValue CLIENT_NONE
public static final AllowableValue CLIENT_WANT
public static final AllowableValue CLIENT_NEED
public static final PropertyDescriptor PORT
public static final PropertyDescriptor HOSTNAME
public static final PropertyDescriptor HTTP_CONTEXT_MAP
public static final PropertyDescriptor SSL_CONTEXT
public static final PropertyDescriptor URL_CHARACTER_SET
public static final PropertyDescriptor PATH_REGEX
public static final PropertyDescriptor ALLOW_GET
public static final PropertyDescriptor ALLOW_POST
public static final PropertyDescriptor ALLOW_PUT
public static final PropertyDescriptor ALLOW_DELETE
public static final PropertyDescriptor ALLOW_HEAD
public static final PropertyDescriptor ALLOW_OPTIONS
public static final PropertyDescriptor ADDITIONAL_METHODS
public static final PropertyDescriptor CLIENT_AUTH
public static final Relationship REL_SUCCESS
private volatile org.eclipse.jetty.server.Server server
private AtomicBoolean initialized
private final BlockingQueue<HandleHttpRequest.HttpRequestContainer> containerQueue
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
@OnScheduled public void clearInit()
private void initializeServer(ProcessContext context) throws Exception
Exception
protected int getPort()
protected int getRequestQueueSize()
private org.eclipse.jetty.util.ssl.SslContextFactory createSslFactory(SSLContextService sslService, boolean needClientAuth, boolean wantClientAuth)
@OnStopped public void shutdown() throws Exception
Exception
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
Copyright © 2015 Apache NiFi Project. All rights reserved.