=doc,htp #18657 document FormField vals

This commit is contained in:
Konrad Malawski 2015-10-07 15:55:04 +02:00
parent 27eba7ffa3
commit a17604500f
5 changed files with 112 additions and 6 deletions

View file

@ -0,0 +1,33 @@
.. _form-field-request-vals-java:
Request Values: FormFields
==========================
A collection of pre-defined :ref:`request-vals-java` that can be used to extract header values from incoming requests.
Description
-----------
Header request values allow extracting ``HttpHeader`` values or concrete instances from HTTP requests.
The ``RequestVal`` builder is made up of 2 steps, initially you need to pick which Header to extract (``byName`` or
``byClass``) and then you need to pick if the header is optionally available or required (i.e. the route should not
match if the header is not present in the request). This is done using one of the below depicted methods::
RequestVal<T> instance()
RequestVal<<Option<T>> optionalInstance()
RequestVal<String> value()
RequestVal<Option<String>> optionalValue()
Examples
--------
``Headers.byClass(Class[HttpHeader])``
.. includecode:: ../../../code/docs/http/javadsl/server/HeaderRequestValsExampleTest.java
:include: by-class
``Headers.byName(String)``
.. includecode:: ../../../code/docs/http/javadsl/server/HeaderRequestValsExampleTest.java
:include: by-name

View file

@ -27,7 +27,7 @@ service.
These request values are defined in the following objects:
akka.http.javadsl.server.values.FormFieldsRequestVals
:ref:`akka.http.javadsl.server.values.FormFields <form-field-request-vals-java>`
Contains request values for basic data like URI components, request method, peer address, or the entity data.
akka.http.javadsl.server.values.FormFieldsCookies
Contains request values representing cookies.