// request to the "root", redirect to the default workspace if
// directly addressing the servlet and if the default workspace name
// is not null (in which case we'd need to login to find out the
// actual workspace name, SLING-256)
SlingRepository slingRepo = (SlingRepository) getRepository();
if (slingRepo.getDefaultWorkspace() == null) {
// if we don't have a default workspace to redirect to, we
// cannot handle the request and fail with not found
response.sendError(
HttpServletResponse.SC_NOT_FOUND,
"JCR workspace name required, please add it to the end of the URL"
+ " (for the Jackrabbit embedded repository the default name is 'default') ");
} else {
// else redirect to the same URI with the default workspace
// appended
String uri = request.getRequestURI();
if (pinfo == null) {
uri += "/";
}
uri += slingRepo.getDefaultWorkspace();
response.sendRedirect(uri);
}
}
}