1
|
##
|
2
|
## Velocity Template for error end-state
|
3
|
##
|
4
|
## Velocity context will contain the following properties
|
5
|
## flowRequestContext - the Spring Web Flow RequestContext
|
6
|
## profileRequestContext - root of context tree
|
7
|
## encoder - HTMLEncoder class
|
8
|
## request - HttpServletRequest
|
9
|
## response - HttpServletResponse
|
10
|
## environment - Spring Environment object for property resolution
|
11
|
## custom - arbitrary object injected by deployer
|
12
|
##
|
13
|
#set ($title = $springMacroRequestContext.getMessage("idp.title", "Web Login Service"))
|
14
|
#set ($defaultTitleSuffix = $springMacroRequestContext.getMessage("idp.title.suffix", "Error"))
|
15
|
##
|
16
|
#if ($flowRequestContext)
|
17
|
## This handles flow events, the most common case.
|
18
|
#set ($eventId = $flowRequestContext.getCurrentEvent().getId())
|
19
|
#set ($eventKey = $springMacroRequestContext.getMessage("$eventId", "error"))
|
20
|
#set ($titleSuffix = $springMacroRequestContext.getMessage("${eventKey}.title", "$defaultTitleSuffix"))
|
21
|
#set ($message = $springMacroRequestContext.getMessage("${eventKey}.message", "$defaultTitleSuffix: $eventId"))
|
22
|
#if ($eventId == "AccessDenied" or $eventId == "ContextCheckDenied")
|
23
|
$response.setStatus(403)
|
24
|
#elseif ($eventId == "AttributeReleaseRejected" || $eventId == "TermsRejected")
|
25
|
$response.setStatus(200)
|
26
|
#elseif ($eventKey == "unexpected" || $eventKey == "runtime-error" || $eventKey == "error")
|
27
|
$response.setStatus(500)
|
28
|
#else
|
29
|
$response.setStatus(400)
|
30
|
#end
|
31
|
#elseif ($exception)
|
32
|
## This handles exceptions that reach the Spring-MVC exception handler.
|
33
|
#set ($eventId = $exception.getClass().getSimpleName())
|
34
|
#set ($eventKey = $springMacroRequestContext.getMessage("$eventId", "error"))
|
35
|
#set ($titleSuffix = $springMacroRequestContext.getMessage("${eventKey}.title", "$defaultTitleSuffix"))
|
36
|
#set ($message = $springMacroRequestContext.getMessage("${eventKey}.message", "$defaultTitleSuffix: $eventId"))
|
37
|
#else
|
38
|
## This is a catch-all that theoretically shouldn't happen?
|
39
|
#set ($titleSuffix = $defaultTitleSuffix)
|
40
|
#set ($message = $springMacroRequestContext.getMessage("idp.message", "An unidentified error occurred."))
|
41
|
#end
|
42
|
##
|
43
|
<!DOCTYPE html>
|
44
|
<html>
|
45
|
<head>
|
46
|
<meta charset="utf-8">
|
47
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
48
|
<title>$title - $titleSuffix</title>
|
49
|
<link rel="stylesheet" type="text/css" href="$request.getContextPath()/css/main.css">
|
50
|
</head>
|
51
|
|
52
|
<body>
|
53
|
<div class="wrapper">
|
54
|
<div class="container">
|
55
|
<header>
|
56
|
<img src="$request.getContextPath()#springMessage("idp.logo")" alt="#springMessageText("idp.logo.alt-text", "logo")">
|
57
|
<h3>$title - $titleSuffix</h3>
|
58
|
</header>
|
59
|
|
60
|
<div class="content">
|
61
|
#evaluate($message)
|
62
|
</div>
|
63
|
</div>
|
64
|
|
65
|
<footer>
|
66
|
<div class="container container-footer">
|
67
|
<p class="footer-text">#springMessageText("idp.footer", "Insert your footer text here.")</p>
|
68
|
</div>
|
69
|
</footer>
|
70
|
|
71
|
</div>
|
72
|
</body>
|
73
|
</html>
|