// set default headers
response.addHeader("Cache-Control", "private, max-age=0");
response.addHeader("Server", ServerVersion.OPENCMIS_SERVER);
// create a context object, dispatch and handle exceptions
CallContext context = null;
try {
context = HttpUtils.createContext(request, response, getServletContext(), CallContext.BINDING_BROWSER,
callContextHandler, tempDir, memoryThreshold);
dispatch(context, request, response);
} catch (Exception e) {
if (e instanceof CmisPermissionDeniedException) {
if (context == null || context.getUsername() == null) {
response.setHeader("WWW-Authenticate", "Basic realm=\"CMIS\"");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authorization Required");
} else {
printError(e, request, response, context);
}