on 12-16-2013 8:32 AM
Dear all,
We are now using CE 7.3 to develop web dynpro java applications and everything runs ok in our internal network. But recently we publish a eternal url for users and we use a DNS to parse the url to point to the internal address, and we encounter a problem, as follow:
we use resource.download() to export excel, but it doesn't work after we use the eternal url. So we check our code first,
version1:
IWDResource resource = WDResourceFactory.createResource(inputStream, "XXX.xls", WDWebResourceType.XLS, false);
resource.download() ;
version2:
IWDResource resource = WDResourceFactory.createResource(inputStream, "XXX.xls", WDWebResourceType.XLS, true);
resource.download() ;
version3:
IWDResource resource = WDResourceFactory.createCachedResource(inputStream, "XXX.xls", WDWebResourceType.XLS, false);
resource.download() ;
Dear all,
This problem was finally solved by changing another server, I think it may caused by some network setting and other unknown factors. Thanks for all of your kind help.
Best Regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Check you Internet Explorer setting security setting. Popup may be blocked or file download is disabled or Automatic popup for file download is disabled.
Make sure your internal URL and external URL are running in the same security domain like both are in Internet or Local intranet or Trusted sites.
Regards,
Amol
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the url of the resource may be not accessible,
can you print the url of the resource? maybe you can find something
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jun,
I think you find the problem. I add codes to print the url and then past it in IE, the one comes from internal network is ok (a download window pops up), while the other failed (IE showed a 500 error code, which means the url can not be reached).
I am now still working on this problem, do you have any suggestion?
Thanks.
the 3 code version are all not OK if we use the external url, but other functions of web dynpro codes run well.
Could you please give me some advices about this problem?
Thanks a lot.
David Chen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Can you please check how you are reading the inputStream?
As I think your code is fine.
String strpath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), "XXX.xls");
InputStream inputStream= new FileInputStream(strpath);
IWDResource resource = WDResourceFactory.createResource(inputStream, "XXX.xls", WDWebResourceType.XLS, true);
Thanks,
Patralekha
Hi Patralekha,
Thanks for your quick reply! Here are my codes as below:
1. get a excel template
String filePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart().getWebModule(),
"Components/excelTemplate.xls");
InputStream templatestream= new FileInputStream(new File(filePath));
2. add data to the excel template
Workbook templateWorkbook = Workbook.getWorkbook(templatestream);
ByteArrayOutputStream targetFile = new ByteArrayOutputStream();
WritableWorkbook wwb = Workbook.createWorkbook(targetFile, templateWorkbook);
WritableSheet sheet = wwb.getSheet(0); /
//codes of rendering an excel omitted
wwb.write();
templateWorkbook.close();
wwb.close();
3. create a new input stream
InputStream newInputStream = new ByteArrayInputStream(targetFile.toByteArray());
4. download the resource
if(newInputStream!=null){
IWDResource resource = WDResourceFactory.createCachedResource(newExcel, "XXX.xls", WDWebResourceType.XLS, true);
resource.download() ;
}
Thanks,
David
Hi David,
You can check following options are enable in Internet Explorer:
Go to Internet Explorer(7 or onward)
Tools->Internet Option->Security->Internet->Custom Level->Downloads->Automatic Prompting for File Downloads->Enable->OK
Tools->Internet Option->Security->Trusted Sites->Custom Level->Downloads->Automatic Prompting for File Downloads->Enable->OK
Let me know if these options are already enabled,then we can check in other aspects.
Thanks,
Patralekha Sur
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.