HandleHttpRequest

Description:

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.

Additional Details...

Tags:

http, https, request, listen, ingress, web service

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Listening PortListening Port80The Port to listen on for incoming HTTP requests
Supports Expression Language: true (will be evaluated using variable registry only)
HostnameHostnameThe Hostname to bind to. If not specified, will bind to all hosts
SSL Context ServiceSSL Context ServiceController Service API:
RestrictedSSLContextService
Implementation: StandardRestrictedSSLContextService
The SSL Context Service to use in order to secure the server. If specified, the server will accept only HTTPS requests; otherwise, the server will accept only HTTP requests
HTTP ProtocolsHTTP Protocolshttp/1.1
  • http/1.1 HTTP/1.1
  • h2 http/1.1 HTTP/2 and HTTP/1.1 negotiated based on requested protocols
  • h2 HTTP/2
HTTP Protocols supported for Application Layer Protocol Negotiation with TLS

This Property is only considered if the [SSL Context Service] Property has a value specified.
HTTP Context MapHTTP Context MapController Service API:
HttpContextMap
Implementation: StandardHttpContextMap
The HTTP Context Map Controller Service to use for caching the HTTP Request Information
Allowed PathsAllowed PathsA Regular Expression that specifies the valid HTTP Paths that are allowed in the incoming URL Requests. If this value is specified and the path of the HTTP Requests does not match this Regular Expression, the Processor will respond with a 404: NotFound
Default URL Character SetDefault URL Character SetUTF-8The character set to use for decoding URL parameters if the HTTP Request does not supply one
Allow GETAllow GETtrue
  • true
  • false
Allow HTTP GET Method
Allow POSTAllow POSTtrue
  • true
  • false
Allow HTTP POST Method
Allow PUTAllow PUTtrue
  • true
  • false
Allow HTTP PUT Method
Allow DELETEAllow DELETEtrue
  • true
  • false
Allow HTTP DELETE Method
Allow HEADAllow HEADfalse
  • true
  • false
Allow HTTP HEAD Method
Allow OPTIONSAllow OPTIONSfalse
  • true
  • false
Allow HTTP OPTIONS Method
Maximum ThreadsMaximum Threads200The maximum number of threads that the embedded HTTP server will use for handling requests.
Additional HTTP MethodsAdditional HTTP MethodsA comma-separated list of non-standard HTTP Methods that should be allowed
Client AuthenticationClient AuthenticationNo Authentication
  • No Authentication Processor will not authenticate clients. Anyone can communicate with this Processor anonymously
  • Want Authentication Processor will try to verify the client but if unable to verify will allow the client to communicate anonymously
  • Need Authentication Processor will reject communications from any client unless the client provides a certificate that is trusted by the TrustStorespecified in the SSL Context Service
Specifies whether or not the Processor should authenticate clients. This value is ignored if the <SSL Context Service> Property is not specified or the SSL Context provided uses only a KeyStore and not a TrustStore.
Container Queue Sizecontainer-queue-size50The size of the queue for Http Request Containers
Multipart Request Max Sizemultipart-request-max-size1 MBThe max size of the request. Only applies for requests with Content-Type: multipart/form-data, and is used to prevent denial of service type of attacks, to prevent filling up the heap or disk space
Multipart Read Buffer Sizemultipart-read-buffer-size512 KBThe threshold size, at which the contents of an incoming file would be written to disk. Only applies for requests with Content-Type: multipart/form-data. It is used to prevent denial of service type of attacks, to prevent filling up the heap or disk space.
Parameters to Attributes Listparameters-to-attributesA comma-separated list of HTTP parameters or form data to output as attributes

Relationships:

NameDescription
successAll content that is received is routed to the 'success' relationship

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
http.context.identifierAn identifier that allows the HandleHttpRequest and HandleHttpResponse to coordinate which FlowFile belongs to which HTTP Request/Response.
mime.typeThe MIME Type of the data, according to the HTTP Header "Content-Type"
http.servlet.pathThe part of the request URL that is considered the Servlet Path
http.context.pathThe part of the request URL that is considered to be the Context Path
http.methodThe HTTP Method that was used for the request, such as GET or POST
http.local.nameIP address/hostname of the server
http.server.portListening port of the server
http.query.stringThe query string portion of the Request URL
http.remote.hostThe hostname of the requestor
http.remote.addrThe hostname:port combination of the requestor
http.remote.userThe username of the requestor
http.protocolThe protocol used to communicate
http.request.uriThe full Request URL
http.auth.typeThe type of HTTP Authorization used
http.principal.nameThe name of the authenticated user making the request
http.query.param.XXXEach of query parameters in the request will be added as an attribute, prefixed with "http.query.param."
http.param.XXXForm 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.
http.subject.dnThe Distinguished Name of the requestor. This value will not be populated unless the Processor is configured to use an SSLContext Service
http.issuer.dnThe 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
http.headers.XXXEach 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"
http.headers.multipart.XXXEach 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"
http.multipart.sizeFor requests with Content-Type "multipart/form-data", the part's content size is recorded into this attribute
http.multipart.content.typeFor requests with Content-Type "multipart/form-data", the part's content type is recorded into this attribute
http.multipart.nameFor requests with Content-Type "multipart/form-data", the part's name is recorded into this attribute
http.multipart.filenameFor 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)
http.multipart.fragments.sequence.numberFor requests with Content-Type "multipart/form-data", the part's index is recorded into this attribute. The index starts with 1.
http.multipart.fragments.total.numberFor requests with Content-Type "multipart/form-data", the count of all parts is recorded into this attribute.

State management:

This component does not store state.

Restricted:

This component is not restricted.

Input requirement:

This component does not allow an incoming relationship.

System Resource Considerations:

None specified.

See Also:

HandleHttpResponse