Versions Compared

Key

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

...

Code Block
public class CizelgemApplication extends AuthDataApplication {
    @Override
    protected void init() {
        super.init();
        CompoundResourceStreamLocator locator = 
            (CompoundResourceStreamLocator)getResourceSettings().getResourceStreamLocator();
        WebApplicationPath resourceFinder = (WebApplicationPath) getResourceSettings().getResourceFinder();
        resourceFinder.add("src/main/webapp"); //this path should be changed

        locator.add(0, new WebPageResourceStreamLocator(resourceFinder));
    }

Mert Nuhoglu

In Wicket 1.3

1.2 instructions updated for 1.3:

Firstly, define the new IResourceStreamLocator class:

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) {
        return path.substring(path.lastIndexOf("/") + 1);
    }
}

Secondly, override Application.init() method to add the new IResourceStreamLocator:

Code Block

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

David Rosenstrauch