Package org.takes.facets.fallback
Fallback.
Exception handing in the framework is very simple and very
intuitive. All you need to do is to wrap your "take" into
TkFallback
decorator and create
a fallback that dispatches exceptions, for example:
Take take = new TkFallback( original_take, new FbChain( new FbOnStatus(404, new TkHTML("page not found")), new FbOnStatus(405, new TkHTML("this method not allowed")), new FbFixed(new RsText("oops, some big problem")) ) );
If and when exception occurs, TkFallback
will catch it and create an instance of
RqFallback
. This object will
be sent to the encapsulated instance of
Fallback
. It is recommended to use
FbChain
to dispatch a request
through a series of fallbacks. The first of them who will return
some response will stop the chain.
- Since:
- 0.1
-
Interface Summary Interface Description Fallback Fallback to dispatch an exceptional situation.RqFallback Request with an error inside. -
Class Summary Class Description FbChain Fallback chain.FbEmpty Empty fallback.FbFixed Fallback with a fixed response.FbLog4j Fallback that logs all problems through Log4J.FbSlf4j Fallback that logs all problems through SFL4J.FbStatus Fallback on status code that equals to the provided value.FbWrap Fallback wrap.RqFallback.Fake Fake implementation, for unit tests mostly.TkFallback Fallback.