NIFI-309 cleaning up HandleHttpRequest/HandleHttpResponse docs

This commit is contained in:
danbress 2015-03-18 16:37:11 -04:00
parent 5232ba33a2
commit 3b33d41cc3
4 changed files with 24 additions and 98 deletions

View File

@ -45,7 +45,10 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.SeeAlso;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.annotation.documentation.WritesAttribute;
import org.apache.nifi.annotation.documentation.WritesAttributes;
import org.apache.nifi.annotation.lifecycle.OnScheduled;
import org.apache.nifi.annotation.lifecycle.OnStopped;
import org.apache.nifi.components.AllowableValue;
@ -74,6 +77,22 @@ import com.sun.jersey.api.client.ClientResponse.Status;
@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")
@WritesAttributes({@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 {
public static final String HTTP_CONTEXT_ID = "http.context.identifier";
private static final Pattern URL_QUERY_PARAM_DELIMITER = Pattern.compile("&");

View File

@ -28,6 +28,8 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.nifi.annotation.behavior.DynamicProperty;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.ReadsAttribute;
import org.apache.nifi.annotation.documentation.SeeAlso;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.flowfile.FlowFile;
@ -42,6 +44,8 @@ import org.apache.nifi.processor.util.StandardValidators;
@Tags({"http", "https", "response", "egress", "web service"})
@CapabilityDescription("Sends an HTTP Response to the Requestor that generated a FlowFile. This Processor is designed to be used in conjunction with the HandleHttpRequest in order to create a web service.")
@DynamicProperty(name="An HTTP header name", value="An HTTP header value", description="These HTTPHeaders are set in the HTTP Response")
@ReadsAttribute(attribute="http.context.identifier", description="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.'")
@SeeAlso(value={HandleHttpRequest.class}, classNames={"org.apache.nifi.http.StandardHttpContextMap", "org.apache.nifi.ssl.StandardSSLContextService"})
public class HandleHttpResponse extends AbstractProcessor {
public static final Pattern NUMBER_PATTERN = Pattern.compile("[0-9]+");
public static final String HTTP_CONTEXT_ID = "http.context.identifier";

View File

@ -37,91 +37,7 @@
<p>
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:
supported, and SSL configuration.
</p>
<table>
<thead>
<tr>
<th>Attribute Name</th>
<th>Attribute Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>http.context.identifier</td>
<td>An identifier that allows the HandleHttpRequest and HandleHttpResponse to coordinate which FlowFile belongs
to which HTTP Request/Response.</td>
</tr>
<tr>
<td>mime.type</td>
<td>The MIME Type of the data, according to the HTTP Header "Content-Type"</td>
</tr>
<tr>
<td>http.servlet.path</td>
<td>The part of the request URL that is considered the Servlet Path</td>
</tr>
<tr>
<td>http.context.path</td>
<td>The part of the request URL that is considered to be the Context Path</td>
</tr>
<tr>
<td>http.method</td>
<td>The HTTP Method that was used for the request, such as GET or POST</td>
</tr>
<tr>
<td>http.query.string</td>
<td>The query string portion of hte Request URL</td>
</tr>
<tr>
<td>http.remote.host</td>
<td>The hostname of the requestor</td>
</tr>
<tr>
<td>http.remote.addr</td>
<td>The hostname:port combination of the requestor</td>
</tr>
<tr>
<td>http.remote.user</td>
<td>The username of the requestor</td>
</tr>
<tr>
<td>http.request.uri</td>
<td>The full Request URL</td>
</tr>
<tr>
<td>http.auth.type</td>
<td>The type of HTTP Authorization used</td>
</tr>
<tr>
<td>http.principal.name</td>
<td>The name of the authenticated user making the request</td>
</tr>
<tr>
<td>http.subject.dn</td>
<td>The Distinguished Name of the requestor. This value will not be populated unless the Processor is
configured to use an SSLContext Service</td>
</tr>
<tr>
<td>http.issuer.dn</td>
<td>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</td>
</tr>
<tr>
<td>http.headers.XXX</td>
<td>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"</td>
</tr>
</tbody>
</table>
<p>
<strong>See Also:</strong><br />
<a href="../org.apache.nifi.processors.standard.HandleHttpResponse/index.html">HandleHttpResponse</a><br />
<a href="../org.apache.nifi.http.StandardHttpContextMap/index.html">StandardHttpContextMap</a><br />
<a href="../org.apache.nifi.ssl.StandardSSLContextService/index.html">StandardSSLContextService</a><br />
</p>
</body>
</html>

View File

@ -40,18 +40,5 @@
This Processor must be configured with the same &lt;HTTP Context Map&gt; service as the corresponding HandleHttpRequest Processor.
Otherwise, all FlowFiles will be routed to the 'failure' relationship.
</p>
<p>
All FlowFiles must have an attribute named <code>http.context.identifier</code>. 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.'
</p>
<p>
<strong>See Also:</strong><br />
<a href="../org.apache.nifi.processors.standard.HandleHttpRequest/index.html">HandleHttpRequest</a><br />
<a href="../org.apache.nifi.http.StandardHttpContextMap/index.html">StandardHttpContextMap</a><br />
<a href="../org.apache.nifi.ssl.StandardSSLContextService/index.html">StandardSSLContextService</a><br />
</p>
</body>
</html>