/** * Sets the "WWW-Authenticate" header and writes the appropriate error * to the given webdav response. * * @param request The webdav request. * @param response The webdav response. * @param error The DavException that leads to the unauthorized response. * @throws IOException */ protected void sendUnauthorized(WebdavRequest request, WebdavResponse response, DavException error) throws IOException { response.setHeader("WWW-Authenticate", getAuthenticateHeaderValue()); if (error == null || error.getErrorCode() != HttpServletResponse.SC_UNAUTHORIZED) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } else { response.sendError(error.getErrorCode(), error.getStatusPhrase()); } }
/** * Sets the "WWW-Authenticate" header and writes the appropriate error * to the given webdav response. * * @param request The webdav request. * @param response The webdav response. * @param error The DavException that leads to the unauthorized response. * @throws IOException */ protected void sendUnauthorized(WebdavRequest request, WebdavResponse response, DavException error) throws IOException { response.setHeader("WWW-Authenticate", getAuthenticateHeaderValue()); if (error == null || error.getErrorCode() != HttpServletResponse.SC_UNAUTHORIZED) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } else { response.sendError(error.getErrorCode(), error.getStatusPhrase()); } }