You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Claude Brisson <cl...@renegat.net> on 2004/05/08 02:00:51 UTC

Re: conditional #include/#parse?

About this patch, we only need to make it fully BC before it could be commited,
so instead of having a new EventHandler interface, we must inherit a new interface from it...

The EventHandler interface is empty, the new one defines the method :

    public void initialize( RuntimeServices rs ) throws Exception

What about "InitializableEventHandler" ?

The framework will just have to issue some instanceof statement to call
the initialize method only when appropriate.

CloD

----- Original Message ----- 
From: "Will Glass-Husain" <wg...@forio.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Friday, May 07, 2004 5:00 PM
Subject: Re: conditional #include/#parse?


> Hi,
> 
> There's a patch to Velocity under discussion that would allow this behavior,
> but it has not yet been committed.
> http://issues.apache.org/bugzilla/show_bug.cgi?id=28388
> 
> Among other things, the patch allows you to use a include event handler that
> can take action before the file is included.  A sample event handler is
> provided that will include an error page if the file isn't found.  If the
> error page is blank, this would do exactly what you are looking for.
> 
> Best,
> WILL
> 
> ----- Original Message ----- 
> From: "Fred Toth" <ft...@synernet.com>
> To: <ve...@jakarta.apache.org>
> Sent: Friday, May 07, 2004 4:58 AM
> Subject: conditional #include/#parse?
> 
> 
> > Hi,
> >
> > I'm wondering if there is a way to make #include and #parse
> > "silent" in the case where the file to be included/parsed does
> > not exist. Currently they always throw an exception.
> >
> > We find that to be useful behavior in certain circumstances.
> >
> > I imagine I could write a macro that references a bean that
> > checks for the file, but I'm hoping there is an easier way.
> >
> > Any suggestions?
> >
> > Many thanks,
> >
> > Fred
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re: conditional #include/#parse?

Posted by Will Glass-Husain <wg...@forio.com>.
Seems like a good idea.  I'd also be interesting in hearing from the
committers what changes they'd like to make this committable.  We can take
out the "context" argument and add the subclassed interface.  I think that
will make it backwards compatible.  Is that enough, or are there other
changes we should make?

Best, WILL

----- Original Message ----- 
From: "Claude Brisson" <cl...@renegat.net>
To: "Velocity Developers List" <ve...@jakarta.apache.org>
Sent: Friday, May 07, 2004 5:00 PM
Subject: Re: conditional #include/#parse?


> About this patch, we only need to make it fully BC before it could be
commited,
> so instead of having a new EventHandler interface, we must inherit a new
interface from it...
>
> The EventHandler interface is empty, the new one defines the method :
>
>     public void initialize( RuntimeServices rs ) throws Exception
>
> What about "InitializableEventHandler" ?
>
> The framework will just have to issue some instanceof statement to call
> the initialize method only when appropriate.
>
> CloD
>
> ----- Original Message ----- 
> From: "Will Glass-Husain" <wg...@forio.com>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Friday, May 07, 2004 5:00 PM
> Subject: Re: conditional #include/#parse?
>
>
> > Hi,
> >
> > There's a patch to Velocity under discussion that would allow this
behavior,
> > but it has not yet been committed.
> > http://issues.apache.org/bugzilla/show_bug.cgi?id=28388
> >
> > Among other things, the patch allows you to use a include event handler
that
> > can take action before the file is included.  A sample event handler is
> > provided that will include an error page if the file isn't found.  If
the
> > error page is blank, this would do exactly what you are looking for.
> >
> > Best,
> > WILL
> >
> > ----- Original Message ----- 
> > From: "Fred Toth" <ft...@synernet.com>
> > To: <ve...@jakarta.apache.org>
> > Sent: Friday, May 07, 2004 4:58 AM
> > Subject: conditional #include/#parse?
> >
> >
> > > Hi,
> > >
> > > I'm wondering if there is a way to make #include and #parse
> > > "silent" in the case where the file to be included/parsed does
> > > not exist. Currently they always throw an exception.
> > >
> > > We find that to be useful behavior in certain circumstances.
> > >
> > > I imagine I could write a macro that references a bean that
> > > checks for the file, but I'm hoping there is an easier way.
> > >
> > > Any suggestions?
> > >
> > > Many thanks,
> > >
> > > Fred
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org