public void releaseSession(WebdavRequest request) { ConfluenceDavSession confluenceDavSession = (ConfluenceDavSession) request.getDavSession(); if (null != confluenceDavSession) { confluenceDavSession.setCurrentlyBeingUsed(false); /* To update the session map cache - Modified cached objects need to be put-back. */ setConfluenceDavSessionIntoSessionMap(confluenceDavSession); } AuthenticatedUserThreadLocal.setUser(null); request.setDavSession(null); }
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { AuthenticatedUserThreadLocal.setUser(remoteUser); RequestCacheThreadLocal.getRequestCache().put(RequestCacheThreadLocal.CONTEXT_PATH_KEY, contextPath); PdfExportProgressMonitor monitor = flyingPdfExporterService.createProgressMonitor(progress); File pdfFile; try { monitor.beginCalculationOfContentTree(); Space space = spaceManager.getSpace(spaceId); ContentTree contentTree = importExportManager.getContentTree(remoteUser, space); if (!contentToBeExported.isEmpty()) { contentTree.filter(contentToBeExported); } monitor.completedCalculationOfContentTree(contentTree.size()); pdfFile = flyingPdfExporterService.createPdfForSpace(remoteUser, space, contentTree, monitor, contextPath, new SpaceExportMetrics()); downloadPath = importExportManager.prepareDownloadPath(pdfFile.getAbsolutePath()); gateKeeper.addKey(downloadPath, remoteUser); downloadPath = contextPath + downloadPath; monitor.completed(downloadPath); } catch (Exception ex) { log.error("Error during PDF export", ex); String exceptionMessage = ex.getMessage(); if (StringUtils.isBlank(exceptionMessage)) exceptionMessage = ex.getClass().getName(); monitor.errored(exceptionMessage); } } });
public boolean attachSession(WebdavRequest request) throws DavException { ConfluenceDavSession confluenceDavSession = getConfluenceDavSession(request); if (null == confluenceDavSession) { log.debug("Looks like this request is not authenticated. We'll try to authenticate our user now."); confluenceDavSession = authenticate(request); } confluenceDavSession.setUserAgent(request.getHeader(WebdavConstants.HEADER_USER_AGENT)); confluenceDavSession.updateActivityTimestamp(); confluenceDavSession.setCurrentlyBeingUsed(true); setConfluenceDavSessionIntoSessionMap(confluenceDavSession); setConfluenceDavSessionIntoHttpSession(request, confluenceDavSession); request.setDavSession(confluenceDavSession); AuthenticatedUserThreadLocal.setUser(userAccessor.getUser(confluenceDavSession.getUserName())); return true; }