Skip to content

Commit 76d0487

Browse files
committed
Improve Templates section
1 parent 8aab35d commit 76d0487

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

_posts/2015-03-17-templates.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,31 @@ public class CrudApplication extends Application {
140140
}
141141
```
142142

143+
In Pippo, each builtin template engine comes with special templates for routing problems and exceptions.
144+
See below the special templates that come by default with `pippo-freemarker`
145+
```bash
146+
$ tree src/main/resources/
147+
src/main/resources/
148+
└── templates
149+
└── pippo
150+
├── 000base.ftl
151+
├── 400badRequest.ftl
152+
├── 401unauthorized.ftl
153+
├── 402paymentRequired.ftl
154+
├── 403forbidden.ftl
155+
├── 404notFound.ftl
156+
├── 405methodNotAllowed.ftl
157+
├── 409conflict.ftl
158+
├── 410gone.ftl
159+
├── 500internalError.ftl
160+
├── 501notImplemented.ftl
161+
├── 502overloaded.ftl
162+
└── 503serviceUnavailable.ftl
163+
```
164+
You may override these templates within your own application (put a file with the same name, to same location, in your application classpath).
165+
If you feel that is too much to have a template for each error code, you can return the same template for all error code. In this situation you must override
166+
`DefaultErrorHandler#getTemplateForStatusCode(int statusCode)`.
167+
143168
By default, all template engines disable the cache in `dev` and `test` mode (to speed the development - change template and refresh the page in browser)
144169
and enable the cache in `prod` mode (to improve the performance).
145170

0 commit comments

Comments
 (0)