cancel
Showing results for 
Search instead for 
Did you mean: 

resource.down() problem

0 Kudos


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

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Answers (3)

Answers (3)

amol_gaddamwar
Explorer
0 Kudos

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

0 Kudos

Hi Amol,

Security setting of Internet Explorer has been set to enable Automatic popup, and it still doesn't work.

I'll ask basis for help on security domain setting. Once there is any feeback, I will update you.

Thanks,

David

junwu
Active Contributor
0 Kudos

the url of the resource may be not accessible,

can you print the url of the resource? maybe you can find something

0 Kudos

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.

junwu
Active Contributor
0 Kudos

maybe the network issue, just like how you publish the external url, you have to the same for this url

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

Hi David,

While you are calling resource.download(),the browse window (browse the place in your system where you want to store the file) is not popping up?

Thanks,

Patralekha

0 Kudos

Hi Patralekha,

No download window pops up when resource.download() is executed. I print some logs step by step to check my codes, it did execute the codes and no exception was thrown.

Former Member
0 Kudos

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

0 Kudos

Hi Patralekha,

These settings of IE are all enabled, but it still doesn't work.

I am going to check security domain setting according to Amol's advice.

Thanks a lot for your effort.

Best Regards,

David