2014-02-24 74 views
0

我想通過沙丁魚在JCR repo中添加zip文件。 已經構建了一個小測試用例。通過sardine-webdav -jcr添加zip文件

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(); 
    } 
} 

的問題是,在插入的zip文件的文件結構是源文件,但所有文件的內容(拉鍊內側)的相同缺失。 在這個問題上瘋狂!PLease help !!!!!

回答