Interface BackgroundSupport.BackgroundAction
- Enclosing class:
- BackgroundSupport
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface protected static interface BackgroundSupport.BackgroundAction
An action that produces a response, usually handled asynchronously. Care
should be taken as the action may be run on a thread other than the
thread that creates it.
- Author:
- Donal Fellows
-
Method Details
-
respond
Does the action that produces the result.- Returns:
- The result of the action. A
null
is mapped as a generic 404 with no special message. Custom messages should be supported by throwing a suitableRequestFailedException
. If the result is not aResponse
and not aThrowable
, it will be returned as the entity that populates a200 OK
(and so must be convertible to JSON). - Throws:
RequestFailedException
- If anything goes wrong. This is the expected exception type; it is not logged.Exception
- If anything goes wrong. This is reported as an unexpected exception and logged.
-