In Apache Wicket, the framework expects the HTML templates to mirror the class-file directory structure. The example below allows you to define a different path for your HTML files.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class PathStripperLocator extends ResourceStreamLocator {
public PathStripperLocator() {
}
public IResourceStream locate(final Class clazz, final String path) {
IResourceStream located = super.locate(clazz, trimFolders(path));
if (located != null) {
return located;
}
return super.locate(clazz, path);
}
private String trimFolders(String path) {
return path.substring(path.lastIndexOf("/") + 1);
}
}
1
2
3
4
5
6
7
8
public class MyApplication extends AuthDataApplication {
@Override
protected void init() {
super.init();
IResourceSettings resourceSettings = getResourceSettings();
resourceSettings.addResourceFolder("src/main/webapp"); //this path should be changed
resourceSettings.setResourceStreamLocator(new PathStripperLocator());
}
(via wicket wiki)