I have a Struts 2 Action, and Struts 2 is at SERVER SIDE, to allow user to download files from my application.
The files are stored inside a database (I know... but keep the focus). The user access the action, I get the file from database and send to user by using a Stream.
@Action(value="getFile", results= {
@Result(name="ok", type="stream", params = {
"contentType", "application/octet-stream",
"inputName", "fileInputStream",
"contentDisposition", "filename=\"${fileName}\"",
"bufferSize", "1024"
}) }
)
...
public class GetFileAction {
private String fileName;
private Integer idFile;
private ByteArrayInputStream fileInputStream;
public String execute () {
...
try {
FileService fs = new FileService();
if ( (idFile != null) && ( idFile > -1 ) ) {
file = fs.getFile( idFile );
}
if ( file != null ) {
byte[] theFile = file.getFile();
fileInputStream = new ByteArrayInputStream( theFile );
fileName = file.getFileName();
} else {
//
}
} catch ( Exception e ) {
//
}
...
All is working as I wish, but I want to monitor ( from my Tomcat container - SERVER SIDE, not the user's browser ) from server side the progress of user download ...
Is it possible?
Thanks.