Hi,
I am having problem opening a crystal report in PDF format within a browser without embedding the id and password in the URL. I tried using the following logic, and I was able to removed id/pwd info from URL in Adobe 7.0, but in Adobe 6.0 the report just doesnot open. Our client is not open to upgrade to Adobe 7.0. Any ideas/suggestions?
Thanks,
Jennifer.
FYI: Using Crystal server 9.0 on Win 2000 machine. Application(J2EE) on WEbsphere 5.1.1.5 server.
Following Logic(Does remove info in URL in Adobe 7.0, but breaks in 6.0):
OutputStream os = null;
try
{
CrystalServices cs = CrystalServices.getInstance();
String url = cs.getReportUrl(state, reportInfo, reportFormat, param);
URL urlcon = new URL(url);
URLConnection conn = urlcon.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
int length = 0;
length = conn.getContentLength();
if((reportFormat == CIS_REPORT_FORMAT_EXCELSTD) || (reportFormat == CIS_REPORT_FORMAT_EXCELEXT) )
{
httpRpse.setContentType("application/vnd.ms-excel");
}
else if((reportFormat == CIS_REPORT_FORMAT_PDF))
{
httpRpse.setContentType("application/pdf");
}
else
{
httpRpse.setContentType("text/html");
}
DBUG.DBUGLog("Length = " + length);
if(length > 0)
{
httpRpse.setContentLength(length);
}
byte[] buffer = new byte[2048];
int cnt = is.read(buffer, 0,buffer.length);
os = httpRpse.getOutputStream();
int totalCnt = 0;
while (cnt > 0)
{
os.write(buffer,0,cnt);
os.flush();
totalCnt = totalCnt + cnt;
cnt = is.read(buffer, 0,buffer.length);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if( os != null ) {
os.flush();
os.close();
}
}
I am having problem opening a crystal report in PDF format within a browser without embedding the id and password in the URL. I tried using the following logic, and I was able to removed id/pwd info from URL in Adobe 7.0, but in Adobe 6.0 the report just doesnot open. Our client is not open to upgrade to Adobe 7.0. Any ideas/suggestions?
Thanks,
Jennifer.
FYI: Using Crystal server 9.0 on Win 2000 machine. Application(J2EE) on WEbsphere 5.1.1.5 server.
Following Logic(Does remove info in URL in Adobe 7.0, but breaks in 6.0):
OutputStream os = null;
try
{
CrystalServices cs = CrystalServices.getInstance();
String url = cs.getReportUrl(state, reportInfo, reportFormat, param);
URL urlcon = new URL(url);
URLConnection conn = urlcon.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
int length = 0;
length = conn.getContentLength();
if((reportFormat == CIS_REPORT_FORMAT_EXCELSTD) || (reportFormat == CIS_REPORT_FORMAT_EXCELEXT) )
{
httpRpse.setContentType("application/vnd.ms-excel");
}
else if((reportFormat == CIS_REPORT_FORMAT_PDF))
{
httpRpse.setContentType("application/pdf");
}
else
{
httpRpse.setContentType("text/html");
}
DBUG.DBUGLog("Length = " + length);
if(length > 0)
{
httpRpse.setContentLength(length);
}
byte[] buffer = new byte[2048];
int cnt = is.read(buffer, 0,buffer.length);
os = httpRpse.getOutputStream();
int totalCnt = 0;
while (cnt > 0)
{
os.write(buffer,0,cnt);
os.flush();
totalCnt = totalCnt + cnt;
cnt = is.read(buffer, 0,buffer.length);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if( os != null ) {
os.flush();
os.close();
}
}