Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public class PathStripperLocator extends ResourceStreamLocator {

    public PathStripperLocator(IResourceFinder finder) {
        super(finder);
    }

    public IResourceStream locate(final Class clazz, final String path) {
        return super.locate(clazz, trimFolders(path));
    }

    private String trimFolders(String path) {
        if (path.startsWith("org/apache/wicket")) {
            return path;
        }
        return path.substring(path.lastIndexOf("/") + 1);
    }
}

...

Code Block
public class CizelgemApplication extends AuthDataApplication {
    @Override
    protected void init() {
        super.init();
        IResourceSettings resourceSettings = app.getResourceSettings();
        WebApplicationPath resourceFinder = (WebApplicationPath)resourceSettings.getResourceFinder();
        resourceFinder.add(addResourceFolder("src/main/webapp"); //this path should be changed
        resourceSettings.setResourceStreamLocator(new PathStripperLocator(resourceFinder));
    }

David Rosenstrauch