use of org.apache.wicket.request.mapper.IRequestMapperDelegate in project wicket by apache.
the class WebApplication method unmount.
/**
* Unregisters all {@link IRequestMapper}s which would match on a this path.
* <p>
* Useful in OSGi environments where a bundle may want to update the mount point.
* </p>
*
* @param path
* the path to unmount
*/
public void unmount(String path) {
Args.notNull(path, "path");
if (path.charAt(0) == '/') {
path = path.substring(1);
}
IRequestMapper mapper = getRootRequestMapper();
while (mapper instanceof IRequestMapperDelegate) {
mapper = ((IRequestMapperDelegate) mapper).getDelegateMapper();
}
/*
* Only attempt to unmount if root request mapper is either a compound, or wraps a compound to avoid leaving the
* application with no mappers installed.
*/
if (mapper instanceof ICompoundRequestMapper) {
final Url url = Url.parse(path);
Request request = new Request() {
@Override
public Url getUrl() {
return url;
}
@Override
public Url getClientUrl() {
return url;
}
@Override
public Locale getLocale() {
return null;
}
@Override
public Charset getCharset() {
return null;
}
@Override
public Object getContainerRequest() {
return null;
}
};
unmountFromCompound((ICompoundRequestMapper) mapper, request);
}
}
Aggregations