+doc,htp #18496 cancelRejections

This commit is contained in:
Konrad Malawski 2015-10-08 16:26:29 +02:00
parent ce07ae75b7
commit 4c81e6cbea
9 changed files with 26 additions and 19 deletions

View file

@ -8,18 +8,17 @@ package directives
import java.io.File
import akka.event.Logging
import akka.http.scaladsl.model.HttpEntity.Chunked
import akka.stream.ActorMaterializer
import akka.stream.io.SynchronousFileSource
import akka.stream.scaladsl.{ Sink, Source }
import scala.concurrent.Future
import scala.util.control.NonFatal
import akka.util.ByteString
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers.RawHeader
import akka.http.scaladsl.server.RouteResult.Rejected
import akka.http.scaladsl.server._
import akka.http.scaladsl.model._
import akka.stream.ActorMaterializer
import akka.stream.io.SynchronousFileSource
import akka.stream.scaladsl.{ Sink, Source }
import akka.util.ByteString
import scala.concurrent.Future
import scala.util.control.NonFatal
class BasicDirectivesExamplesSpec extends RoutingSpec {
"0extract" in {

View file

@ -3,7 +3,8 @@
cancelRejection
===============
...
Adds a ``TransformationRejection`` cancelling all rejections equal to the
given one to the rejections potentially coming back from the inner route.
Signature
---------
@ -14,7 +15,9 @@ Signature
Description
-----------
...
Cancels a rejection which may potentially come back from the inner route.
Read :ref:`rejections-scala` to learn more about rejections.
Example
-------

View file

@ -3,7 +3,8 @@
cancelRejections
================
...
Adds a ``TransformationRejection`` cancelling all matching rejections
to the rejections potentially coming back from the inner route
Signature
---------
@ -14,7 +15,11 @@ Signature
Description
-----------
...
Cancels all rejections created by the inner route for which the condition argument function returns ``true``.
See also :ref:`-cancelRejection-`, for canceling a specific rejection.
Read :ref:`rejections-scala` to learn more about rejections.
Example
-------

View file

@ -17,7 +17,7 @@ Description
Using this directive is an alternative to using a global implicitly defined ``RejectionHandler`` that
applies to the complete route.
See :ref:`Rejections` for general information about options for handling rejections.
See :ref:`rejections-scala` for general information about options for handling rejections.
Example
-------

View file

@ -17,7 +17,7 @@ Description
-----------
``reject`` uses the given rejection instances (which might be the empty ``Seq``) to construct a ``Route`` which simply
calls ``requestContext.reject``. See the chapter on :ref:`Rejections` for more information on what this means.
calls ``requestContext.reject``. See the chapter on :ref:`rejections-scala` for more information on what this means.
After the request has been rejected at the respective point it will continue to flow through the routing structure in
the search for a route that is able to complete it.

View file

@ -6,7 +6,7 @@ Exception Handling
Exceptions thrown during route execution bubble up through the route structure to the next enclosing
:ref:`-handleExceptions-` directive or the top of your route structure.
Similarly to the way that :ref:`Rejections` are handled the :ref:`-handleExceptions-` directive delegates the actual job
Similarly to the way that :ref:`rejections-scala` are handled the :ref:`-handleExceptions-` directive delegates the actual job
of converting an exception to its argument, an ExceptionHandler__, which is defined like this::
trait ExceptionHandler extends PartialFunction[Throwable, Route]

View file

@ -1,4 +1,4 @@
.. _Rejections:
.. _rejections-scala:
Rejections
==========

View file

@ -13,7 +13,7 @@ It's a simple alias for a function turning a ``RequestContext`` into a ``Future[
Generally when a route receives a request (or rather a ``RequestContext`` for it) it can do one of these things:
- Complete the request by returning the value of ``requestContext.complete(...)``
- Reject the request by returning the value of ``requestContext.reject(...)`` (see :ref:`Rejections`)
- Reject the request by returning the value of ``requestContext.reject(...)`` (see :ref:`rejections-scala`)
- Fail the request by returning the value of ``requestContext.fail(...)`` or by just throwing an exception (see :ref:`exception-handling-scala`)
- Do any kind of asynchronous processing and instantly return a ``Future[RouteResult]`` to be eventually completed later

View file

@ -88,7 +88,7 @@ Sealing Routes
The section above describes how to test a "regular" branch of your route structure, which reacts to incoming requests
with HTTP response parts or rejections. Sometimes, however, you will want to verify that your service also translates
:ref:`Rejections` to HTTP responses in the way you expect.
:ref:`rejections-scala` to HTTP responses in the way you expect.
You do this by wrapping your route with the ``akka.http.scaladsl.server.Route.seal``.
The ``seal`` wrapper applies the logic of the in-scope :ref:`ExceptionHandler <exception-handling-scala>` and