@Inject protected WebdavServlet(ResourceFactory fact, Injector injector, Objectify ofy) { inj = injector; WebdavUserSecurityManager sm = inject(new WebdavUserSecurityManager(ofy)); NonceProvider np = new AppEngineMemcacheNonceProvider(10 * 60 * 60); List<AuthenticationHandler> authHandlers = new ArrayList<AuthenticationHandler>(); authHandlers.add(new SecurityManagerBasicAuthHandler(sm)); authHandlers.add(new SecurityManagerDigestAuthenticationHandler(np, sm)); AuthenticationService authSvc = new AuthenticationService(authHandlers); DefaultWebDavResponseHandler respHandler = new DefaultWebDavResponseHandler(authSvc); respHandler.setBuffering(BUFFERING.always); httpManager = new ServletHttpManager(fact, respHandler, authSvc); httpManager.addFilter(0, new PreAuthenticationFilter(respHandler, sm, np)); }
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { Request request = new ServletRequest(req); Response response = new ServletResponse(resp); WebdavServlet.request.set(request); WebdavServlet.response.set(response); WebdavServlet.originalRequest.set(req); WebdavServlet.originalResponse.set(resp); httpManager.process(request, response); } finally { originalRequest.remove(); originalResponse.remove(); request.remove(); response.remove(); resp.getOutputStream().flush(); resp.flushBuffer(); } }