You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Keng Wong <ke...@verizon.net> on 2001/05/03 04:47:46 UTC

How to turn off ResourceManager logs

I am getting a lot of output in the velocity.log file that shows:
[info] ResourceManager : found ....... with loader
org.apache.velocity.runtime....FileResourceLoader

The stacktrace configurations are only for stacktraces. How can I turn off
the above messages ?

Thanks.
-keng


RE: How to turn off ResourceManager logs

Posted by Keng Wong <ke...@verizon.net>.
You're right! Sorry for not checking them further with more reloads.

> -----Original Message-----
> From: gmj@mta8.srv.hcvlny.cv.net [mailto:gmj@mta8.srv.hcvlny.cv.net]On
> Behalf Of Geir Magnusson Jr.
> Sent: Wednesday, May 02, 2001 10:30 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: How to turn off ResourceManager logs
>
>
> Keng Wong wrote:
> >
> > Unfortunately, it still does not. I have tried with
> > file.resource.loader.cache = true
>
> It does.  Note that it won't eliminate them completely - it will just do
> it the first time the template is loaded, and not after that.
>
> I am using the 1.1-dev version (current CVS) but it hasn't changed in a
> long time, so the 1.0.1 should be fine.
>
> I am using Vel in a servlet environment, with my velocity.properties as
> :
>
> resource.loader = file
> file.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> file.resource.loader.path = templates
> file.resource.loader.cache = true
> file.resource.loader.modificationCheckInterval = 0
>
>
> geir
>
> >
> > > -----Original Message-----
> > > From: gmj@mta6.srv.hcvlny.cv.net [mailto:gmj@mta6.srv.hcvlny.cv.net]On
> > > Behalf Of Geir Magnusson Jr.
> > > Sent: Wednesday, May 02, 2001 8:56 PM
> > > To: velocity-user@jakarta.apache.org
> > > Subject: Re: How to turn off ResourceManager logs
> > >
> > >
> > > Keng Wong wrote:
> > > >
> > > > I am getting a lot of output in the velocity.log file that shows:
> > > > [info] ResourceManager : found ....... with loader
> > > > org.apache.velocity.runtime....FileResourceLoader
> > > >
> > > > The stacktrace configurations are only for stacktraces. How can
> > > I turn off
> > > > the above messages ?
> > >
> > > turn caching on should solve it....
> > >
> > >
> > >
> > > --
> > > Geir Magnusson Jr.                           geirm@optonline.net
> > > System and Software Consulting
> > > Developing for the web?  See http://jakarta.apache.org/velocity/
> > >
>
> --
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
>
> Developing for the web?  See http://jakarta.apache.org/velocity/


Re: How to turn off ResourceManager logs

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Keng Wong wrote:
> 
> Unfortunately, it still does not. I have tried with
> file.resource.loader.cache = true

It does.  Note that it won't eliminate them completely - it will just do
it the first time the template is loaded, and not after that.

I am using the 1.1-dev version (current CVS) but it hasn't changed in a
long time, so the 1.0.1 should be fine.

I am using Vel in a servlet environment, with my velocity.properties as
:

resource.loader = file
file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path = templates
file.resource.loader.cache = true
file.resource.loader.modificationCheckInterval = 0


geir

> 
> > -----Original Message-----
> > From: gmj@mta6.srv.hcvlny.cv.net [mailto:gmj@mta6.srv.hcvlny.cv.net]On
> > Behalf Of Geir Magnusson Jr.
> > Sent: Wednesday, May 02, 2001 8:56 PM
> > To: velocity-user@jakarta.apache.org
> > Subject: Re: How to turn off ResourceManager logs
> >
> >
> > Keng Wong wrote:
> > >
> > > I am getting a lot of output in the velocity.log file that shows:
> > > [info] ResourceManager : found ....... with loader
> > > org.apache.velocity.runtime....FileResourceLoader
> > >
> > > The stacktrace configurations are only for stacktraces. How can
> > I turn off
> > > the above messages ?
> >
> > turn caching on should solve it....
> >
> >
> >
> > --
> > Geir Magnusson Jr.                           geirm@optonline.net
> > System and Software Consulting
> > Developing for the web?  See http://jakarta.apache.org/velocity/
> >

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting

Developing for the web?  See http://jakarta.apache.org/velocity/

Re[2]: Re[2]: Resource Bundle in Velocity

Posted by daljeetsingh <da...@softhome.net>.
Well I am new too. But I imagine having multiple resource bundle files
so that they can be managed properly in a bigger project environment.

So you might want to break the resource bundle files based on the
modules in your project. For example a set of resource files (for
different locales) for a module say cart management and than another set
of resources for say user management. 

Than while preparing the UI designer/programmer can decide what
resources to load and use.

Daljeet Singh 

Re: Resource Bundle in Velocity

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
daljeetsingh wrote:
> 
> All this has to kind of reinvent the wheel? What do you think of the
> idea where I can use the various tag libraries within my velocity
> templates.

I would *love* that.  I have been thinking about that for a while - I
want to make a little framework where we can just hijack any tag library
made and use them from the context as tools.

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Re: Re[2]: Resource Bundle in Velocity

Posted by bob mcwhirter <bo...@werken.com>.
> Implementation ideas: Lets see
> 
> I have used i18n taglibrary from TAGLIBS project and there is this
> process that has to be carried out:
> 
> 1. Load all (more than 1 can be loaded) the correct resource bundle
> files. The locale object can be in your session / request object. 

Admittedly, I'm still kinda new to i18n/l10n, but from my cursory
readings, don't you mostly end up with one bundle, chained to
others, providing 'fall-through' defaults kind of thing?

	-bob


Re[2]: Resource Bundle in Velocity

Posted by daljeetsingh <da...@softhome.net>.
Implementation ideas: Lets see

I have used i18n taglibrary from TAGLIBS project and there is this
process that has to be carried out:

1. Load all (more than 1 can be loaded) the correct resource bundle
files. The locale object can be in your session / request object. 

2. Refer to the keys wherever you want to show labels etc. Here if we
should have the possibility of sending a Object[] to the key. The tag
library does this by adding a messageArg tag within the message tag.

All this has to kind of reinvent the wheel? What do you think of the
idea where I can use the various tag libraries within my velocity
templates.

Thanks
Daljeet Singh 
ecExperts India 
Ph:- (O) +91-11-4670906
(R) +91-11-7125680 
ICQ:- 75129600
Yahoo:- daljeetsinghmaken 

Re: Resource Bundle in Velocity

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
bob mcwhirter wrote:
> 
> > > I *know* that this is something I'm going to have to deal
> > > with at work.
> >
> > Hi bob!  Good to see you again!
> 
> Oh, I've always been here.  Just quiet.  I've directed a cow-orker
> of mine to do the UI layer of our current project (we've selected,
> Velocity; no suprise there...).
> 
> > Yep - for two reasons, I think : 1) There is no reason to believe that
> > this is velocity specific code, or core velocity 2) it would be a great
> > thing to share with others.  I want to start a commons project where we
> > collect all the servlet / ui / etc utils and tools and bring them
> > together.  This would be a great addition, christoph has a few, a client
> > of mine has a result set reporting formatter ui bean thing...
> 
> Cool.  The only thing I'm questioning right now is the ability
> to deal with arrays of substitution data.  Kinda ends up being
> somewhat printf-esque.
> 
> I forgot, did Velocity ever end up with a VARARGS type of thing?

Yes - directives are vararg - you can specify an arbitrary number if you
were going to write a directive to do this.

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Re: Resource Bundle in Velocity

Posted by bob mcwhirter <bo...@werken.com>.
> > I *know* that this is something I'm going to have to deal
> > with at work.
> 
> Hi bob!  Good to see you again!

Oh, I've always been here.  Just quiet.  I've directed a cow-orker
of mine to do the UI layer of our current project (we've selected,
Velocity; no suprise there...).

> Yep - for two reasons, I think : 1) There is no reason to believe that
> this is velocity specific code, or core velocity 2) it would be a great
> thing to share with others.  I want to start a commons project where we
> collect all the servlet / ui / etc utils and tools and bring them
> together.  This would be a great addition, christoph has a few, a client
> of mine has a result set reporting formatter ui bean thing...

Cool.  The only thing I'm questioning right now is the ability
to deal with arrays of substitution data.  Kinda ends up being
somewhat printf-esque.  

I forgot, did Velocity ever end up with a VARARGS type of thing?

	-bob


Re: Resource Bundle in Velocity

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
bob mcwhirter wrote:
> 
> > Hello,
> >
> > >>>$$bundle.getString("key")
> >
> > >>>to get a string, and put the right bundle into the context for the
> > >>>required locale of the client.
> >
> > That does work but what actually doesn't work is:
> >
> > $MessageFormat.format($bundle.getString("key"), new Object[] {"name"} )
> >
> > This has to be done since my properties files contain something like
> > Welcome {0} or Willkommen {0} based on the locale.
> >
> > Will it be a good idea to add some sort of API to Velocity for doing
> > this?
> 
> I *know* that this is something I'm going to have to deal
> with at work.

Hi bob!  Good to see you again!
 
> I'm betting that hopefully we don't have to actually extend
> Velocity proper, and do it all with helper objects in the
> context.

Yep - for two reasons, I think : 1) There is no reason to believe that
this is velocity specific code, or core velocity 2) it would be a great
thing to share with others.  I want to start a commons project where we
collect all the servlet / ui / etc utils and tools and bring them
together.  This would be a great addition, christoph has a few, a client
of mine has a result set reporting formatter ui bean thing...
 
> If you have implementation ideas, I'd love to hear'em.  Else,
> we'll probably also develop an implementation, and at some point,
> donate it back to the project.

very cool!

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Re: Resource Bundle in Velocity

Posted by bob mcwhirter <bo...@werken.com>.
> Hello,
> 
> >>>$$bundle.getString("key") 
> 
> >>>to get a string, and put the right bundle into the context for the
> >>>required locale of the client.
> 
> That does work but what actually doesn't work is:
> 
> $MessageFormat.format($bundle.getString("key"), new Object[] {"name"} ) 
> 
> This has to be done since my properties files contain something like
> Welcome {0} or Willkommen {0} based on the locale. 
> 
> Will it be a good idea to add some sort of API to Velocity for doing
> this?

I *know* that this is something I'm going to have to deal 
with at work.  

I'm betting that hopefully we don't have to actually extend
Velocity proper, and do it all with helper objects in the 
context.

If you have implementation ideas, I'd love to hear'em.  Else,
we'll probably also develop an implementation, and at some point,
donate it back to the project.

	-bob


Resource Bundle in Velocity

Posted by daljeetsingh <da...@softhome.net>.
Hello,

>>>$$bundle.getString("key") 

>>>to get a string, and put the right bundle into the context for the
>>>required locale of the client.

That does work but what actually doesn't work is:

$MessageFormat.format($bundle.getString("key"), new Object[] {"name"} ) 

This has to be done since my properties files contain something like
Welcome {0} or Willkommen {0} based on the locale. 

Will it be a good idea to add some sort of API to Velocity for doing
this?

Thanks,
Daljeet Singh 
ecExperts India 
Ph:- (O) +91-11-4670906
(R) +91-11-7125680 
ICQ:- 75129600
Yahoo:- daljeetsinghmaken 

Velocity within JSP framework

Posted by daljeetsingh <da...@softhome.net>.
Hello,

I am trying to use the velocity templates within the JSP framework that
is already existing since its a running project. If I try to include the
output of the SampleServlet using a JSP:INCLUDE like:

<jsp:include page="/servlet/SampleServlet" flush="true" /> 
Though this works on weblogic it throws the follwoing exception on
Tomcat 3.2:

java.lang.IllegalStateException: Writer is already being used for this request
	at org.apache.tomcat.facade.HttpServletResponseFacade.getOutputStream(HttpServletResponseFacade.java, Compiled Code)
	at org.apache.velocity.servlet.VelocityServlet.error(VelocityServlet.java:527)
	at org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:356)
	at org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:287)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java, Compiled Code)

Just want to know if it is possible to use velocity in this manner or
not.

Thanks,
Daljeet Singh 
ecExperts India 
Ph:- (O) +91-11-4670906
(R) +91-11-7125680 
ICQ:- 75129600
Yahoo:- daljeetsinghmaken 

Re: How to turn off ResourceManager logs

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
daljeetsingh wrote:
> 
> Hello,
> 
> Just started with velocity. Where do I put the tasks that the HttpServlet's
> init method contained. I want to load a couple of resource bundle files
> and am not sure where to load them. If
> and am not sure where to load them. I suppose handleRequest is not the
> correct place.
> 

No, that wouldn't be good.  You could override init(), do a super.init(
config ), and then do it.


> Also is there any way by which I can directly refer to resource bundles
> directly from my templates??? I am looking at making the templates
> properly internationalised and not hard code all the labels inside
> them.

I haven't ever used them : but if you want to access directly, I would
assume you could do something like

$bundle.getString("key") 

to get a string, and put the right bundle into the context for the
required locale of the client.

Would that work?

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Re[2]: How to turn off ResourceManager logs

Posted by daljeetsingh <da...@softhome.net>.
Hello,

Just started with velocity. Where do I put the tasks that the HttpServlet's
init method contained. I want to load a couple of resource bundle files
and am not sure where to load them. If 
and am not sure where to load them. I suppose handleRequest is not the
correct place.

Also is there any way by which I can directly refer to resource bundles
directly from my templates??? I am looking at making the templates
properly internationalised and not hard code all the labels inside
them.

Thanks,
Daljeet Singh 
ecExperts India 
Ph:- (O) +91-11-4670906
(R) +91-11-7125680 
ICQ:- 75129600
Yahoo:- daljeetsinghmaken 

Re: How to turn off ResourceManager logs

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Hm.  Ok, I'll take a look.

geir

Keng Wong wrote:
> 
> Unfortunately, it still does not. I have tried with
> file.resource.loader.cache = true
> 
> > -----Original Message-----
> > From: gmj@mta6.srv.hcvlny.cv.net [mailto:gmj@mta6.srv.hcvlny.cv.net]On
> > Behalf Of Geir Magnusson Jr.
> > Sent: Wednesday, May 02, 2001 8:56 PM
> > To: velocity-user@jakarta.apache.org
> > Subject: Re: How to turn off ResourceManager logs
> >
> >
> > Keng Wong wrote:
> > >
> > > I am getting a lot of output in the velocity.log file that shows:
> > > [info] ResourceManager : found ....... with loader
> > > org.apache.velocity.runtime....FileResourceLoader
> > >
> > > The stacktrace configurations are only for stacktraces. How can
> > I turn off
> > > the above messages ?
> >
> > turn caching on should solve it....
> >
> >
> >
> > --
> > Geir Magnusson Jr.                           geirm@optonline.net
> > System and Software Consulting
> > Developing for the web?  See http://jakarta.apache.org/velocity/
> >

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting

Developing for the web?  See http://jakarta.apache.org/velocity/

RE: How to turn off ResourceManager logs

Posted by Keng Wong <ke...@verizon.net>.
Unfortunately, it still does not. I have tried with
file.resource.loader.cache = true

> -----Original Message-----
> From: gmj@mta6.srv.hcvlny.cv.net [mailto:gmj@mta6.srv.hcvlny.cv.net]On
> Behalf Of Geir Magnusson Jr.
> Sent: Wednesday, May 02, 2001 8:56 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: How to turn off ResourceManager logs
>
>
> Keng Wong wrote:
> >
> > I am getting a lot of output in the velocity.log file that shows:
> > [info] ResourceManager : found ....... with loader
> > org.apache.velocity.runtime....FileResourceLoader
> >
> > The stacktrace configurations are only for stacktraces. How can
> I turn off
> > the above messages ?
>
> turn caching on should solve it....
>
>
>
> --
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
>


Re: How to turn off ResourceManager logs

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Keng Wong wrote:
> 
> I am getting a lot of output in the velocity.log file that shows:
> [info] ResourceManager : found ....... with loader
> org.apache.velocity.runtime....FileResourceLoader
> 
> The stacktrace configurations are only for stacktraces. How can I turn off
> the above messages ?

turn caching on should solve it....



-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/