use of org.olat.core.util.io.HttpServletResponseOutputStream in project OpenOLAT by OpenOLAT.
the class RepositoryEntryImportExport method exportDoExportContent.
/**
* Export a repository entry referenced by a course node to the given export directory.
* User importReferencedRepositoryEntry to import again.
* @return True upon success, false otherwise.
*/
public boolean exportDoExportContent() {
// export resource
RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(re);
MediaResource mr = rh.getAsMediaResource(re.getOlatResource(), false);
FileOutputStream fOut = null;
try {
fOut = new FileOutputStream(new File(baseDirectory, CONTENT_FILE));
InputStream in = mr.getInputStream();
if (in == null) {
HttpServletResponse hres = new HttpServletResponseOutputStream(fOut);
mr.prepare(hres);
} else {
IOUtils.copy(mr.getInputStream(), fOut);
}
fOut.flush();
} catch (IOException fnfe) {
return false;
} finally {
IOUtils.closeQuietly(fOut);
mr.release();
}
return true;
}
use of org.olat.core.util.io.HttpServletResponseOutputStream in project openolat by klemens.
the class RepositoryEntryImportExport method exportDoExportContent.
/**
* Export a repository entry referenced by a course node to the given export directory.
* User importReferencedRepositoryEntry to import again.
* @return True upon success, false otherwise.
*/
public boolean exportDoExportContent() {
// export resource
RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(re);
MediaResource mr = rh.getAsMediaResource(re.getOlatResource(), false);
FileOutputStream fOut = null;
try {
fOut = new FileOutputStream(new File(baseDirectory, CONTENT_FILE));
InputStream in = mr.getInputStream();
if (in == null) {
HttpServletResponse hres = new HttpServletResponseOutputStream(fOut);
mr.prepare(hres);
} else {
IOUtils.copy(mr.getInputStream(), fOut);
}
fOut.flush();
} catch (IOException fnfe) {
return false;
} finally {
IOUtils.closeQuietly(fOut);
mr.release();
}
return true;
}
Aggregations