velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan1987 <stefan.kar...@googlemail.com>
Subject Re: Eclipse-Plugin + Velocity + read Files
Date Wed, 25 Feb 2009 16:42:04 GMT

Hi Nathan, 

thank you very much. everything runs great now!

Have a nice day!
Stefan1987


Nathan Bubna wrote:
> 
> I assume your FileLocator is returning an absolute path?  If so, you
> must configure the FileResourceLoader with an empty path to indicate
> that you want it to honor absolute paths.  By default it is restricted
> to paths relative to the current directory.  See:
> 
> http://velocity.apache.org/engine/devel/apidocs/org/apache/velocity/runtime/resource/loader/FileResourceLoader.html
> 
> for more info
> 
> On Wed, Feb 25, 2009 at 3:10 AM, Stefan1987
> <stefan.karl87@googlemail.com> wrote:
>>
>> Hello,
>>
>> i´m working with your velocity engine and i have got the following
>> problem:
>>
>> In my root-plugin-folder are the two files velocity.properties and
>> Templates/TableTemplate.tpl.
>>
>> At first there were problems reading the "velocity.properties", but i
>> solved
>> it that way:
>>
>> URL url =
>> Activator.getDefault().getBundle().getResource("velocity.properties");
>> Velocity.init(FileLocator.toFileURL(url).getPath() );
>>
>> Now i wanted to transfer this solution to the template problem:
>>
>> url=Activator.getDefault().getBundle().getResource (pTemplatePath);
>> Template lTemplate = Velocity.getTemplate(FileLocator.toFileURL(url).ge
>> tPath());
>>
>> pTemplatePath is a String, for example "Templates\\TableTemplate.tpl";
>>
>> I wanted to check, if the FileLocator works, so i put a
>>
>> "system.out.println(FileLocator.toFileURL(url).getPath());
>>
>> in my code! It works correctly. But in the end there is still a
>>
>> org.apache.velocity.exception.ResourceNotFoundException
>>
>> I would appreciate any help. Thank you!
>> Best Regards
>> Stefan1987
>> --
>> View this message in context:
>> http://www.nabble.com/Eclipse-Plugin-%2B-Velocity-%2B-read-Files-tp22200812p22200812.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Eclipse-Plugin-%2B-Velocity-%2B-read-Files-tp22200812p22206693.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Mime
View raw message