Hi,
Please tell me the sequence of steps for access csv file from contentspace. I do some code it was working fine for pdf file but it is not wokring out for csv/xsl file which is reside in contentspace. Here i am pasting the code please help me it is urgent.
try
{
// Set connection properties required to invoke LiveCycle ES2
Properties connectionProps =
new Properties();
connectionProps.setProperty(
ServiceClientFactoryProperties.
DSC_DEFAULT_EJB_ENDPOINT,
"t3://3.209.176.248:8001"); // t3://3.232.185.164:8010
connectionProps.setProperty(
ServiceClientFactoryProperties.
DSC_TRANSPORT_PROTOCOL,
ServiceClientFactoryProperties.
DSC_EJB_PROTOCOL);
connectionProps.setProperty(
ServiceClientFactoryProperties.
DSC_WEBLOGIC_SERVER_TYPE,
"WebLogic");
connectionProps.setProperty(
"java.naming.factory.initial",
"weblogic.jndi.WLInitialContextFactory");
connectionProps.setProperty(
ServiceClientFactoryProperties.
DSC_CREDENTIAL_USERNAME,
"administrator");
connectionProps.setProperty(
ServiceClientFactoryProperties.
DSC_CREDENTIAL_PASSWORD,
"password");
// Create a ServiceClientFactory object
ServiceClientFactory myFactory = ServiceClientFactory
.createInstance(connectionProps);
DocumentManagementServiceClientImpl docManager =
new DocumentManagementServiceClientImpl(myFactory);
String storeName =
"SpacesStore";
String nodeName =
null;
nodeName =
"/Company Home/ReportScheduler/" + reportType.trim()+"/"+ filename;
myFile =
new File(filename);
CRCResult content = docManager.retrieveContent(storeName, nodeName,
"");
Document doc = content.getDocument();
System.
out.println(content.getDocument());
System.
out.println(doc.length());
doc.copyToFile(myFile);
System.
out.println(myFile.length());
outStream = response.getOutputStream();
byte[] buf = new byte[8192];
inStream = new FileInputStream(myFile);
int sizeRead = 0;
response.setHeader(
"Content-Disposition","attachment;filename="+myFile.getName());
response.setHeader(
"Content-Disposition","attachment; filename=\"" + myFile + "\"");
response.setHeader(
"Cache-Control", "no-cache");
response.setContentType(
"application/vnd.ms-excel" );
response.setHeader(
"pragma", "public");
response.setHeader(
"Content-Encoding", "UTF-8");
while ((sizeRead = inStream.read(buf, 0, buf.length)) > 0) {
outStream.write(buf, 0, sizeRead);
System.
out.println("sizeRead******* "+ sizeRead);
}
}
catch (Exception e) {
e.printStackTrace();
}
finally{
inStream.close();
outStream.close();
}
Thanks,
Srujan
Views
Replies
Total Likes