You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jnorris <j....@snet.net> on 2008/03/19 18:19:40 UTC
Dynamic updating of property file
Hi all,
Does anyone know if it is possible to dynamically modify a property file or
overwrite it using Wicket? The property files are all in .xml format and
the keys are taken from a database when a tree is dynamically built based on
the values read in. The keys are used in a StringResourceModel to provide
the text for the tree nodes. On another page, the admin user can add/edit
new entries and I would like to also have the new or revised key-value data
items written to the property file(s) (including supported locales) at the
same time. The app deployment is expanded. I know I can get the path
starting with the package nameusing getAbsolutePath() on a PackageResource
but I'm not sure how to get the full path from the root folder.
Thanks,
Jim
--
View this message in context: http://www.nabble.com/Dynamic-updating-of-property-file-tp16146867p16146867.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: Dynamic updating of property file
Posted by jnorris <j....@snet.net>.
Hi All,
I was able to get this to work for a tomcat deployment by adding the
"\WEB-INF\classes\ as shown in the code snippet below but this obviously
won't work with jetty for testing and is not generic. I'm sure there must be
a simple generic way to accomplish this using Wicket classes but I haven't
found anything in the archives that gives me a clue.
Any help in coming up with a generic solution would be appreciated!
Jim
Code Snippet:
String propsPath = PackageResource.get( ReportsPage.class, "ReportsPage.xml"
).getAbsolutePath();
File file = new File ( DemoApp.get().getServletContext().getRealPath(
"/WEB-INF/classes/" + propsPath ));
String absPath = file.getAbsolutePath();
StringBuffer sbuf = .... // create the xml
Writer out = new BufferedWriter( new OutputStreamWriter( new
FileOutputStream( absPath ), "UTF8" ));
out.write( sbuf.toString());
jnorris wrote:
>
> Hi all,
>
> Does anyone know if it is possible to dynamically modify a property file
> or overwrite it using Wicket? The property files are all in .xml format
> and the keys are taken from a database when a tree is dynamically built
> based on the values read in. The keys are used in a StringResourceModel
> to provide the text for the tree nodes. On another page, the admin user
> can add/edit new entries and I would like to also have the new or revised
> key-value data items written to the property file(s) (including supported
> locales) at the same time. The app deployment is expanded. I know I can
> get the path starting with the package nameusing getAbsolutePath() on a
> PackageResource but I'm not sure how to get the full path from the root
> folder.
>
> Thanks,
> Jim
>
--
View this message in context: http://www.nabble.com/Dynamic-updating-of-property-file-tp16146867p16148601.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: Dynamic updating of property file
Posted by Igor Vaynberg <ig...@gmail.com>.
you could just write your own IStringResourceLoader and pull those
resources right out of the db
-igor
On Wed, Mar 19, 2008 at 10:19 AM, jnorris <j....@snet.net> wrote:
>
> Hi all,
>
> Does anyone know if it is possible to dynamically modify a property file or
> overwrite it using Wicket? The property files are all in .xml format and
> the keys are taken from a database when a tree is dynamically built based on
> the values read in. The keys are used in a StringResourceModel to provide
> the text for the tree nodes. On another page, the admin user can add/edit
> new entries and I would like to also have the new or revised key-value data
> items written to the property file(s) (including supported locales) at the
> same time. The app deployment is expanded. I know I can get the path
> starting with the package nameusing getAbsolutePath() on a PackageResource
> but I'm not sure how to get the full path from the root folder.
>
> Thanks,
> Jim
> --
> View this message in context: http://www.nabble.com/Dynamic-updating-of-property-file-tp16146867p16146867.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