You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rama-o-Rama <pr...@yahoo.com> on 2008/01/17 00:31:12 UTC

How to read the properties file in wicket?

Hello,

I am trying to read the property file like test.properties in the wicket.
I have done previously like servletcontext.getresouceasstream().

what is the wicket way of reading the file.

~Rama
-- 
View this message in context: http://www.nabble.com/How-to-read-the-properties-file-in-wicket--tp14898469p14898469.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to read the properties file in wicket?

Posted by Rama-o-Rama <pr...@yahoo.com>.

thanks Igor,

Rama



igor.vaynberg wrote:
> 
> ((WebApplication)Application.get()).getServletContext()
> 
> -igor
> 
> 
> On Jan 16, 2008 3:57 PM, Rama-o-Rama <pr...@yahoo.com> wrote:
>>
>>
>>
>> Rama-o-Rama wrote:
>> >
>> > Hello,
>> >
>> > I am trying to read the property file like test.properties in the
>> wicket.
>> > I have done previously like servletcontext.getresouceasstream().
>> >
>> > what is the wicket way of reading the file.
>> >
>> > ~Rama
>> >
>>
>> Hi Igor,
>>
>> How do the serveltContext in wicket?
>>
>> ~Rama
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-read-the-properties-file-in-wicket--tp14898469p14899794.html
>>
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-read-the-properties-file-in-wicket--tp14898469p14908688.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to read the properties file in wicket?

Posted by Igor Vaynberg <ig...@gmail.com>.
((WebApplication)Application.get()).getServletContext()

-igor


On Jan 16, 2008 3:57 PM, Rama-o-Rama <pr...@yahoo.com> wrote:
>
>
>
> Rama-o-Rama wrote:
> >
> > Hello,
> >
> > I am trying to read the property file like test.properties in the wicket.
> > I have done previously like servletcontext.getresouceasstream().
> >
> > what is the wicket way of reading the file.
> >
> > ~Rama
> >
>
> Hi Igor,
>
> How do the serveltContext in wicket?
>
> ~Rama
> --
> View this message in context: http://www.nabble.com/How-to-read-the-properties-file-in-wicket--tp14898469p14899794.html
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to read the properties file in wicket?

Posted by Rama-o-Rama <pr...@yahoo.com>.


Rama-o-Rama wrote:
> 
> Hello,
> 
> I am trying to read the property file like test.properties in the wicket.
> I have done previously like servletcontext.getresouceasstream().
> 
> what is the wicket way of reading the file.
> 
> ~Rama
> 

Hi Igor,

How do the serveltContext in wicket?

~Rama
-- 
View this message in context: http://www.nabble.com/How-to-read-the-properties-file-in-wicket--tp14898469p14899794.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to read the properties file in wicket?

Posted by Matthijs Wensveen <m....@func.nl>.
Rama-o-Rama wrote:
> Hello,
>
> I am trying to read the property file like test.properties in the wicket.
> I have done previously like servletcontext.getresouceasstream().
>
> what is the wicket way of reading the file.
>
> ~Rama
>   
If the properties file 'belongs' to a Component, like 
MyComponent.properties, I'd recommend using PackageResource. To load a 
Properties object you would do

Properties.load(PackageResouce.get(MyComponent.class, 
"MyComponent.properties").getResourceStream().getInputStream()));

I think using an IResourceStream implementation is more wickety than 
getting the servlet context. Only use javax.servlet.* classes when you 
really really need them. Who knows, maybe one day someone implements 
wicket on top of AWT (crazy but probably possible) and then you're in 
trouble (not really, but you get the point right?).

BTW, you can get a resource from any Class or ClassLoader instance, so 
you could also do 
this.getClass().getClassLoader().getResouceAsStream(..) but I would 
still recommend PackageResource.

Cheers,
Matthijs

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to read the properties file in wicket?

Posted by Igor Vaynberg <ig...@gmail.com>.
why would there be a "wicket way" of reading a .properties file? do
the same as you usually do.

-igor


On Jan 16, 2008 3:31 PM, Rama-o-Rama <pr...@yahoo.com> wrote:
>
> Hello,
>
> I am trying to read the property file like test.properties in the wicket.
> I have done previously like servletcontext.getresouceasstream().
>
> what is the wicket way of reading the file.
>
> ~Rama
> --
> View this message in context: http://www.nabble.com/How-to-read-the-properties-file-in-wicket--tp14898469p14898469.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org