pekko/akka-docs-dev/rst/java/http/routing-dsl/directives/method-directives/extractMethod.rst
Patrik Nordwall 3081893bfd =doc #18657 Doc host and path directives
* also including docs of RequestVals.matchAndExtractHost
  and RequestVals.matchAndExtractHost
* and add Host.create factory methods
* add missing HttpRequest PATCH and OPTIONS
* change to val in matchAndExtractHost for
  fail fast exception
2015-10-08 11:50:41 +02:00

16 lines
606 B
ReStructuredText

.. _-extractMethod-java-:
extractMethod
=============
Extracts the :class:`HttpMethod` from the request context and provides it for use for other directives explicitly.
Example
-------
In the below example our route first matches all ``GET`` requests, and if an incoming request wasn't a ``GET``,
the matching continues and the extractMethod route will be applied which we can use to programatically
print what type of request it was - independent of what actual HttpMethod it was:
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/MethodDirectivesExamplesTest.java#extractMethod