سؤال

I am aware that similar problems are asked frequently. But the solutions do not work form me. I did try jcifs.jar (version 1.3.17). Here I found that it is extremly slow and for some reason simply hangs sometimes. Since I am desperate enough I could cope with extremly slow(and pray with unreliable). But now I have also the problem that I need to zip some contents that are on the network drive. This will not work with jcifs or I don't know how. My optimal solution is for copy to call a .bat which will do the copy (this is not working because it can't find the drive). And call 7za.exe to zip it (will not find drive). Example code:

public static int SevenZip(String source, String dest, ServletContext context) throws IOException, InterruptedException
{
    String zipFile = "\"" + context.getRealPath("") + "\\WEB-INF\\7za.exe\"";

    String zipInstruction = zipFile + " a " + dest + " " + source;
    Logger.getAnonymousLogger().info(zipInstruction);

    Process process = Runtime.getRuntime().exec(zipInstruction);
    StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERR");
    StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), "OUT");
    errorGobbler.start();
    outputGobbler.start();

    return process.waitFor();
}

The code will work if not done as a servlet. Ignore StreamGobbler it just takes the error and output stream from process. I somewhere read that it is possible to set tomcat to windows authentication but I don't understand where and how. Will this help me? And how?

هل كانت مفيدة؟

المحلول

I couldn't find an alternative to jcifs. The result is not optimal but it seems to be okay. I don't think it is the fault of jcif more the network and I have no influence on that.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top