Question

I am trying to add a zip file via sardine in a JCR repo. Have built a small test case .

    public void getFileTest() {
    String baseUrl = "http://localhost:8380/jackrabbit/repository";
    Sardine sardine = SardineFactory.begin("guest", "guest");
    ContentLengthInputStream is = null;
    DefaultHttpClient httpClient = new DefaultHttpClient();
    HttpParams httpParams = httpClient.getParams();
    HttpConnectionParams.setConnectionTimeout(httpParams, this.connectTimeout);
    HttpConnectionParams.setSoTimeout(httpParams, this.socketTimeout);
    HttpConnectionParams.setStaleCheckingEnabled(httpParams, true);
    SardineImpl sar = new SardineImpl(httpClient);
    sar.setCredentials("guest", "guest");

    try {
    java.io.File file = new java.io.File("D:\\Software\\vfabric-tc-server-developer-2.7.0.RELEASE\\lcs_campus\\webapps\\learningPlatform\\static\\dummyInlineAuthoringContent.zip");
    FileInputStream fis=new FileInputStream(file);
    MimetypesFileTypeMap mimeType = new MimetypesFileTypeMap();
    byte[] byteArray=IOUtils.toByteArray(fis);
    sar.put(baseUrl + "/content/a/d/admin-admin-admin--admin-admin-admin/Library/rejesh1/dummyInline233.txt",byteArray);
    fis.close();    
    } catch (IOException e) {
        e.printStackTrace();
    }
}

The problem is that the file structure in the inserted zip file is same as that of the source file but the contents of all the files(Inside the zip) is missing. Going crazy over the issue!..PLease help!!!!!

Was it helpful?

Solution

As default, Jackrabbit tries to process uploaded zip-files, which may lead to problems for larger files than just some kB. You can change this in Jackrabbits WEB-INF/config.xml, just comment out the zip-manager there.

You can find this in a little more detail here: http://juergen-baier.com/2014/04/19/uploading-zip-files-to-jackrabbit-via-webdav/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top