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.
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); } } |
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)

{ 2 comments… read them below or add one }
Any idea about how to achieve this also for css or other files stored under src/main/resources/com/myapp/… ?
This could help …
WebApplicationPath paths = new WebApplicationPath(getServletContext());
paths.add(“”);
paths.add(“/html”);
paths.add(“/images”);
paths.add(“/js”);
paths.add(“/styles”);
getResourceSettings().setResourceStreamLocator(new ResourceStreamLocator(paths));