Package spark
Class CustomErrorPages
java.lang.Object
spark.CustomErrorPages
Holds the custom error pages. A page can be defined as a String or a Route.
Note that this class is always used statically therefore custom error pages will
be shared between different instances of the Service class.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanexistsFor(int status) Verifies that a custom error page exists for the given status codegetDefaultFor(int status) Returns the default error page for a given status code.static ObjectGets the custom error page for a given status code.
-
Field Details
-
NOT_FOUND
- See Also:
-
INTERNAL_ERROR
- See Also:
-
-
Method Details
-
existsFor
public static boolean existsFor(int status) Verifies that a custom error page exists for the given status code- Parameters:
status-- Returns:
- true if error page exists
-
getFor
Gets the custom error page for a given status code. If the custom error page is a route, the output of its handle method is returned. If the custom error page is a String, it is returned as an Object.- Parameters:
status-request-response-- Returns:
- Object representing the custom error page
-
getDefaultFor
Returns the default error page for a given status code. Guaranteed to never be null.- Parameters:
status-- Returns:
- String representation of the default error page.
-