From 4c81e6cbea5937eca5b9df9ccbdc127d8ba3983b Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Thu, 8 Oct 2015 16:26:29 +0200 Subject: [PATCH] +doc,htp #18496 cancelRejections --- .../BasicDirectivesExamplesSpec.scala | 17 ++++++++--------- .../basic-directives/cancelRejection.rst | 7 +++++-- .../basic-directives/cancelRejections.rst | 9 +++++++-- .../execution-directives/handleRejections.rst | 2 +- .../directives/route-directives/reject.rst | 2 +- .../http/routing-dsl/exception-handling.rst | 2 +- .../rst/scala/http/routing-dsl/rejections.rst | 2 +- .../rst/scala/http/routing-dsl/routes.rst | 2 +- .../rst/scala/http/routing-dsl/testkit.rst | 2 +- 9 files changed, 26 insertions(+), 19 deletions(-) diff --git a/akka-docs-dev/rst/scala/code/docs/http/scaladsl/server/directives/BasicDirectivesExamplesSpec.scala b/akka-docs-dev/rst/scala/code/docs/http/scaladsl/server/directives/BasicDirectivesExamplesSpec.scala index dc10148857..b1ee44a630 100644 --- a/akka-docs-dev/rst/scala/code/docs/http/scaladsl/server/directives/BasicDirectivesExamplesSpec.scala +++ b/akka-docs-dev/rst/scala/code/docs/http/scaladsl/server/directives/BasicDirectivesExamplesSpec.scala @@ -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 { diff --git a/akka-docs-dev/rst/scala/http/routing-dsl/directives/basic-directives/cancelRejection.rst b/akka-docs-dev/rst/scala/http/routing-dsl/directives/basic-directives/cancelRejection.rst index ed08995ab6..0ca45b1c2a 100644 --- a/akka-docs-dev/rst/scala/http/routing-dsl/directives/basic-directives/cancelRejection.rst +++ b/akka-docs-dev/rst/scala/http/routing-dsl/directives/basic-directives/cancelRejection.rst @@ -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 ------- diff --git a/akka-docs-dev/rst/scala/http/routing-dsl/directives/basic-directives/cancelRejections.rst b/akka-docs-dev/rst/scala/http/routing-dsl/directives/basic-directives/cancelRejections.rst index 5fcd915e0e..08fec18c94 100644 --- a/akka-docs-dev/rst/scala/http/routing-dsl/directives/basic-directives/cancelRejections.rst +++ b/akka-docs-dev/rst/scala/http/routing-dsl/directives/basic-directives/cancelRejections.rst @@ -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 ------- diff --git a/akka-docs-dev/rst/scala/http/routing-dsl/directives/execution-directives/handleRejections.rst b/akka-docs-dev/rst/scala/http/routing-dsl/directives/execution-directives/handleRejections.rst index 4f68926642..1105598767 100644 --- a/akka-docs-dev/rst/scala/http/routing-dsl/directives/execution-directives/handleRejections.rst +++ b/akka-docs-dev/rst/scala/http/routing-dsl/directives/execution-directives/handleRejections.rst @@ -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 ------- diff --git a/akka-docs-dev/rst/scala/http/routing-dsl/directives/route-directives/reject.rst b/akka-docs-dev/rst/scala/http/routing-dsl/directives/route-directives/reject.rst index 8023b5f194..38e5720933 100644 --- a/akka-docs-dev/rst/scala/http/routing-dsl/directives/route-directives/reject.rst +++ b/akka-docs-dev/rst/scala/http/routing-dsl/directives/route-directives/reject.rst @@ -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. diff --git a/akka-docs-dev/rst/scala/http/routing-dsl/exception-handling.rst b/akka-docs-dev/rst/scala/http/routing-dsl/exception-handling.rst index b2f5169934..c47257ebc4 100644 --- a/akka-docs-dev/rst/scala/http/routing-dsl/exception-handling.rst +++ b/akka-docs-dev/rst/scala/http/routing-dsl/exception-handling.rst @@ -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] diff --git a/akka-docs-dev/rst/scala/http/routing-dsl/rejections.rst b/akka-docs-dev/rst/scala/http/routing-dsl/rejections.rst index ab99dc24fd..6a88da53cd 100644 --- a/akka-docs-dev/rst/scala/http/routing-dsl/rejections.rst +++ b/akka-docs-dev/rst/scala/http/routing-dsl/rejections.rst @@ -1,4 +1,4 @@ -.. _Rejections: +.. _rejections-scala: Rejections ========== diff --git a/akka-docs-dev/rst/scala/http/routing-dsl/routes.rst b/akka-docs-dev/rst/scala/http/routing-dsl/routes.rst index 999efb7a19..27b9ab1bdc 100644 --- a/akka-docs-dev/rst/scala/http/routing-dsl/routes.rst +++ b/akka-docs-dev/rst/scala/http/routing-dsl/routes.rst @@ -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 diff --git a/akka-docs-dev/rst/scala/http/routing-dsl/testkit.rst b/akka-docs-dev/rst/scala/http/routing-dsl/testkit.rst index 6baa0b2331..af52e695d1 100644 --- a/akka-docs-dev/rst/scala/http/routing-dsl/testkit.rst +++ b/akka-docs-dev/rst/scala/http/routing-dsl/testkit.rst @@ -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 ` and