Re: Resource loading question

2016-11-23 Thread Sven Meier

https://cwiki.apache.org/confluence/display/WICKET/Multiple+markups+per+page

https://cwiki.apache.org/confluence/display/WICKET/Localization+and+Skinning+of+Applications#LocalizationandSkinningofApplications-MarkupFiles

Sven


On 23.11.2016 16:16, gmparker2000 wrote:

I have a rather unique situation where I need to use the same page with
different properties files.  Just wondering if there is any support for
this.  By default properties are loaded and cached based on the class name.
My situation requires more flexibility.  Also, inheritance doesn't work in
my situation.  So I can't do something like "class PageASituation1 extends
PageA {}".  I realize that this is technically possible but just not
applicable in my circumstance.

So, for example, I need something based on naming convention,

- com/myapp/
 - PageA.java
 - PageA.properties
 - PageA_situation1.properties
 - PageA_situation1_en.properties
 - PageA_situation1_fr.properties
 - PageA_situation2.properties
 - PageA_situation2_en.properties
 - PageA_situation2_fr.properties

Or perhaps based on sub-folder/package

- com/myapp
- PageA.java
- PageA.properties
- situation 1
  - PageA.properties
  - PageA_en.properties
  - PageA_fr.properties
- situation 2
  - PageA.properties
  - PageA_en.properties
  - PageA_fr.properties


Does anything like this exist?  Any implementation suggestions?

I am still using wicket 6.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Resource-loading-question-tp4676259.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Resource loading question

2016-11-23 Thread gmparker2000
I have a rather unique situation where I need to use the same page with
different properties files.  Just wondering if there is any support for
this.  By default properties are loaded and cached based on the class name. 
My situation requires more flexibility.  Also, inheritance doesn't work in
my situation.  So I can't do something like "class PageASituation1 extends
PageA {}".  I realize that this is technically possible but just not
applicable in my circumstance.

So, for example, I need something based on naming convention,  

- com/myapp/
- PageA.java
- PageA.properties
- PageA_situation1.properties
- PageA_situation1_en.properties
- PageA_situation1_fr.properties
- PageA_situation2.properties
- PageA_situation2_en.properties
- PageA_situation2_fr.properties

Or perhaps based on sub-folder/package

- com/myapp
   - PageA.java
   - PageA.properties
   - situation 1
 - PageA.properties
 - PageA_en.properties
 - PageA_fr.properties
   - situation 2
 - PageA.properties
 - PageA_en.properties
 - PageA_fr.properties


Does anything like this exist?  Any implementation suggestions?  

I am still using wicket 6.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Resource-loading-question-tp4676259.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Relative Path and Resource loading in wicket

2012-11-16 Thread Martin Grigorov
On Fri, Nov 16, 2012 at 7:55 AM, delta458 delta...@hotmail.com wrote:

 Hello,

 Im sitting now 6 hours non-stop on this problem and cant get it work.

 I want a simple thing.

 I have a Invoice.js file in my resource folder.
 I want to get this file and write something to it: so I did:

 /URL url = getClass().getResource(Invoice.js);


Your problems is here ^^.
getClass().getResource() looks in the classpath.



 File file = new File(url.getPath());

 System.out.println(url.getPath());
 BufferedWriter out = new BufferedWriter(new FileWriter(file),
 32768);
 out.write(TEST);
 out.close();/

 But thats not working. He writes into the file successfully, but saves the
 file into the maven target folder :(
 I need to read from that file later, so I need to use it again.

 How can I make wicket to write to the relative path and not save it in the
 target folder...



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930.html
 Sent from the Users forum mailing list archive at Nabble.com.

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


P.S. There is nothing Wicket related in this question.

-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Relative Path and Resource loading in wicket

2012-11-16 Thread delta458
@Ernest I just need to write some variables to the .js file
like

var price;
var user;

@MartinGrigorov so what should I do to make this work? How can I set my
resource to the classpath? and what should I call to make it work?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930p4653945.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Relative Path and Resource loading in wicket

2012-11-16 Thread Alec Swan
I had a similar problem and considered Martin's approach, but ended up
creating a div wicket:id=myVar class=myVarvar value/div on my
page and accessed it from JS file using $(div.myVar).text() or
something like that.

The advantage of div approach is that you can test it statically
without deploying the webapp and your JS file can be safely cached by
the browser improving load time.

Alec

On Fri, Nov 16, 2012 at 7:58 AM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 You can do something like

 On your panel

  public void renderHead(final IHeaderResponse response) {
 PackagedTextTemplate template = new PackagedTextTemplate(MyPanel.class,
 test.js);
 MapString, Object vars = new MiniMapString, Object(1);
 vars.put(val1, MyValue);
 response.renderOnDomReadyJavascript(template.asString(vars));
   }

 test.js=

 var bla = '${val1}';


 On Fri, Nov 16, 2012 at 3:51 PM, delta458 delta...@hotmail.com wrote:

 @Ernest I just need to write some variables to the .js file
 like

 var price;
 var user;

 @MartinGrigorov so what should I do to make this work? How can I set my
 resource to the classpath? and what should I call to make it work?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930p4653945.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




 --
 Regards - Ernesto Reinaldo Barreiro
 Antilia Soft
 http://antiliasoft.com/ http://antiliasoft.com/antilia

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



Relative Path and Resource loading in wicket

2012-11-15 Thread delta458
Hello,

Im sitting now 6 hours non-stop on this problem and cant get it work.

I want a simple thing.

I have a Invoice.js file in my resource folder.
I want to get this file and write something to it: so I did:

/URL url = getClass().getResource(Invoice.js);
File file = new File(url.getPath());

System.out.println(url.getPath());
BufferedWriter out = new BufferedWriter(new FileWriter(file),
32768);
out.write(TEST);
out.close();/

But thats not working. He writes into the file successfully, but saves the
file into the maven target folder :(
I need to read from that file later, so I need to use it again.

How can I make wicket to write to the relative path and not save it in the
target folder... 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Resource loading

2011-03-10 Thread Marek Šabo

Hi all,

I have a question regarding resource loading in general (sorry for 
little OT). What code should I use to load a property file which is 
located in src/main/resources folder (maven directory structure)? I 
tried various snippets and the only one working for me under both tomcat 
(standalone) and jetty (mvn jetty:run) is to load it like this (e.g. 
from Application class):


URL url = 
Thread.currentThread().getContextClassLoader().getResource(modules.properties);


I extracted this from log4j loading code - is this the only way or are 
there other ways of doing this? The point being that files from 
resources folder vary in different places when running mvn jetty:run, 
deploying war or just running jar archive.


Regards,

Marek

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



Re: Resource loading

2011-03-10 Thread Martin Grigorov
You can also use:
AnyClassInSrcMainJava.class.getClassLoader().getResource(modules.properties)

On Thu, Mar 10, 2011 at 4:29 PM, Marek Šabo ms...@buk.cvut.cz wrote:

 Hi all,

 I have a question regarding resource loading in general (sorry for little
 OT). What code should I use to load a property file which is located in
 src/main/resources folder (maven directory structure)? I tried various
 snippets and the only one working for me under both tomcat (standalone) and
 jetty (mvn jetty:run) is to load it like this (e.g. from Application class):

 URL url =
 Thread.currentThread().getContextClassLoader().getResource(modules.properties);

 I extracted this from log4j loading code - is this the only way or are
 there other ways of doing this? The point being that files from resources
 folder vary in different places when running mvn jetty:run, deploying war or
 just running jar archive.

 Regards,

 Marek

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Resource loading

2011-03-10 Thread Peter Ertl
alternatively use:

   AnyClass.class.getResourceAsStream(...)


Am 10.03.2011 um 19:20 schrieb Martin Grigorov:

 You can also use:
 AnyClassInSrcMainJava.class.getClassLoader().getResource(modules.properties)
 
 On Thu, Mar 10, 2011 at 4:29 PM, Marek Šabo ms...@buk.cvut.cz wrote:
 
 Hi all,
 
 I have a question regarding resource loading in general (sorry for little
 OT). What code should I use to load a property file which is located in
 src/main/resources folder (maven directory structure)? I tried various
 snippets and the only one working for me under both tomcat (standalone) and
 jetty (mvn jetty:run) is to load it like this (e.g. from Application class):
 
 URL url =
 Thread.currentThread().getContextClassLoader().getResource(modules.properties);
 
 I extracted this from log4j loading code - is this the only way or are
 there other ways of doing this? The point being that files from resources
 folder vary in different places when running mvn jetty:run, deploying war or
 just running jar archive.
 
 Regards,
 
 Marek
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 -- 
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/


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



Re: Resource loading

2011-03-10 Thread Martin Grigorov
On Thu, Mar 10, 2011 at 10:37 PM, Peter Ertl pe...@gmx.org wrote:

 alternatively use:

   AnyClass.class.getResourceAsStream(...)


this will look next to AnyClass.class, not in the root of the classpath



 Am 10.03.2011 um 19:20 schrieb Martin Grigorov:

  You can also use:
 
 AnyClassInSrcMainJava.class.getClassLoader().getResource(modules.properties)
 
  On Thu, Mar 10, 2011 at 4:29 PM, Marek Šabo ms...@buk.cvut.cz wrote:
 
  Hi all,
 
  I have a question regarding resource loading in general (sorry for
 little
  OT). What code should I use to load a property file which is located in
  src/main/resources folder (maven directory structure)? I tried various
  snippets and the only one working for me under both tomcat (standalone)
 and
  jetty (mvn jetty:run) is to load it like this (e.g. from Application
 class):
 
  URL url =
 
 Thread.currentThread().getContextClassLoader().getResource(modules.properties);
 
  I extracted this from log4j loading code - is this the only way or are
  there other ways of doing this? The point being that files from
 resources
  folder vary in different places when running mvn jetty:run, deploying
 war or
  just running jar archive.
 
  Regards,
 
  Marek
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  Martin Grigorov
  jWeekend
  Training, Consulting, Development
  http://jWeekend.com http://jweekend.com/


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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Resource loading

2011-03-10 Thread Marek Šabo

Hi,

thanks for suggestions. I know these variants but I've never had a file 
in src/main/java, there's always something like org.company package before.


Regards,

Marek
On 03/10/2011 10:00 PM, Martin Grigorov wrote:

On Thu, Mar 10, 2011 at 10:37 PM, Peter Ertlpe...@gmx.org  wrote:


alternatively use:

   AnyClass.class.getResourceAsStream(...)


this will look next to AnyClass.class, not in the root of the classpath



Am 10.03.2011 um 19:20 schrieb Martin Grigorov:


You can also use:


AnyClassInSrcMainJava.class.getClassLoader().getResource(modules.properties)

On Thu, Mar 10, 2011 at 4:29 PM, Marek Šaboms...@buk.cvut.cz  wrote:


Hi all,

I have a question regarding resource loading in general (sorry for

little

OT). What code should I use to load a property file which is located in
src/main/resources folder (maven directory structure)? I tried various
snippets and the only one working for me under both tomcat (standalone)

and

jetty (mvn jetty:run) is to load it like this (e.g. from Application

class):

URL url =


Thread.currentThread().getContextClassLoader().getResource(modules.properties);

I extracted this from log4j loading code - is this the only way or are
there other ways of doing this? The point being that files from

resources

folder vary in different places when running mvn jetty:run, deploying

war or

just running jar archive.

Regards,

Marek

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




--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.comhttp://jweekend.com/


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






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



Re: String Resource Loading from DB

2010-04-22 Thread Zilvinas Vilutis
the combination of class, key, locale, style must be unique, so if I
have the same keys ( while locale and style is not changing ) - the
classname must be unique. So I cannot use this in anonymous classes,
as it does not resolve, e.g. page class name


Žilvinas Vilutis

Mobile:   (+370) 652 38353
E-mail:   cika...@gmail.com



On Wed, Apr 21, 2010 at 1:46 PM, Josh Glassman josh...@gmail.com wrote:
 Not sure what you mean about implementing a unique class... any class which
 inherits from Component can call getString(String key), which will call your
 custom IStringResourceLoader.  Additionally, you can set the locale on any
 MarkupContainer or the Session, and Components will use their parent's
 locale falling back to the Session's.

 You can also use the wicket:message tag directly in your markup, which uses
 whatever locale it's associated class uses.

 What we do is set the locale on the Session, and use that and a resource key
 to pull the string from the database.  We use DB caching, and turn off the
 built-in resource string caching that wicket does (see below, goes in
 WebApplication.init()).

 getResourceSettings().setLocalizer(new Localizer() {
   @Override
   protected void putIntoCache(String cacheKey, String string) {
      // Do nothing... no caching desired, since our DB layer caches
   }
 });



 On Tue, Apr 20, 2010 at 1:53 PM, Zilvinas Vilutis cika...@gmail.com wrote:

 Yes,

 That seems to work. Although each component which needs to be
 localized needs to implement a unique class, 'cause in many cases the
 Component class is WebMarkupContainer ( if we use components in list
  etc ).

 Does anyone have practice on using any performance experience on that?

 Do you use DB caching or method caching?


 Žilvinas Vilutis

 Mobile:   (+370) 652 38353
 E-mail:   cika...@gmail.com



 On Tue, Apr 20, 2010 at 7:40 AM, Josh Glassman josh...@gmail.com wrote:
  Yup, you have the right idea.
 
  Something like...
     public class DatabaseStringResourceLoader implements
  IStringResourceLoader {...}
 
  And then in your WebApplication.init()...
     getResourceSettings().addStringResourceLoader(new
  DatabaseStringResourceLoader());
 
  Cheers,
  Josh
 



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



Re: String Resource Loading from DB

2010-04-22 Thread Josh Glassman
Ah, right... we got around that by not using the class (partly so we could
use the same resource strings across different classes).  The only other
thing I can suggest is to use more unique keys for anonymous classes, though
that is clearly not ideal.  Maybe someone else knows a better solution.

On Thu, Apr 22, 2010 at 3:27 AM, Zilvinas Vilutis cika...@gmail.com wrote:

 the combination of class, key, locale, style must be unique, so if I
 have the same keys ( while locale and style is not changing ) - the
 classname must be unique. So I cannot use this in anonymous classes,
 as it does not resolve, e.g. page class name


 Žilvinas Vilutis

 Mobile:   (+370) 652 38353
 E-mail:   cika...@gmail.com



 On Wed, Apr 21, 2010 at 1:46 PM, Josh Glassman josh...@gmail.com wrote:
  Not sure what you mean about implementing a unique class... any class
 which
  inherits from Component can call getString(String key), which will call
 your
  custom IStringResourceLoader.  Additionally, you can set the locale on
 any
  MarkupContainer or the Session, and Components will use their parent's
  locale falling back to the Session's.
 
  You can also use the wicket:message tag directly in your markup, which
 uses
  whatever locale it's associated class uses.
 
  What we do is set the locale on the Session, and use that and a resource
 key
  to pull the string from the database.  We use DB caching, and turn off
 the
  built-in resource string caching that wicket does (see below, goes in
  WebApplication.init()).
 
  getResourceSettings().setLocalizer(new Localizer() {
@Override
protected void putIntoCache(String cacheKey, String string) {
   // Do nothing... no caching desired, since our DB layer caches
}
  });
 
 
 
  On Tue, Apr 20, 2010 at 1:53 PM, Zilvinas Vilutis cika...@gmail.com
 wrote:
 
  Yes,
 
  That seems to work. Although each component which needs to be
  localized needs to implement a unique class, 'cause in many cases the
  Component class is WebMarkupContainer ( if we use components in list
   etc ).
 
  Does anyone have practice on using any performance experience on that?
 
  Do you use DB caching or method caching?
 
 
  Žilvinas Vilutis
 
  Mobile:   (+370) 652 38353
  E-mail:   cika...@gmail.com
 
 
 
  On Tue, Apr 20, 2010 at 7:40 AM, Josh Glassman josh...@gmail.com
 wrote:
   Yup, you have the right idea.
  
   Something like...
  public class DatabaseStringResourceLoader implements
   IStringResourceLoader {...}
  
   And then in your WebApplication.init()...
  getResourceSettings().addStringResourceLoader(new
   DatabaseStringResourceLoader());
  
   Cheers,
   Josh
  
 
 

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




Re: String Resource Loading from DB

2010-04-20 Thread Josh Glassman
Yup, you have the right idea.

Something like...
   public class DatabaseStringResourceLoader implements
IStringResourceLoader {...}

And then in your WebApplication.init()...
   getResourceSettings().addStringResourceLoader(new
DatabaseStringResourceLoader());

Cheers,
Josh


Re: String Resource Loading from DB

2010-04-20 Thread Zilvinas Vilutis
Yes,

That seems to work. Although each component which needs to be
localized needs to implement a unique class, 'cause in many cases the
Component class is WebMarkupContainer ( if we use components in list
 etc ).

Does anyone have practice on using any performance experience on that?

Do you use DB caching or method caching?


Žilvinas Vilutis

Mobile:   (+370) 652 38353
E-mail:   cika...@gmail.com



On Tue, Apr 20, 2010 at 7:40 AM, Josh Glassman josh...@gmail.com wrote:
 Yup, you have the right idea.

 Something like...
    public class DatabaseStringResourceLoader implements
 IStringResourceLoader {...}

 And then in your WebApplication.init()...
    getResourceSettings().addStringResourceLoader(new
 DatabaseStringResourceLoader());

 Cheers,
 Josh


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



String Resource Loading from DB

2010-04-19 Thread Zilvinas Vilutis
Has anybody had implemented smth like that ( @see topic ) and / or had
any practice with this?

I'm looking for a resource loading solution for quite a big web-site
project which would be localized to many languages and may need to
require update at runtime using some administration panel.

Or is that so easy as implementing the IStringResourceLoader ?


Looking forward for any opinion on this.

Thank you

Žilvinas Vilutis

Mobile:   (+370) 652 38353
E-mail:   cika...@gmail.com

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



Custom resource loading

2009-12-06 Thread Sebastiaan van Erk

Hi,

I'm implementing a Wicket application that has heavy use of styling and 
localization. I want to place the resources for these styles and locales 
in an external directory structure (not in the war). Basically, I want 
the following structure:


/external/style/locale/images
/external/style/locale/css
/external/style/locale/messages.properties
/external/style/locale/templates

The reason I want all these files externally is because I want to be 
able to add and modify these files while the application is running. I 
also want the directory structure like this because it's basically 
branding and I want to easily be able to restrict access to the subtree 
under /external/brand1 (using for example ftp or webdav) to a specific 
person responsible for that tree.


I also want to use the standard fallback mechanism, so if I look for a 
css file called my.css with style style1 and locale locale1, I want to try:


1. /external/style1/locale1/css/my.css
2. /external/_default/locale1/css/my.css
3. /external/style1/_default/css/my.css
4. /external/_default/_default/css/my.css
5. Wicket's standard mechanism for finding my.css

Question 1:
- how can I add this scheme to the resource locating mechanism?

I looked into IResourceStreamLocator and IResourceSettings, and what I 
can think of is writing my own IResourceStreamLocator which wraps 
Wicket's implementation, does 1-4 and if nothing is found calls Wicket's 
implementation.


However, there is a class ResourceNameIterator which immplements the 
locale/style sequence of finding pathnames, and it used not only in 
ResourceStreamLocator, but also in all the IStringResourceLoaders. This 
leads me to believe that I must also add my own IStringResourceLoader to 
look in the property files above. I'm also wondering how I can do this 
efficiently though: how can I make sure I don't have to read the 
property files 100 times for message keys (once for each key)? Do I have 
to implement my own caching in the IStringResourceLoader implementation? 
Is there anything I can reuse from Wicket which already reads property 
files for keys.


Question 2:
- Some of the resources listed above are public, and I want to be able 
to mount them. Is it possible to mount an entire directory at a time, 
e.g., mount /images and then automatically have 
http://www.mywicketapplication.com/app/images/.jpg use my resource 
loader with the path images/.jpg?


Question 3:
- Are there any tips with regards to Wicket's caching mechanism and my 
desire to be able to change resources on the fly (I'm especially 
concerned about negative caching (i.e., resource was not found before, 
but now it has been added), and new resources appearing for a more 
specific style/locale, overriding the previously more generic resource 
(i.e., style1/_default/my.css was previously found, but now 
style1/nl/my.css suddenly exists and should be used instead))?



Regards,
Sebastiaan



smime.p7s
Description: S/MIME Cryptographic Signature


Custom Resource Loading

2009-07-20 Thread Mostafa Mohamed
 Hi. I have 3 questions about resources.

*question 1* I've tried everything i could to make to make this work, but i
failed. it's probably something
that has to do with the context + path that i pass to the folder
constructor. i tried some relative paths,
didn't work too.

protected void int() {
String context = getServletContext().getRealPath(/);
String path = WEB-INF\\classes\\main\\resources;

IResourceStreamLocator locator = new ResourceStreamLocator(new Path(new
Folder(context + path)));
getResourceSettings.setResourceStremLocator(locator);
}

*question 2* this is about the resources folder of the quickstart project.
As you can see from
the code above, i was trying to use it for html/properties files, but i'm
not sure if this is what
it was meant for.

*question 3* i see the point of having the html and java files next to each
other,
but with large projects (with hundreds of pages, panels, custom components
and
resource bundles), this soon leads to a cluttered folder with lots of
html/properties/
java files. how can i overcome this and at the same time keep my html and
java files
next to each other?

Thanks.


Re: Custom Resource Loading

2009-07-20 Thread Mathias Nilsson

Wicket is customized to find the markup and properties in the same package as
the javafile. 
I guess you are not using the default package and therefore you can use java
packages. 

http://www.mkyong.com/wicket/how-do-change-the-html-file-location-wicket/
http://www.mkyong.com/wicket/how-do-change-the-html-file-location-wicket/ 
may be some help to you if you want to customize this setting but I really
don't think this will be an issue if you separate you wicket classes with
packages

-- 
View this message in context: 
http://www.nabble.com/Custom-Resource-Loading-tp24576036p24577173.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Custom Resource Loading

2009-07-20 Thread sky.walker

I plan to keep my java and html files next to each other, I was just curious
as to why this specific peace of code which is the 'wicket in action' way to
load resources didn't work. my guess was that's there's something wrong with
the path, however i'm not sure why.

my project directory structure looks like this:

src
|
|-main
|  |
|  |-java
|  |  |
|  |  |-domain
|  |  |-persistence
|  |  |-services
|  |  `-web (this is where the wicket classes reside)
|  |
|  |-resources (this is where i put my html/properties files in this
example)
|  `-webapp
|
`-test

I surely thought about separating the wicket classes using packages, i
wanted to make sure that this was the best practice. is it? 

I also don't understand why the wicket quickstart project contains a
resources folder if wicket's default is to keep resources next to the java
classes. is it just to separate them at development time and then combine
them at build time?

note: sorry for sending an email, i didn't mean to.

-- 
View this message in context: 
http://www.nabble.com/Custom-Resource-Loading-tp24576036p24577732.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Custom Resource Loading

2009-07-20 Thread Mathias Nilsson

The resource folder is maven layout. maven.apache.org

when building with the quickstart the maven uses this layout. You are not
supposed to add you .properties and .html files here. This is for other
properties and xml like spring, hibernate, peristance etc.


-- 
View this message in context: 
http://www.nabble.com/Custom-Resource-Loading-tp24576036p24577851.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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