|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.Restlet
org.restlet.routing.Filter
org.restlet.ext.freemarker.TemplateFilter
public class TemplateFilter
Filter response's entity and wrap it with a FreeMarker's template
representation. By default, the template representation provides a data model
based on the request and response objects. In order for the wrapping to
happen, the representations must have the Encoding.FREEMARKER
encoding set.
Concurrency note: instances of this class or its subclasses can be invoked by
several threads at the same time and therefore must be thread-safe. You
should be especially careful when storing state in member variables.
| Field Summary |
|---|
| Fields inherited from class org.restlet.routing.Filter |
|---|
CONTINUE, SKIP, STOP |
| Constructor Summary | |
|---|---|
TemplateFilter()
Constructor. |
|
TemplateFilter(Context context)
Constructor. |
|
TemplateFilter(Context context,
Restlet next)
Constructor. |
|
TemplateFilter(Context context,
Restlet next,
Object dataModel)
Constructor. |
|
TemplateFilter(Context context,
Restlet next,
Resolver<Object> dataModel)
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
afterHandle(Request request,
Response response)
|
protected Object |
createDataModel(Request request,
Response response)
Creates the FreeMarker data model for a given call. |
Configuration |
getConfiguration()
Returns the FreeMarker configuration. |
Object |
getDataModel()
Returns the template data model common to all calls. |
void |
setConfiguration(Configuration config)
Sets the FreeMarker configuration. |
void |
setDataModel(Object dataModel)
Sets the template data model common to all calls. |
| Methods inherited from class org.restlet.routing.Filter |
|---|
beforeHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop |
| Methods inherited from class org.restlet.Restlet |
|---|
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TemplateFilter()
public TemplateFilter(Context context)
context - The context.
public TemplateFilter(Context context,
Restlet next)
context - The context.next - The next Restlet.
public TemplateFilter(Context context,
Restlet next,
Object dataModel)
context - The context.next - The next Restlet.dataModel - The filter's data model.
public TemplateFilter(Context context,
Restlet next,
Resolver<Object> dataModel)
context - The context.next - The next Restlet.dataModel - The filter's data model.| Method Detail |
|---|
protected void afterHandle(Request request,
Response response)
afterHandle in class Filter
protected Object createDataModel(Request request,
Response response)
TemplateHashModel based on the result of
Resolver.createResolver(Request, Response). If the
getDataModel() method has a non null value, it will be used.
request - The handled request.response - The handled response.
public Configuration getConfiguration()
public Object getDataModel()
public void setConfiguration(Configuration config)
config - FreeMarker configuration.public void setDataModel(Object dataModel)
dataModel - The template data model common to all calls.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||