But you don't need to set this explicitly right?
getSettings().addResourcePath("...") should suffice, as the webapplication context will be tried anyway.

  protected void init() {
String root = getWicketServlet().getServletContext().getRealPath("/WEB-INF");
      getSettings().addResourceFolder(root);
  }

is the same as

  protected void init() {
     getSettings().addResourceFolder("WEB-INF");
  }

as the relative path (note the ommission of the first slash) is tried when the given string doesn't resolve to a normal file.

The inconsistency here is that addResourceFolder("") /WILL NOT/ reference you webapplication path, as it is tried like this:

       final Folder f = new Folder(folder);
       if (f.exists())
       {

where f.exists() will most certainly resolve to true, as it points to your current application path (e.g. $TOMCAT_HOME$).

I guess we can't fix this though. Any ideas?

Eelco


Johan Compagner wrote:

if you do / then it is the root of youre webapplication.
(just print out a log line of that root it should show you that)

johan


Geertjan Wielenga wrote:



So is this supposed to work in order to customize the lookup paths in 1.0:

   protected void init() {
String root = getWicketServlet().getServletContext().getRealPath("/");
       getSettings().addResourceFolder(root);
   }

It doesn't work for me. What does "/" refer to? The "web" folder? Or "web-inf"? Or something else?

-- Geertjan


Eelco Hillenius wrote:

Vince Marco wrote:

I never used that option myself before, but I tried it out and it worked
 like a baby.

 I wrote it down as a how-to in our Wiki. Please see:
 http://wicket.sourceforge.net/wiki/index.php/Custom_resource_paths


Thank you very much. Hadn't thought to move the setting to init(). One note is that your example sets up a variable called webinf, but you are actually referring to the web root. It is a bit misleading as WEB-INF is not the web root.





Oops. Sorry about that. Fixed now.


Also, this example produces an exception when deployed as a .war (didn't check a folder) into JBoss 4.0.1. The exception I get is:

2005-05-30 15:49:22,920 ERROR [org.jboss.web.localhost.Engine] ----- Root Cause -----
java.lang.IllegalArgumentException: URI scheme is not "file"
        at java.io.File.<init>(File.java:324)
        at wicket.util.file.File.<init>(File.java:83)
        at wicket.util.file.Folder.<init>(Folder.java:75)
        at reverect.web.ReverectWebapp.init(ReverectWebapp.java:33)

Any suggestions?


*Big oops*. That's nasty. Seems that Wicket depends on java.io.File while it should use java.net.URL instead (that's also according to the Servlet specs). I am quite suprised this didn't show up any earlier.

I opened an issue for it with the highest priority (for 1.0) at http://sourceforge.net/tracker/index.php?func=detail&aid=1211638&group_id=119783&atid=684975. I'm not sure how difficult it will be, but we'll try to fix this shortly.

Regards,

Eelco




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user







-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user






-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to