Modifier and Type | Field and Description |
---|---|
protected LifecycleService |
lifecycleService |
protected ResultHandler |
resultHandler |
protected Router |
router |
Constructor and Description |
---|
NinjaDefault() |
Modifier and Type | Method and Description |
---|---|
Result |
getBadRequestResult(Context context,
java.lang.Exception exception)
Should handle cases where the client sent strange date that
led to an error.
|
Result |
getForbiddenResult(Context context)
Should handle cases where access is forbidden
Should lead to a html error 403 - forbidden
(and be used with the same mindset).
|
Result |
getInternalServerErrorResult(Context context,
java.lang.Exception exception)
Should handle cases where an exception is thrown
when handling a route that let to an internal server error.
|
Result |
getNotFoundResult(Context context)
Should handle cases where no route can be found for a given request.
|
Result |
getUnauthorizedResult(Context context)
Should handle cases where access is unauthorized
Should lead to a html error 401 - unauthorized
(and be used with the same mindset).
|
Result |
onException(Context context,
java.lang.Exception exception)
This result should be used when an error occurs.
|
void |
onFrameworkShutdown()
Invoked when the server hosting Ninja is being stopped.
|
void |
onFrameworkStart()
Invoked when the framework starts.
|
void |
onRouteRequest(Context.Impl context)
When a route is requested this method is called.
|
void |
renderErrorResultAndCatchAndLogExceptions(Result result,
Context context)
Should be used to render an error.
|
@Inject protected LifecycleService lifecycleService
@Inject protected Router router
@Inject protected ResultHandler resultHandler
public void onRouteRequest(Context.Impl context)
Ninja
onRouteRequest
in interface Ninja
public void renderErrorResultAndCatchAndLogExceptions(Result result, Context context)
Ninja
renderErrorResultAndCatchAndLogExceptions
in interface Ninja
public void onFrameworkStart()
Ninja
onFrameworkStart
in interface Ninja
public void onFrameworkShutdown()
Ninja
onFrameworkShutdown
in interface Ninja
public Result onException(Context context, java.lang.Exception exception)
Ninja
onException
in interface Ninja
context
- The context for this requestexception
- The exception to handle. Can be used to customize error message.public Result getInternalServerErrorResult(Context context, java.lang.Exception exception)
Ninja
getInternalServerErrorResult
in interface Ninja
public Result getNotFoundResult(Context context)
Ninja
getNotFoundResult
in interface Ninja
public Result getBadRequestResult(Context context, java.lang.Exception exception)
Ninja
getBadRequestResult
in interface Ninja
public Result getUnauthorizedResult(Context context)
Ninja
getUnauthorizedResult
in interface Ninja
public Result getForbiddenResult(Context context)
Ninja
getForbiddenResult
in interface Ninja
Copyright © 2014 ninjaframework. All Rights Reserved.