|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.apache.turbine.services.BaseInitable
|
+--org.apache.turbine.services.BaseService
|
+--org.apache.turbine.services.TurbineBaseService
|
+--org.apache.turbine.services.freemarker.TurbineFreeMarkerService
This is a Service that can process FreeMarker templates from within
a Turbine Screen. Here's an example of how you might use it from a
screen:
FreeMarkerService fm = (FreeMarkerService)TurbineServices.getInstance()
.getService(FreeMarkerService.SERVICE_NAME);
SimpleHash context = fm.getContext(data);
context.put("message", "Hello from Turbine!");
String results = fm.handleRequest(context,"helloWorld.wm");
data.getPage().getBody().addElement(results);
| Field Summary |
| Fields inherited from class org.apache.turbine.services.BaseService |
configuration, name, properties, serviceBroker |
| Fields inherited from class org.apache.turbine.services.BaseInitable |
initableBroker, isInitialized |
| Fields inherited from interface org.apache.turbine.services.freemarker.FreeMarkerService |
CONTEXT, SERVICE_NAME |
| Constructor Summary | |
TurbineFreeMarkerService()
Deprecated. Constructor. |
|
| Method Summary | |
void |
cacheUnavailable(freemarker.template.CacheEvent e)
Deprecated. Method called by templateCache. |
void |
elementRemoved(freemarker.template.CacheEvent e)
Deprecated. Method called by templateCache. |
void |
elementUpdated(freemarker.template.CacheEvent e)
Deprecated. Method called by templateCache. |
void |
elementUpdateFailed(freemarker.template.CacheEvent e)
Deprecated. Method called by templateCache. |
java.lang.String |
getBasePath()
Deprecated. Gets the base path for the FreeMarker templates. |
freemarker.template.Template |
getCachedTemplate(java.lang.String templateName)
Deprecated. Return a FreeMarker template from the cache. |
freemarker.template.SimpleHash |
getContext()
Deprecated. Create a context needed by the FreeMarker template. |
freemarker.template.SimpleHash |
getContext(RunData data)
Deprecated. Create a context from the RunData object. |
freemarker.template.SimpleHash |
getContext(javax.servlet.ServletRequest req)
Deprecated. Create a context needed by the FreeMarker template. |
freemarker.template.Template |
getNonCachedTemplate(java.lang.String templateName)
Deprecated. Return a FreeMarker template. |
java.lang.String |
handleRequest(freemarker.template.SimpleHash context,
java.lang.String filename,
boolean cache)
Deprecated. Process the request and fill in the template with the values you set in the WebContext. |
void |
init()
Deprecated. Called during Turbine.init() |
| Methods inherited from class org.apache.turbine.services.TurbineBaseService |
init, init, init, shutdown |
| Methods inherited from class org.apache.turbine.services.BaseService |
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker |
| Methods inherited from class org.apache.turbine.services.BaseInitable |
getInit, getInitableBroker, setInit, setInitableBroker |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.turbine.services.Service |
getConfiguration, getName, getProperties, setName, setServiceBroker |
| Methods inherited from interface org.apache.turbine.services.Initable |
getInit, init, setInitableBroker, shutdown |
| Constructor Detail |
public TurbineFreeMarkerService()
| Method Detail |
public void init()
throws InitializationException
init in interface Initableinit in class TurbineBaseServiceInitializationExceptionpublic freemarker.template.SimpleHash getContext()
getContext in interface FreeMarkerServicepublic freemarker.template.SimpleHash getContext(javax.servlet.ServletRequest req)
getContext in interface FreeMarkerServicereq - A ServletRequest.
public freemarker.template.SimpleHash getContext(RunData data)
getContext in interface FreeMarkerServicedata - The Turbine RunData object.
public java.lang.String handleRequest(freemarker.template.SimpleHash context,
java.lang.String filename,
boolean cache)
throws TurbineException
handleRequest in interface FreeMarkerServicecontext - A SimpleHash with the context.cache - True if the parsed template should be cached.filename - A String with the filename of the template.
TurbineException - Any exception trown while processing will be
wrapped into a TurbineException and rethrown.public java.lang.String getBasePath()
getBasePath in interface FreeMarkerServicepublic freemarker.template.Template getCachedTemplate(java.lang.String templateName)
getCachedTemplate in interface FreeMarkerServicetemplateName - A String with the name of the template.
public freemarker.template.Template getNonCachedTemplate(java.lang.String templateName)
throws java.io.IOException
getNonCachedTemplate in interface FreeMarkerServicetemplateName - A String with the name of the template.
IOException, - if there was an I/O problem.
java.io.IOExceptionpublic void cacheUnavailable(freemarker.template.CacheEvent e)
cacheUnavailable in interface freemarker.template.CacheListenere - A CacheEvent.public void elementUpdated(freemarker.template.CacheEvent e)
elementUpdated in interface freemarker.template.CacheListenere - A CacheEvent.public void elementUpdateFailed(freemarker.template.CacheEvent e)
elementUpdateFailed in interface freemarker.template.CacheListenere - A CacheEvent.public void elementRemoved(freemarker.template.CacheEvent e)
elementRemoved in interface freemarker.template.CacheListenere - A CacheEvent.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||