"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main/java/com/openkm/servlet/frontend/DownloadServlet.java" between
OpenKM-document-management-system-6.3.10.tar.gz and OpenKM-document-management-system-6.3.11.tar.gz

About: OpenKM (Knowledge Management) is a document management system that allows easy management of documents, users, roles and finding your enterprise documents and records. Community version (source code).

DownloadServlet.java  (OpenKM-document-management-system-6.3.10):DownloadServlet.java  (OpenKM-document-management-system-6.3.11)
skipping to change at line 24 skipping to change at line 24
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* <p> * <p>
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
package com.openkm.servlet.frontend; package com.openkm.servlet.frontend;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.openkm.api.OKMDocument; import com.openkm.api.OKMDocument;
import com.openkm.api.OKMMail; import com.openkm.api.OKMMail;
import com.openkm.api.OKMRepository; import com.openkm.api.OKMRepository;
import com.openkm.api.OKMSearch; import com.openkm.api.OKMSearch;
import com.openkm.bean.Document; import com.openkm.bean.Document;
import com.openkm.bean.Mail; import com.openkm.bean.Mail;
import com.openkm.bean.Repository; import com.openkm.bean.Repository;
import com.openkm.bean.Version; import com.openkm.bean.Version;
import com.openkm.core.*; import com.openkm.core.*;
import com.openkm.frontend.client.OKMException; import com.openkm.frontend.client.OKMException;
import com.openkm.frontend.client.constants.service.ErrorCode; import com.openkm.frontend.client.constants.service.ErrorCode;
import com.openkm.util.*; import com.openkm.util.*;
import com.openkm.util.impexp.RepositoryExporter; import com.openkm.util.impexp.RepositoryExporter;
import com.openkm.util.impexp.TextInfoDecorator; import com.openkm.util.impexp.TextInfoDecorator;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* Document download servlet * Document download servlet
*/ */
public class DownloadServlet extends OKMHttpServlet { public class DownloadServlet extends OKMHttpServlet {
private static Logger log = LoggerFactory.getLogger(DownloadServlet.class ); private static Logger log = LoggerFactory.getLogger(DownloadServlet.class );
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final boolean exportZip = true; private static final boolean exportZip = true;
private static final boolean exportJar = false; private static final boolean exportJar = false;
skipping to change at line 222 skipping to change at line 219
IOUtils.closeQuietly(is); IOUtils.closeQuietly(is);
FileUtils.deleteQuietly(tmp); FileUtils.deleteQuietly(tmp);
} }
log.debug("service: void"); log.debug("service: void");
} }
/** /**
* Generate a zip file from a repository folder path * Generate a zip file from a repository folder path
*/ */
private void exportFolderAsZip(String fldPath, OutputStream os) throws Pa private void exportFolderAsZip(String fldPath, OutputStream os) throws PathN
thNotFoundException, AccessDeniedException, otFoundException, AccessDeniedException,
RepositoryException, ArchiveException, ParseException, No RepositoryException, ParseException, NoSuchGroupException
SuchGroupException, IOException, DatabaseException, MessagingException { , IOException, DatabaseException, MessagingException,
LockException {
log.debug("exportFolderAsZip({}, {})", fldPath, os); log.debug("exportFolderAsZip({}, {})", fldPath, os);
StringWriter out = new StringWriter(); StringWriter out = new StringWriter();
FileOutputStream fos = null; FileOutputStream fos = null;
InputStream is = null; InputStream is = null;
File tmp = null; File tmp = null;
try { try {
tmp = FileUtils.createTempDir(); tmp = FileUtils.createTempDir();
if (fldPath.startsWith("/" + Repository.CATEGORIES)) { if (fldPath.startsWith("/" + Repository.CATEGORIES)) {
skipping to change at line 266 skipping to change at line 264
FileUtils.deleteQuietly(tmp); FileUtils.deleteQuietly(tmp);
} }
log.debug("exportFolderAsZip: void"); log.debug("exportFolderAsZip: void");
} }
/** /**
* Generate a zip file from a list of documents * Generate a zip file from a list of documents
*/ */
private void exportDocumentsAsZip(List<String> paths, OutputStream os, St ring zipname) throws PathNotFoundException, private void exportDocumentsAsZip(List<String> paths, OutputStream os, St ring zipname) throws PathNotFoundException,
AccessDeniedException, RepositoryException, ArchiveExcept AccessDeniedException, RepositoryException, ParseExceptio
ion, ParseException, NoSuchGroupException, IOException, n, NoSuchGroupException, IOException, DatabaseException,
DatabaseException { LockException {
log.debug("exportDocumentsAsZip({}, {})", paths, os); log.debug("exportDocumentsAsZip({}, {})", paths, os);
StringWriter out = new StringWriter(); StringWriter out = new StringWriter();
File tmp = null; File tmp = null;
try { try {
tmp = FileUtils.createTempDir(); tmp = FileUtils.createTempDir();
File fsPath = new File(tmp.getPath()); File fsPath = new File(tmp.getPath());
// Export files // Export files
for (String docPath : paths) { for (String docPath : paths) {
skipping to change at line 299 skipping to change at line 297
FileUtils.deleteQuietly(tmp); FileUtils.deleteQuietly(tmp);
} }
log.debug("exportDocumentsAsZip: void"); log.debug("exportDocumentsAsZip: void");
} }
/** /**
* Generate a jar file from a repository folder path * Generate a jar file from a repository folder path
*/ */
private void exportFolderAsJar(String fldPath, OutputStream os) throws Pa thNotFoundException, AccessDeniedException, private void exportFolderAsJar(String fldPath, OutputStream os) throws Pa thNotFoundException, AccessDeniedException,
RepositoryException, ArchiveException, ParseException, No SuchGroupException, IOException, DatabaseException, MessagingException { RepositoryException, ParseException, NoSuchGroupException , IOException, DatabaseException, MessagingException {
log.debug("exportFolderAsJar({}, {})", fldPath, os); log.debug("exportFolderAsJar({}, {})", fldPath, os);
StringWriter out = new StringWriter(); StringWriter out = new StringWriter();
File tmp = null; File tmp = null;
try { try {
tmp = FileUtils.createTempDir(); tmp = FileUtils.createTempDir();
// Export files // Export files
RepositoryExporter.exportDocuments(null, fldPath, tmp, fa lse, false, out, new TextInfoDecorator(fldPath)); RepositoryExporter.exportDocuments(null, fldPath, tmp, fa lse, false, out, new TextInfoDecorator(fldPath));
 End of changes. 5 change blocks. 
24 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)