Class HandleHttpRequest
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.HandleHttpRequest
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@InputRequirement(INPUT_FORBIDDEN)
@Tags({"http","https","request","listen","ingress","web service"})
@CapabilityDescription("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.param.XXX",description="Form parameters in the request that are configured by \"Parameters to Attributes List\" will be added as an attribute, prefixed with \"http.param.\". Putting form parameters of large size is not recommended.") @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.certificate.sans.N.name",description="X.509 Client Certificate Subject Alternative Name value from mutual TLS authentication. The attribute name has a zero-based index ordered according to the content of Client Certificate") @WritesAttribute(attribute="http.certificate.sans.N.nameType",description="X.509 Client Certificate Subject Alternative Name type from mutual TLS authentication. The attribute name has a zero-based index ordered according to the content of Client Certificate. The attribute value is one of the General Names from RFC 3280 Section 4.1.2.7") @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 multipart 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(HandleHttpResponse.class)
public class HandleHttpRequest
extends org.apache.nifi.processor.AbstractProcessor
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate final CertificateAttributesProviderstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.AllowableValuestatic final org.apache.nifi.components.AllowableValuestatic final org.apache.nifi.components.AllowableValuestatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate final AtomicBooleanstatic final org.apache.nifi.components.PropertyDescriptorprivate static final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate final AtomicReference<Set<String>> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate static final List<org.apache.nifi.components.PropertyDescriptor> private booleanstatic final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> static final org.apache.nifi.components.PropertyDescriptorprivate final AtomicBooleanprivate org.eclipse.jetty.server.Serverstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate static final Pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate org.eclipse.jetty.server.ServercreateServer(org.apache.nifi.processor.ProcessContext context) (package private) voidprivate voidforwardFlowFile(org.apache.nifi.processor.ProcessSession session, long start, jakarta.servlet.http.HttpServletRequest request, org.apache.nifi.flowfile.FlowFile flowFile) protected intgetPort()Set<org.apache.nifi.processor.Relationship> protected intprotected List<org.apache.nifi.components.PropertyDescriptor> protected voidhandleFlowContentStreamingError(org.apache.nifi.processor.ProcessSession session, HandleHttpRequest.HttpRequestContainer container, Optional<org.apache.nifi.flowfile.FlowFile> flowFile, Exception e) (package private) voidinitializeServer(org.apache.nifi.processor.ProcessContext context) voidonPrimaryNodeChange(org.apache.nifi.annotation.notification.PrimaryNodeState state) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) private voidprivate voidprivate booleanregisterRequest(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session, HandleHttpRequest.HttpRequestContainer container, org.apache.nifi.flowfile.FlowFile flowFile) private org.apache.nifi.flowfile.FlowFilesavePartAttributes(org.apache.nifi.processor.ProcessSession session, jakarta.servlet.http.Part part, org.apache.nifi.flowfile.FlowFile flowFile, int i, int allPartsCount) private org.apache.nifi.flowfile.FlowFilesaveRequestAttributes(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session, jakarta.servlet.http.HttpServletRequest request, org.apache.nifi.flowfile.FlowFile flowFile, String contextIdentifier) private voidsendError(int statusCode, String message, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) private voidsendError(int statusCode, String message, HandleHttpRequest.HttpRequestContainer container) voidshutdown()Methods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
MIME_TYPE__MULTIPART_FORM_DATA
- See Also:
-
URL_QUERY_PARAM_DELIMITER
-
CLIENT_NONE
public static final org.apache.nifi.components.AllowableValue CLIENT_NONE -
CLIENT_WANT
public static final org.apache.nifi.components.AllowableValue CLIENT_WANT -
CLIENT_NEED
public static final org.apache.nifi.components.AllowableValue CLIENT_NEED -
PORT
public static final org.apache.nifi.components.PropertyDescriptor PORT -
HOSTNAME
public static final org.apache.nifi.components.PropertyDescriptor HOSTNAME -
HTTP_CONTEXT_MAP
public static final org.apache.nifi.components.PropertyDescriptor HTTP_CONTEXT_MAP -
SSL_CONTEXT
public static final org.apache.nifi.components.PropertyDescriptor SSL_CONTEXT -
HTTP_PROTOCOL_STRATEGY
public static final org.apache.nifi.components.PropertyDescriptor HTTP_PROTOCOL_STRATEGY -
URL_CHARACTER_SET
public static final org.apache.nifi.components.PropertyDescriptor URL_CHARACTER_SET -
PATH_REGEX
public static final org.apache.nifi.components.PropertyDescriptor PATH_REGEX -
ALLOW_GET
public static final org.apache.nifi.components.PropertyDescriptor ALLOW_GET -
ALLOW_POST
public static final org.apache.nifi.components.PropertyDescriptor ALLOW_POST -
ALLOW_PUT
public static final org.apache.nifi.components.PropertyDescriptor ALLOW_PUT -
ALLOW_DELETE
public static final org.apache.nifi.components.PropertyDescriptor ALLOW_DELETE -
ALLOW_HEAD
public static final org.apache.nifi.components.PropertyDescriptor ALLOW_HEAD -
ALLOW_OPTIONS
public static final org.apache.nifi.components.PropertyDescriptor ALLOW_OPTIONS -
MAXIMUM_THREADS
public static final org.apache.nifi.components.PropertyDescriptor MAXIMUM_THREADS -
REQUEST_HEADER_MAX_SIZE
public static final org.apache.nifi.components.PropertyDescriptor REQUEST_HEADER_MAX_SIZE -
ADDITIONAL_METHODS
public static final org.apache.nifi.components.PropertyDescriptor ADDITIONAL_METHODS -
PARAMETERS_TO_ATTRIBUTES
public static final org.apache.nifi.components.PropertyDescriptor PARAMETERS_TO_ATTRIBUTES -
CLIENT_AUTH
public static final org.apache.nifi.components.PropertyDescriptor CLIENT_AUTH -
CONTAINER_QUEUE_SIZE
public static final org.apache.nifi.components.PropertyDescriptor CONTAINER_QUEUE_SIZE -
MULTIPART_REQUEST_MAX_SIZE
public static final org.apache.nifi.components.PropertyDescriptor MULTIPART_REQUEST_MAX_SIZE -
MULTIPART_READ_BUFFER_SIZE
public static final org.apache.nifi.components.PropertyDescriptor MULTIPART_READ_BUFFER_SIZE -
PROPERTY_DESCRIPTORS
-
REL_SUCCESS
public static final org.apache.nifi.processor.Relationship REL_SUCCESS -
RELATIONSHIPS
-
server
private volatile org.eclipse.jetty.server.Server server -
ready
private volatile boolean ready -
containerQueue
-
initialized
-
runOnPrimary
-
parameterToAttributesReference
-
certificateAttributesProvider
-
-
Constructor Details
-
HandleHttpRequest
public HandleHttpRequest()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
clearInit
@OnScheduled public void clearInit() -
initializeServer
- Throws:
Exception
-
getPort
protected int getPort() -
getRequestQueueSize
protected int getRequestQueueSize() -
shutdown
- Throws:
Exception
-
drainContainerQueue
void drainContainerQueue() -
onPrimaryNodeChange
@OnPrimaryNodeStateChange public void onPrimaryNodeChange(org.apache.nifi.annotation.notification.PrimaryNodeState state) -
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
savePartAttributes
private org.apache.nifi.flowfile.FlowFile savePartAttributes(org.apache.nifi.processor.ProcessSession session, jakarta.servlet.http.Part part, org.apache.nifi.flowfile.FlowFile flowFile, int i, int allPartsCount) -
saveRequestAttributes
private org.apache.nifi.flowfile.FlowFile saveRequestAttributes(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session, jakarta.servlet.http.HttpServletRequest request, org.apache.nifi.flowfile.FlowFile flowFile, String contextIdentifier) -
forwardFlowFile
private void forwardFlowFile(org.apache.nifi.processor.ProcessSession session, long start, jakarta.servlet.http.HttpServletRequest request, org.apache.nifi.flowfile.FlowFile flowFile) -
registerRequest
private boolean registerRequest(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session, HandleHttpRequest.HttpRequestContainer container, org.apache.nifi.flowfile.FlowFile flowFile) -
handleFlowContentStreamingError
protected void handleFlowContentStreamingError(org.apache.nifi.processor.ProcessSession session, HandleHttpRequest.HttpRequestContainer container, Optional<org.apache.nifi.flowfile.FlowFile> flowFile, Exception e) -
putAttribute
-
putAttribute
-
sendError
private void sendError(int statusCode, String message, HandleHttpRequest.HttpRequestContainer container) -
sendError
private void sendError(int statusCode, String message, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) -
createServer
private org.eclipse.jetty.server.Server createServer(org.apache.nifi.processor.ProcessContext context)
-