use of org.apache.jackrabbit.webdav.WebdavRequestContext in project jackrabbit by apache.
the class AbstractReport method normalizeResourceHref.
/**
* Normalize the resource {@code href}. For example, remove contextPath prefix if found.
* @param href resource href
* @return normalized resource {@code href}
*/
protected String normalizeResourceHref(final String href) {
if (href == null) {
return href;
}
final WebdavRequestContext requestContext = WebdavRequestContextHolder.getContext();
final WebdavRequest request = (requestContext != null) ? requestContext.getRequest() : null;
if (request == null) {
log.error("WebdavRequest is unavailable in the current execution context.");
return href;
}
final String contextPath = request.getContextPath();
if (!contextPath.isEmpty() && href.startsWith(contextPath)) {
return href.substring(contextPath.length());
}
return href;
}
use of org.apache.jackrabbit.webdav.WebdavRequestContext in project jackrabbit by apache.
the class AbstractResource method normalizeResourceHref.
/**
* Normalize the resource {@code href}. For example, remove contextPath prefix if found.
* @param href resource href
* @return normalized resource {@code href}
*/
protected String normalizeResourceHref(final String href) {
if (href == null) {
return href;
}
final WebdavRequestContext requestContext = WebdavRequestContextHolder.getContext();
final WebdavRequest request = (requestContext != null) ? requestContext.getRequest() : null;
if (request == null) {
log.error("WebdavRequest is unavailable in the current execution context.");
return href;
}
final String contextPath = request.getContextPath();
if (!contextPath.isEmpty() && href.startsWith(contextPath)) {
return href.substring(contextPath.length());
}
return href;
}
Aggregations