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/23 06:08:34 UTC

Re: ToolboxManager.getToolboxContext(Object) not helping - continued

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 - 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