You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mostafa Mohamed <es...@gmail.com> on 2009/07/20 21:27:52 UTC

Custom Resource Loading

 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

Posted by Mathias Nilsson <wi...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Custom Resource Loading

Posted by "sky.walker" <es...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Custom Resource Loading

Posted by Mathias Nilsson <wi...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org