Upload component: Process file data.

I am using this demo code
http://demo.vaadin.com/sampler#UploadWithProgressMonitoring

my use case is upload a file
and process the file…
keep user informed on various stage of process using progress monitor.

so what i am doing is the standard stuff that is
from uploadStarted method get the contentLength

and in receiveUpload method
check for the readBytes counter being same as contentLength
then do processing …
This is all good
my problem is as i guess after last byte has been send progress monitor does not calls
updateProgress
so i am not able to update progress monitor with file process update.

Thank you for your time

The code I’m using is below, and seems to work, I think you want to depend on the streamingFinished, to close things off.

J

                   StreamVariable streamVariable = new StreamVariable() {

                        public OutputStream getOutputStream() {
                            return bas;
                        }

                        public boolean listenProgress() {
                            return true;
                        }
                        
                        public void onProgress(StreamingProgressEvent event) {
                        	long a = event.getBytesReceived();
                        	long b = event.getContentLength();
                        	float c = (float) a / (float) b;
                        	progress.setValue(c);
                        	System.out.println(a + " " + b + " " + c);
                        }

                        public void streamingStarted(
                                StreamingStartEvent event) {
                        }

                        public void streamingFinished(
                                StreamingEndEvent event) {
                            progress.setVisible(false);
                            showFile(fileName, html5File.getType(), bas);
                        }

                        public void streamingFailed(
                                StreamingErrorEvent event) {
                            progress.setVisible(false);
                        }

                        public boolean isInterrupted() {
                            return false;
                        }
                    };