From c53b0f9d15390ccee1c8011e6a05db82ad02f74c Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Sat, 28 Feb 2015 14:55:56 -0500 Subject: [PATCH] NIFI-221: Fixed shutdown of HandleHttpRequest and provided documentation --- .../standard/HandleHttpRequest.java | 1 + .../index.html | 255 ++++++++++++++++++ .../index.html | 112 ++++++++ 3 files changed, 368 insertions(+) create mode 100644 nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.HandleHttpRequest/index.html create mode 100644 nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.HandleHttpResponse/index.html diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java index 85d7433ec9..98b5fdd5ec 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java +++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java @@ -397,6 +397,7 @@ public class HandleHttpRequest extends AbstractProcessor { if ( server != null ) { getLogger().debug("Shutting down server"); server.stop(); + server.destroy(); server.join(); getLogger().info("Shut down {}", new Object[] {server}); } diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.HandleHttpRequest/index.html b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.HandleHttpRequest/index.html new file mode 100644 index 0000000000..d3da666686 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.HandleHttpRequest/index.html @@ -0,0 +1,255 @@ + + + + + + HandleHttpRequest + + + + + +

Description:

+

+ This processor starts an HTTP server and creates a FlowFile for each HTTP Request that it receives. The Processor leaves + the HTTP Connection open and is intended to be used in conjunction with a + HandleHttpResponse Processor. +

+ +

+ The pairing of this Processor with a HandleHttpResponse Processor + provides the ability to use NiFi to visually construct a web server that can carry out any functionality that is available + through the existing Processors. For example, one could construct a Web-based front end to an SFTP Server by constructing a + flow such as: +

+ +

+ HandleHttpRequest -> + PutSFTP -> + HandleHttpResponse +

+ +

+ The HandleHttpRequest Processor provides several Properties to configure which methods are supported, the paths that are + supported, and SSL configuration. The FlowFiles that are generated by this Processor have the following attributes added to + them, providing powerful routing capabilities and traceability of all data: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Attribute NameAttribute Description
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.query.stringThe query string portion of hte 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.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.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"
+ + +

+ Properties: +

+

+ In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. If a property has a default value, it is indicated. If a property supports the use of the NiFi Expression Language (or simply, "expression language"), that is also indicated. +

+ + +

+ Relationships: +

+ + + +

+ See Also:
+ HandleHttpResponse
+ StandardHttpContextMap
+ StandardSSLContextService
+

+ + + diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.HandleHttpResponse/index.html b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.HandleHttpResponse/index.html new file mode 100644 index 0000000000..70d76a6684 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.HandleHttpResponse/index.html @@ -0,0 +1,112 @@ + + + + + + HandleHttpResponse + + + + + +

Description:

+

+ This processor responds to an HTTP request that was received by the + HandleHttpRequest Processor. +

+ +

+ The pairing of this Processor with a HandleHttpRequest Processor + provides the ability to use NiFi to visually construct a web server that can carry out any functionality that is available + through the existing Processors. For example, one could construct a Web-based front end to an SFTP Server by constructing a + flow such as: +

+ +

+ HandleHttpRequest -> + PutSFTP -> + HandleHttpResponse +

+ +

+ This Processor must be configured with the same <HTTP Context Map> service as the corresponding HandleHttpRequest Processor. + Otherwise, all FlowFiles will be routed to the 'failure' relationship. +

+ +

+ All FlowFiles must have an attribute named http.context.identifier. The value of this attribute is used to lookup + the HTTP Response so that the proper message can be sent back to the requestor. If this attribute is missing, the FlowFile + will be routed to 'failure.' +

+ + +

+ Properties: +

+

+ In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. If a property has a default value, it is indicated. If a property supports the use of the NiFi Expression Language (or simply, "expression language"), that is also indicated. +

+ + +

+ Relationships: +

+ + +

+ See Also:
+ HandleHttpRequest
+ StandardHttpContextMap
+ StandardSSLContextService
+

+ + +