first off - after my first week inside the turbine source, im very
impressed. (<-blatant pandering, but ernest)
im trying to generate xhtml output and im struggling.
the problem i am having is in my velocity templates im making a call to
$page.setStyleSheet($content.getURI("css/default.css")) which call into:
turbine.util.template.TemplatePageAttributes.setStyleSheet(String url)
{
data.getPage().getHead().addElement(new Link()
.setRel("stylesheet").setType("text/css").setHref(url));
return this;
}
i want it to ommit new ecs.xhtml.link() instead. so i created a derived
class that uses the ecs.xhtml classes like so:
public class JVTemplatePageAttributes extends TemplatePageAttributes
{
private RunData data = null;
public JVTemplatePageAttributes(RunData data)
{
super(data);
this.data = data;
}
public TemplatePageAttributes setStyleSheet(String url)
{
data.getPage().getHead().addElement(new link()
.setRel("stylesheet").setType("text/css").setHref(url));
return this;
}
}
so i dug and found that page is initialized in the
turbine.services.velocity.TurbineVelocityService class. i attempted to
override this class by defining my own class the inherits from it and then
reference that in the TurbineResources.properties
file. (i.e.,
services.TurbineVelocityService.classname=org.jvoom.turbine.services.velocit
y.JVTurbineVelocityService) the class looks like:
public class JVTurbineVelocityService extends TurbineVelocityService
implements VelocityService
{
public Context getContext(RunData data)
{
Context context = super.getContext(data);
// replace the page object with our own that handles xhtml
context.put ( "page", new JVTemplatePageAttributes(data) );
return context;
}
}
this all sounds great. (if there is a better way to do this, please let me
know!)
the problem occurs when initializing the service i get the following:
Horrible Exception: java.lang.ClassCastException:
org.jvoom.turbine.services.velocity.JVTurbineVelocityService
at
org.apache.turbine.services.BaseInitableBroker.getInitableInstance(BaseInita
bleBroker.java:258)
rethrown as org.apache.turbine.services.InstantiationException: Class
org.jvoom.turbine.services.velocity.JVTurbineVelocityService doesn't
implement Initable.
at
org.apache.turbine.services.BaseInitableBroker.getInitableInstance(BaseInita
bleBroker.java:293)
at
org.apache.turbine.services.BaseServiceBroker.getServiceInstance(BaseService
Broker.java:316)
rethrown as org.apache.turbine.services.InstantiationException: Failed
to instantiate service TurbineVelocityService.
yet when i add a the following test code into JVTurbineVelocityService and
run it it runs with no class cast exceptions:
public static void main(String args[])
{
try
{
Initable initable =
(Initable)Class.forName("org.jvoom.turbine.services.velocity.JVTurbineVeloci
tyService").newInstance();
}catch(Exception e)
{
e.printStackTrace();
}
}
im at a loss. (btw - yes i checked my classpath <g>)
any help would be greatly appreciated!!
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]