Hello Edgar,
> I think I'm missing something: since every WebPage in wicket has
straight access to resources located in the web root (that is, every
path reference in the page's markup is relative to the web root)
Wicket is able to locate resources outside of the web application: This
could be done by implementing an own IResourceFinder:
public final class FileSystemResourceFinder implements IResourceFinder {
private final Resource resource;
public FileSystemResourceFinder(Resource resource) {
this.resource = resource;
}
@Override
public IResourceStream find(Class<?> clazz, String pathname) {
try {
final File file = new File(resource.getFile(), pathname);
if (file.exists()) {
return new FileResourceStream(file);
}
} catch (final IOException e) {
// ignore, file couldn't be found
}
return null;
}
}
At least you've to add the resource finder to the resource finders list
with getResourceSettings().setResourceFinders(resourceFinderList) in
your applications init method. Alternatively, implement a custom
ResourceStreamLocator. At first the Locator should use the
FileSystemResourceFinder - if there's no match the locator should
fallback to wicket's default resource finder. So far, your application
is able to locate resources from the local file system.
> I would like to avoid using folders to organise html files so the
designers can put all the resources they need in their root folder. The
mechanism you describe, seems to use folders, how are you managing this
for the designers?
We thought the same - but this not
<http://www.dict.cc/englisch-deutsch/manageable.html>manageable with
more than 50 files in one folder. So we decide to use folders - as
already mentioned. Perhaps I'll write a tutorial...
Best regards,
Jan
On 12/05/2012 02:49 PM, Edgar Merino wrote:
Hello Jan, that seems like a good approach. However, I think I'm
missing something: since every WebPage in wicket has straight access
to resources located in the web root (that is, every path reference in
the page's markup is relative to the web root), I would like to avoid
using folders to organize html files so the designers can put all the
resources they need in their root folder. The mechanism you describe,
seems to use folders, how are you managing this for the designers?
Edgar Merino
On 04/12/12 04:15, Jan Riehn wrote:
Hello Edgar,
Yes, this is how it works.
For the best separation of the responsibilities, you may store the
resources outside of the web application (Think about a complete
physical separation).
We've made a good experience to break-off with wicket's given package
structure - wicket’s resource localization does not fit with a
separation of the responsibilities: the web designer has no knowledge
about the internal package structure and it's not resistant against
refactoring. Therefore, we use a more technical mechanism based on
style, variation locale and the filename.
1. <prefix>/<style>/<variation>/<locale>/<filename>.<extension>
2. <prefix>/<style>/<variation>/<filename>.<extension>
3. <prefix>/<style>/<filename>.<extension>
4. <prefix>/<filename>.<extension>
5. <filename>.<extension>
Best regards,
Jan
On 12/04/2012 09:04 AM, Edgar Merino wrote:
Hello, I would like our designers to work with a simple folder structure
on our application pages markup, and we would like to avoid including
java source code files with the files we share with them. What is the
best way to do this? I though about implementing a custom
ResourceStreamLocator, so I can for instance name our html files using
the fqcn e.g. my.company.HomePage.html and placing these files in the
default package (under src/main/html for example).
Is this the way to go?
Thanks in advance,
Edgar Merino
---------------------------------------------------------------------
To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org
For additional commands, e-mail:users-h...@wicket.apache.org