@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. In case of a multipart request, one FlowFile is generated for each part.") @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.local.name",description="IP address/hostname of the server") @WritesAttribute(attribute="http.server.port",description="Listening port of the server") @WritesAttribute(attribute="http.query.string",description="The query string portion of the 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.protocol",description="The protocol used to communicate") @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.query.param.XXX",description="Each of query parameters in the request will be added as an attribute, prefixed with \"http.query.param.\"") @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\"") @WritesAttribute(attribute="http.headers.multipart.XXX",description="Each of the HTTP Headers that is received in the mulipart request will be added as an attribute, prefixed with \"http.headers.multipart.\" For example, if the multipart request contains an HTTP Header named \"content-disposition\", then the value will be added to an attribute named \"http.headers.multipart.content-disposition\"") @WritesAttribute(attribute="http.multipart.size",description="For requests with Content-Type \"multipart/form-data\", the part\'s content size is recorded into this attribute") @WritesAttribute(attribute="http.multipart.content.type",description="For requests with Content-Type \"multipart/form-data\", the part\'s content type is recorded into this attribute") @WritesAttribute(attribute="http.multipart.name",description="For requests with Content-Type \"multipart/form-data\", the part\'s name is recorded into this attribute") @WritesAttribute(attribute="http.multipart.filename",description="For requests with Content-Type \"multipart/form-data\", when the part contains an uploaded file, the name of the file is recorded into this attribute. Files are stored temporarily at the default temporary-file directory specified in \"java.io.File\" Java Docs)") @WritesAttribute(attribute="http.multipart.fragments.sequence.number",description="For requests with Content-Type \"multipart/form-data\", the part\'s index is recorded into this attribute. The index starts with 1.") @WritesAttribute(attribute="http.multipart.fragments.total.number",description="For requests with Content-Type \"multipart/form-data\", the count of all parts is recorded into this attribute.") @SeeAlso(value=HandleHttpResponse.class) public class HandleHttpRequest extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
private static class |
HandleHttpRequest.HttpRequestContainer |
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) |
private void |
forwardFlowFile(ProcessContext context,
ProcessSession session,
HandleHttpRequest.HttpRequestContainer container,
long start,
javax.servlet.http.HttpServletRequest request,
FlowFile flowFile) |
private HandleHttpRequest.HttpRequestContainer |
getNextContainer() |
protected int |
getPort() |
Set<Relationship> |
getRelationships() |
protected int |
getRequestQueueSize() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
handleFlowContentStreamingError(ProcessSession session,
HandleHttpRequest.HttpRequestContainer container,
javax.servlet.http.HttpServletRequest request,
com.google.common.base.Optional<FlowFile> flowFile,
Exception e) |
(package private) void |
initializeServer(ProcessContext context) |
void |
onPrimaryNodeChange(PrimaryNodeState newState) |
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) |
private boolean |
registerRequest(ProcessContext context,
ProcessSession session,
HandleHttpRequest.HttpRequestContainer container,
long start,
javax.servlet.http.HttpServletRequest request,
FlowFile flowFile) |
(package private) void |
rejectPendingRequests() |
private FlowFile |
savePartAttributes(ProcessContext context,
ProcessSession session,
javax.servlet.http.Part part,
FlowFile flowFile,
int i,
int allPartsCount) |
private FlowFile |
saveRequestAttributes(ProcessContext context,
ProcessSession session,
javax.servlet.http.HttpServletRequest request,
FlowFile flowFile,
String contextIdentifier) |
void |
shutdown() |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
private static final String MIME_TYPE__MULTIPART_FORM_DATA
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 PropertyDescriptor CONTAINER_QUEUE_SIZE
public static final PropertyDescriptor MULTIPART_REQUEST_MAX_SIZE
public static final PropertyDescriptor MULTIPART_READ_BUFFER_SIZE
public static final Relationship REL_SUCCESS
private static final List<PropertyDescriptor> propertyDescriptors
private volatile org.eclipse.jetty.server.Server server
private volatile boolean ready
private AtomicBoolean initialized
private volatile BlockingQueue<HandleHttpRequest.HttpRequestContainer> containerQueue
private AtomicBoolean runOnPrimary
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
@OnScheduled public void clearInit()
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)
@OnUnscheduled public void shutdown() throws Exception
Exception
void rejectPendingRequests()
private HandleHttpRequest.HttpRequestContainer getNextContainer()
@OnPrimaryNodeStateChange public void onPrimaryNodeChange(PrimaryNodeState newState)
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
private FlowFile savePartAttributes(ProcessContext context, ProcessSession session, javax.servlet.http.Part part, FlowFile flowFile, int i, int allPartsCount)
private FlowFile saveRequestAttributes(ProcessContext context, ProcessSession session, javax.servlet.http.HttpServletRequest request, FlowFile flowFile, String contextIdentifier)
private void forwardFlowFile(ProcessContext context, ProcessSession session, HandleHttpRequest.HttpRequestContainer container, long start, javax.servlet.http.HttpServletRequest request, FlowFile flowFile)
private boolean registerRequest(ProcessContext context, ProcessSession session, HandleHttpRequest.HttpRequestContainer container, long start, javax.servlet.http.HttpServletRequest request, FlowFile flowFile)
protected void handleFlowContentStreamingError(ProcessSession session, HandleHttpRequest.HttpRequestContainer container, javax.servlet.http.HttpServletRequest request, com.google.common.base.Optional<FlowFile> flowFile, Exception e)
Copyright © 2020 Apache NiFi Project. All rights reserved.