//Can be null when using standalone context.
final String contextPath = context.getRequest() != null ? context.getRequest().getContextPath() : null;
final RewriterContext rewriterContext = new RewriterContext().setAggregatedFolderPath(
context.getAggregatedFolderPath()).setProxyPrefix(getUrlPrefix()).setContextPath(contextPath);
return new ImageUrlRewriter(rewriterContext).rewrite(cssUri, imageUrl);
}