File Download
You want to export data, identified by a Windchill URL, to a file in the user’s file system, without interrupting any active AJAX requests.
This information applies to any coding scenario that involves exporting (downloading to the client) a word processing document, spreadsheet, compressed archive, etc. See
Limitations for file types not suited for this technique.
Scope/Applicability/Assumptions
You have one of the following:
• JavaScript code
• A JSP page or fragment
• A Java class that descends from DefaultObjectFormProcessor, or another use of a FormResult object
The code needs to allow a user to download a file, identifiable by a URL, to the user’s computer. The download must not interfere with any pending AJAX transaction, and must run in the background without preempting the Windchill UI.
For example, you might have a wizard that guides a user to select a document, and a class <MyWizardFormProcessor>.java to process the form on closure. The form processor can return a FormResult with the next action set to FormResultAction.JAVASCRIPT, that includes a JavaScript call to download the selected file.
Intended Outcome
The user’s web browser will present its standard file-save dialog box: