response.sendRedirect(redirect);
return;
}
// get request target
Location target;
try {
target = new Location(path);
} catch (DBException e) {
log.error("Unable to process request '" + path + "'", e);
throw new ServletException(e);
}
// get viewer parameter (missing if DAV request)
String viewer = request.getParameter("viewer");
// WebDAV requests do not have viewer parameter, nor can not GET a collection
if (viewer == null && !(path.endsWith("/") && method.equalsIgnoreCase("GET"))) {
DAVComponent m = webAdmin.getMethod(method);
if (m == null) {
// method is not supported
if (log.isInfoEnabled()) {
log.info("Method " + method + " is not supported.");
}
response.setStatus(WebdavStatus.SC_NOT_IMPLEMENTED);
return;
}
m.execute(new DAVRequest(request), new DAVResponse(response), target);
return;
}
// HTML requests are all the rest
Collection col = target.getCollection();
String resource = target.getName();
if (col == null) {
// redirect if path is not '/'
if (!path.equals("/")) {
String redirect = request.getContextPath() + request.getServletPath() + "/?viewer=" + viewer;
response.sendRedirect(redirect);