pekko/akka-docs/rst/java/http/routing-dsl/directives/path-directives/rawPathPrefix.rst
Fabian Gutierrez ee77273fac akka http javadsl - add path directive tests (#20813)
* akka http javadsl - add debugging directive test

* fixes line breaks

* add additional examples on PathDirectives

* link documentation to test examples

* include example on redirectToNoTrailingSlashIfPresent and redirectToTrailingSlashIfMissing

* include example on redirectToNoTrailingSlashIfPresent and redirectToTrailingSlashIfMissing
2016-06-22 01:13:27 +02:00

24 lines
1.2 KiB
ReStructuredText

.. _-rawPathPrefix-java-:
rawPathPrefix
=============
Description
-----------
Matches and consumes a prefix of the unmatched path of the ``RequestContext`` against the given ``PathMatcher``,
potentially extracts one or more values (depending on the type of the argument).
This directive filters incoming requests based on the part of their URI that hasn't been matched yet by other
potentially existing ``rawPathPrefix`` or :ref:`-pathPrefix-java-` directives on higher levels of the routing structure.
Its one parameter is usually an expression evaluating to a ``PathMatcher`` instance (see also: :ref:`pathmatcher-dsl`).
As opposed to its :ref:`-pathPrefix-java-` counterpart ``rawPathPrefix`` does *not* automatically add a leading slash to its
``PathMatcher`` argument. Rather its ``PathMatcher`` argument is applied to the unmatched path as is.
Depending on the type of its ``PathMatcher`` argument the ``rawPathPrefix`` directive extracts zero or more values from
the URI. If the match fails the request is rejected with an :ref:`empty rejection set <empty rejections>`.
Example
-------
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/PathDirectivesExamplesTest.java#raw-path-prefix-test