File download/display
Sometimes users want to download a file directly; sometimes they want to view the file on the browser. Scooter provides publish APIs to do both.
Download a file
Once a File instance is created on the server side, such as from a controller class, it can be published for download:
//send a file for download by setting forDownload=true public static void publishFile(File file, String displayableName, boolean forDownload); public static void publishFile(File file, String displayableName, String mimeType, boolean forDownload);
By using the above methods, the file will not be shown on the requester's browser. Instead, a dialog screen is going to pop up and asks where to save the file. The name of the saved file is specified by displayableName.
Display a file
Once a File instance is created on the server side, such as from a controller class, it can be published for displaying on the client browser:
//send a file for displaying public static void publishFile(File file); public static void publishFile(File file, String mimeType);