public class TemplatingObject extends HelloObject
WebEngine is adding a new type of response objects: templates. Templates are freemarker based templates that can be used to render your objects depending on the request context. WebEngine is adding some cool extensions to freemarker templates that let you build your web site in a modular fashion. These extensions are called blocks. Blocks are dynamic template parts that can be extended or replaced using derived blocks. Using blocks, you can write a base template that may define the site layout (using blocks containing empty or generic content) and then write final skins for your layout by extending the base template and redefining blocks you are interested in. See the skin directory for template examples.
Templates are stored in files under the skin directory. Templates are always resolved relative to the skin directory, even if you are using absolute paths. The following variables are accessible from a template when rendered at rendering time:
Context
- the WebContext instance
Engine
- the WebEngine instance
This
- the target Web Object.
Root
- the root WebObject.
Document
- the target Document if any otherwise null.
Session
- the Repository Session. (aka Core Session)
basePath
- the request base path (context path + servlet path)
Constructor and Description |
---|
TemplatingObject() |
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
doRedirect(String path)
Example of using redirect.
|
Object |
getIndex1()
Return the template index.ftl from 'skin' directory
|
Object |
getIndex1(String name)
Inject the variable 'name' in the template context and then return the template.
|
Object |
getIndex2()
Render the index2 template
|
doGet, doGet
disptachAdapter, isAdapter
checkGuard, dispose, getActiveAdapter, getAdapter, getContext, getFacets, getLinks, getModule, getName, getNext, getNextSegment, getPath, getPrevious, getTemplate, getTrailingPath, getType, getURL, getView, hasFacet, initialize, initialize, isInstanceOf, isRoot, newAdapter, newObject, redirect, setNext, setPrevious, setRoot, toString
public TemplatingObject()
public Object getIndex1(String name)
public javax.ws.rs.core.Response doRedirect(String path)
Copyright © 2015 Nuxeo SA. All rights reserved.