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!!!!!