Specific user/session properties and resources

2010-06-17 Thread Brown, Berlin [GCG-PFS]
I still want to use wicket message resource tags in my markup.  But, I
need a system to load and reload resources property data for each page
and request.
Or maybe load properties per user session.  Is this possible using
Wicket resource loader classes.
 
Ideally, it looks like I should use a collection of labels, but I have
code to use the wicket message tags.  Can I have wicket messages
reloaded at each page/request?
 
This is what I am doing now, loading a property file on startup/init.
But
-
 
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.InvalidPropertiesFormatException;
import java.util.Locale;
import java.util.Properties;
 
import org.apache.wicket.Component;
import org.apache.wicket.resource.loader.IStringResourceLoader;
 

public class MyResourceLoader implements IStringResourceLoader {
 
 private Properties properties = new Properties();
 
 public void loadProperties() {
  
  final BufferedInputStream bis = new BufferedInputStream(new
ByteArrayInputStream(DevelopmentResources.XML_PROPS.getBytes()));
  try {
   properties.loadFromXML(bis);
  } catch (Exception e) {
   e.printStackTrace();   
  } finally {
   try {
bis.close();
   } catch (IOException e) {
   }
  } // End of try finally //
 }
 
...
...
 
}
 
Berlin Brown


Re: Specific user/session properties and resources

2010-06-17 Thread Igor Vaynberg
scanning for i18n resources is expensive, that is why they are cached.
if you want something more dynamic perhaps you should not use wicket's
i18n mechanism to accomplish it.

-igor

On Thu, Jun 17, 2010 at 8:22 AM, Brown, Berlin [GCG-PFS]
berlin.br...@primerica.com wrote:
 I still want to use wicket message resource tags in my markup.  But, I
 need a system to load and reload resources property data for each page
 and request.
 Or maybe load properties per user session.  Is this possible using
 Wicket resource loader classes.

 Ideally, it looks like I should use a collection of labels, but I have
 code to use the wicket message tags.  Can I have wicket messages
 reloaded at each page/request?

 This is what I am doing now, loading a property file on startup/init.
 But
 -

 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.util.InvalidPropertiesFormatException;
 import java.util.Locale;
 import java.util.Properties;

 import org.apache.wicket.Component;
 import org.apache.wicket.resource.loader.IStringResourceLoader;


 public class MyResourceLoader implements IStringResourceLoader {

  private Properties properties = new Properties();

  public void loadProperties() {

  final BufferedInputStream bis = new BufferedInputStream(new
 ByteArrayInputStream(DevelopmentResources.XML_PROPS.getBytes()));
  try {
   properties.loadFromXML(bis);
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   try {
    bis.close();
   } catch (IOException e) {
   }
  } // End of try finally //
  }

 ...
 ...

 }

 Berlin Brown


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