On Mon, Feb 19, 2001 at 02:05:58AM -0800, Russell Edens wrote:
> first off - after my first week inside the turbine source, im very
> impressed. (<-blatant pandering, but ernest)
Compliments are always welcome :-)
> im trying to generate xhtml output and im struggling.
2 answers to your problem - a short and a long one.
Short: You could look at using VelocityOnlyLayout instead of
VelocityECSLayout. That way your layout template codes the entire HTML
document rather than just the body contents. Then you can use whatever
tags you want...
Long: It should be easier to configure the tools placed in the context,
like the page tool, and you certainly shouldn't be needing to override
TurbineVelocityService in this way.
So a long time ago it was discussed that there should be a means of
reading the tools to populate the context with per-request from
TR.properties rather than having them hardcoded into
TurbineVelocityService. I'm willing to look at making this happen, but
wonder if the work should be integrated with TurbinePullService as it
would be a very similar function, albeit on a per-request rather than
global basis. (Jason - thoughts?)
So if you're willing to wait whilst that gets worked out you could
achieve what you want that way.
Sean
> 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]
--
Sean Legassick
[EMAIL PROTECTED]
Ek is 'n man: niks menslik is vreemd vir my nie
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]