You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Sara Frongillo <s....@virgilio.it> on 2004/04/26 11:40:25 UTC

Separe Istance for path loader Templates

Hi,

I have a problem to load dynamic templates path, so I have a Velocity
Servlet with method
   Properties loadConfiguration(ServletConfig config){
  .......................
    p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path);

  }
I need to load different path for template about a object value in the
session so I need to set path template in the handleRequest method so
How can I do??

Thanks in advance

Sara


-------------------------------
Sara Frongillo
Software Area Executive

I.T.Sys srl
C.so Garibaldi, 215
84125 Salerno - Italy

Office +390892580977
Mobile +393280087824
Email s.frongillo@itsys.it
Web http://www.nexsoft.it


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


Re: Separe Istance for path loader Templates

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Apr 26, 2004, at 5:40 AM, Sara Frongillo wrote:

> Hi,
>
> I have a problem to load dynamic templates path, so I have a Velocity
> Servlet with method
>    Properties loadConfiguration(ServletConfig config){
>   .......................
>     p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path);
>
>   }
> I need to load different path for template about a object value in the
> session so I need to set path template in the handleRequest method so
> How can I do??
>

If I understand you correctly, you are going to get into *heaps* of 
trouble with this once you have more than one concurrent user, because 
the servlet is shared among multiple threads.  So you don't want to try 
and reconfigure velocity's resource management on a per-request basis, 
because you'll be really surprised under load :)

One common solution is to have a root from which all can be seen by the 
loader :

  root/
     foo/
        index.vm
     bar/
        index.vm

and then based on request

     Template t = vel.getTemplate(  userPath + "/" + templateName);

for example.

There are other solutions, such as using the non-supported 
URLResourceLoader or other like approaches.

geir


> Thanks in advance
>
> Sara
>
>
> -------------------------------
> Sara Frongillo
> Software Area Executive
>
> I.T.Sys srl
> C.so Garibaldi, 215
> 84125 Salerno - Italy
>
> Office +390892580977
> Mobile +393280087824
> Email s.frongillo@itsys.it
> Web http://www.nexsoft.it
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


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