You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Paulo Silveira <pa...@paulo.com.br> on 2004/04/22 08:23:46 UTC
ToolboxManager.getToolboxContext(Object) not helping
Hi!
I am having truble trying to use the utility classes for the toolbox use.
I dont wanna use VelocityViewServlet, neither Chained/ViewContext, but
ServletToolboxManager has a cast in getToolboxContext(Object param),
casting param to ViewContext.
I do sugest an extra method, getToolboxContext(ServletContext,
ServletRequest,...), giving the users an option.
And there are _many_ other places where this kind of restrictions apply.
Extra methods (not overriden ones) could help.
Thanks for the great job. By the way, what is the meaning for a
getVelocityContext() in ViewContext?
Paulo
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
Re: ToolboxManager.getToolboxContext(Object) not helping - continued
Posted by Claude Brisson <cl...@renegat.net>.
> yeah, "context" is a pretty generic term. easy to get confused.
it depends upon the context
...hum...
CloD
----- Original Message -----
From: "Nathan Bubna" <na...@esha.com>
To: "Velocity Developers List" <ve...@jakarta.apache.org>
Sent: Friday, April 23, 2004 6:49 AM
Subject: Re: ToolboxManager.getToolboxContext(Object) not helping - continued
> Paulo Silveira said:
> > I took a better look at the code, and there is no way to create a new
> > method since the Object initdata is sent to the ToolInfos for tool
> > instatiations.
>
> yeah, i thought so. i was just wondering if you might have seen something i
> didn't.
>
> > So now I am implementing ViewContext. I dindt see that ViewContext does
> > not extends Context. The name got me confused.
>
> yeah, "context" is a pretty generic term. easy to get confused.
>
> > Now I can do what I need! Something that really could come in handy is a
> > ServletToolboxManaget.getInstance(InputStream).
> ...
>
> something along those lines might be easier. i'm always happy to look over
> enhancement patches. :)
>
> Nathan Bubna
> nathan@esha.com
>
>
> ---------------------------------------------------------------------
> 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
Re: ToolboxManager.getToolboxContext(Object) not helping - continued
Posted by Paulo Silveira <pa...@paulo.com.br>.
Nathan Bubna wrote:
>>Now I can do what I need! Something that really could come in handy is a
>>ServletToolboxManaget.getInstance(InputStream).
>
> ...
>
> something along those lines might be easier. i'm always happy to look over
> enhancement patches. :)
Reading the code better, there is no way to do it, since the private
constructor needs a ServletContext, and the manager really needs this
context.
>
> Nathan Bubna
> nathan@esha.com
>
>
> ---------------------------------------------------------------------
> 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
Re: ToolboxManager.getToolboxContext(Object) not helping - continued
Posted by Nathan Bubna <na...@esha.com>.
Paulo Silveira said:
> I took a better look at the code, and there is no way to create a new
> method since the Object initdata is sent to the ToolInfos for tool
> instatiations.
yeah, i thought so. i was just wondering if you might have seen something i
didn't.
> So now I am implementing ViewContext. I dindt see that ViewContext does
> not extends Context. The name got me confused.
yeah, "context" is a pretty generic term. easy to get confused.
> Now I can do what I need! Something that really could come in handy is a
> ServletToolboxManaget.getInstance(InputStream).
...
something along those lines might be easier. i'm always happy to look over
enhancement patches. :)
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
Re: ToolboxManager.getToolboxContext(Object) not helping - continued
Posted by Paulo Silveira <pa...@paulo.com.br>.
Hello
I took a better look at the code, and there is no way to create a new
method since the Object initdata is sent to the ToolInfos for tool
instatiations.
So now I am implementing ViewContext. I dindt see that ViewContext does
not extends Context. The name got me confused.
Now I can do what I need! Something that really could come in handy is a
ServletToolboxManaget.getInstance(InputStream).
thanks for your help.
Paulo
Paulo Silveira wrote:
> Helo Nathan!
>
>> hmm. most of the standard tools we provide expect to receive a
>> ViewContext
>> during initialization. if we added the method you suggest, i'm not
>> sure how
>> it would work. can you provide a patch for this? it would make it
>> easier to
>> assess.
>
> I will send a patch later night.
>
>>
>> also, why don't you want to use the ViewContext interface? i'm curious.
>
> Imagine the following situation: I will not use a ChainContext because I
> dont wanna extend it. Then I have a MyViewContext, which will first see
> inside a Map of toolboxes, and then look in the local Map for the values.
>
> The sequence would be:
> - Create MyViewContext
> - Get a toolbox from the ServletToolboxManager, passing this as
> argument, suposing we will call it from the MyviewContext
> - use a MyViewContext.setToolbox(Map) or
> MyViewContext.setToolbox(ToolboxContext)
> - and then our get will do the job, taking a look first at the toolbox.
>
> It simply seems too much. It could be done as this:
> - Create a toolbox through a new method
> ServletToolboxManager.getToolboxContext(ServletRequest, ServletContext,...)
> - Create a MyContext with a toolbox as one of the parameters, and there
> will be no need to implement ViewContext.
>
> what do you think?
>
>> Nathan Bubna
>> nathan@esha.com
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
Re: ToolboxManager.getToolboxContext(Object) not helping
Posted by Paulo Silveira <pa...@paulo.com.br>.
Helo Nathan!
> hmm. most of the standard tools we provide expect to receive a ViewContext
> during initialization. if we added the method you suggest, i'm not sure how
> it would work. can you provide a patch for this? it would make it easier to
> assess.
I will send a patch later night.
>
> also, why don't you want to use the ViewContext interface? i'm curious.
Imagine the following situation: I will not use a ChainContext because I
dont wanna extend it. Then I have a MyViewContext, which will first see
inside a Map of toolboxes, and then look in the local Map for the values.
The sequence would be:
- Create MyViewContext
- Get a toolbox from the ServletToolboxManager, passing this as
argument, suposing we will call it from the MyviewContext
- use a MyViewContext.setToolbox(Map) or
MyViewContext.setToolbox(ToolboxContext)
- and then our get will do the job, taking a look first at the toolbox.
It simply seems too much. It could be done as this:
- Create a toolbox through a new method
ServletToolboxManager.getToolboxContext(ServletRequest, ServletContext,...)
- Create a MyContext with a toolbox as one of the parameters, and there
will be no need to implement ViewContext.
what do you think?
> Nathan Bubna
> nathan@esha.com
>
>
> ---------------------------------------------------------------------
> 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
Re: ToolboxManager.getToolboxContext(Object) not helping
Posted by Nathan Bubna <na...@esha.com>.
Paulo Silveira said:
> I am having truble trying to use the utility classes for the toolbox use.
>
> I dont wanna use VelocityViewServlet, neither Chained/ViewContext, but
> ServletToolboxManager has a cast in getToolboxContext(Object param),
> casting param to ViewContext.
>
> I do sugest an extra method, getToolboxContext(ServletContext,
> ServletRequest,...), giving the users an option.
hmm. most of the standard tools we provide expect to receive a ViewContext
during initialization. if we added the method you suggest, i'm not sure how
it would work. can you provide a patch for this? it would make it easier to
assess.
also, why don't you want to use the ViewContext interface? i'm curious.
> And there are _many_ other places where this kind of restrictions apply.
> Extra methods (not overriden ones) could help.
i'd be happy to consider any enhancement requests. and if you can provide
patches for them, that would particularly help.
> Thanks for the great job. By the way, what is the meaning for a
> getVelocityContext() in ViewContext?
i didn't put it there, but my understanding is that it is to allow alternate
implementations of ViewContext which provide access to a VelocityContext but
are not an instance of VelocityContext themselves (as ChainedContext is).
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org