You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jason Tesser <ja...@gmail.com> on 2009/08/08 15:01:33 UTC

From Viewtool get the VTL being parsed

>From a viewtool I need to get the name of the file being parsed. Is that
possible?

Thanks,
Jason Tesser
dotCMS Lead Development Manager
1-305-858-1422

Re: From Viewtool get the VTL being parsed

Posted by Nathan Bubna <nb...@gmail.com>.
nice!  i wish i'd thought of that.

On Sat, Aug 8, 2009 at 8:58 AM, Jason Tesser<ja...@gmail.com> wrote:
> I ended up doing this which works
>
> ica = new InternalContextAdapterImpl(ctx);
> String fieldResourceName = ica.getCurrentTemplateName();
>
> Thanks,
> Jason Tesser
> dotCMS Lead Development Manager
> 1-305-858-1422
>
>
> On Sat, Aug 8, 2009 at 11:27 AM, Nathan Bubna <nb...@gmail.com> wrote:
>
>> a tool can really only get access to whatever is in the context or
>> what is manually given to it.  since the HttpServletRequest is
>> available automatically, they can get the request path and derive the
>> file from that.   just know that even that isn't perfect; if the
>> request path points to foo.vm and foo.vm does #parse('bar.vm') which
>> is the one with your tool being used in it, there's no way for the
>> tool to know that without being told, since #parse doesn't really
>> inject info about itself into the context.
>>
>> On Sat, Aug 8, 2009 at 6:01 AM, Jason Tesser<ja...@gmail.com> wrote:
>> > From a viewtool I need to get the name of the file being parsed. Is that
>> > possible?
>> >
>> > Thanks,
>> > Jason Tesser
>> > dotCMS Lead Development Manager
>> > 1-305-858-1422
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>

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


Re: From Viewtool get the VTL being parsed

Posted by Jason Tesser <ja...@gmail.com>.
I ended up doing this which works

ica = new InternalContextAdapterImpl(ctx);
String fieldResourceName = ica.getCurrentTemplateName();

Thanks,
Jason Tesser
dotCMS Lead Development Manager
1-305-858-1422


On Sat, Aug 8, 2009 at 11:27 AM, Nathan Bubna <nb...@gmail.com> wrote:

> a tool can really only get access to whatever is in the context or
> what is manually given to it.  since the HttpServletRequest is
> available automatically, they can get the request path and derive the
> file from that.   just know that even that isn't perfect; if the
> request path points to foo.vm and foo.vm does #parse('bar.vm') which
> is the one with your tool being used in it, there's no way for the
> tool to know that without being told, since #parse doesn't really
> inject info about itself into the context.
>
> On Sat, Aug 8, 2009 at 6:01 AM, Jason Tesser<ja...@gmail.com> wrote:
> > From a viewtool I need to get the name of the file being parsed. Is that
> > possible?
> >
> > Thanks,
> > Jason Tesser
> > dotCMS Lead Development Manager
> > 1-305-858-1422
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

Re: From Viewtool get the VTL being parsed

Posted by Nathan Bubna <nb...@gmail.com>.
a tool can really only get access to whatever is in the context or
what is manually given to it.  since the HttpServletRequest is
available automatically, they can get the request path and derive the
file from that.   just know that even that isn't perfect; if the
request path points to foo.vm and foo.vm does #parse('bar.vm') which
is the one with your tool being used in it, there's no way for the
tool to know that without being told, since #parse doesn't really
inject info about itself into the context.

On Sat, Aug 8, 2009 at 6:01 AM, Jason Tesser<ja...@gmail.com> wrote:
> From a viewtool I need to get the name of the file being parsed. Is that
> possible?
>
> Thanks,
> Jason Tesser
> dotCMS Lead Development Manager
> 1-305-858-1422
>

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