IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Download - not export table - files from portal-portlet

    Posted Mon August 23, 2010 05:38 PM

    I see that Designer has controls to export a table to a .csv file, and to upload a file from a user’s desk.
    I need to write a portlet that allows external users to select and download files of different formats (.xls, .pdf, .doc, …).
    Has anyone written download functionality for a portlet?


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 2.  RE: Download - not export table - files from portal-portlet

    Posted Tue August 24, 2010 03:43 PM

    I just had to do this yesterday. I used streamFileDataToResponse(FileContentExportBean). Here is the relevant code:

    File f = new File(“HelloMe.pdf”);
    boolean forceDownload = true;
    FileContentExportBean eb = new FileContentExportBean(f, forceDownload);
    streamFileDataToResponse(eb);

    Hope it helps.


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 3.  RE: Download - not export table - files from portal-portlet

    Posted Tue August 24, 2010 10:35 PM

    Thanks for the info. I tried it but was unsuccessful. “Access denied” is the error I get when I try to use it. Again, I am NOT a Java coder, so it is VERY difficult for me to decipher what/where to insert code, then to debug it.


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 4.  RE: Download - not export table - files from portal-portlet

    Posted Fri August 27, 2010 12:04 PM

    Hi,
    where does the files to be downloaded come from? how do you access them inside your portlet?
    Have a look at [url]http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuite8_ga/My_webMethods_and_Task_Engine/8-0-SP1_CAF_and_MWS_Java_API_Reference/com/webmethods/caf/faces/bean/SimpleFileExportBean.html[/url] for details on how you can use the SimpleFileExportBean.

    Additionally, the button (or icon) you use to trigger the download of the file/s must not be an “async” button. And, you have to add an action listener to that button to re-enable the buttons in the form after the download is finished. You could add this snippet in an Script Block at the end of the page:

    
    Event.observe( window, 'load', function() {
    CAF.model('#activePageBean.clientIds['downloadButton']}').addActionListener(function(id) {Form.enableButtons(document.body);});
    });
    

    Hope this is clear enough and helps,
    Javier


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 5.  RE: Download - not export table - files from portal-portlet

    Posted Tue November 24, 2015 10:22 AM

    Brilliant. Thanks Javier. (Slightly) corrected syntax:

    Event.observe( window, 'load', function() 
    {  
    CAF.model('#{activePageBean.clientIds['downloadButton']}').addActionListener(function(id) {Form.enableButtons(document.body);});  
    });  

    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS