commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Favre-Bulle <Thomas.Favre-Bu...@bull.net>
Subject Re: [fileupload] unable to find setProgress method
Date Thu, 03 Jul 2008 07:36:50 GMT


simon.kitching@chello.at a écrit :
> Thomas Favre-Bulle schrieb:
>> Hi everyone !
>>
>> I'm using fileupload lib in order to implement an upload progress bar.
>> Unfortunately, it seems there's a problem with 
>> org.apache.commons.fileupload.servlet.ServletFileUpload, each time I 
>> try to compile I get the following error :
>>
>> symbol  : method 
>> setProgressListener(infoserver.control.FileUploadListener)
>> location: class org.apache.commons.fileupload.servlet.ServletFileUpload
>>        upload.setProgressListener(listener);
>> 1 error
>>
>>
>> Here is the code :
>>
>> FileItemFactory factory = new DiskFileItemFactory();
>> ServletFileUpload upload = new ServletFileUpload(factory);
>>
>> // set file upload progress listener
>> FileUploadListener listener = new FileUploadListener();
>> HttpSession session = request.getSession();
>>
>> session.setAttribute("LISTENER", listener);
>>       // upload servlet allows to set upload listener
>> upload.setProgressListener(listener);
>>
>>
>> I'm using version 1.2.1 and JDK 1.6.
>>
>> Any idea ?
> Does your infoserver.control.FileUploadListener class implement the 
> org.apache.commons.fileupload.ProgressListener interface?
>
> Regards,
> Simon
>
Yes it does :

public class FileUploadListener implements ProgressListener {

    private volatile long bytesRead = 0L,  contentLength = 0L,  item = 0L;

    public FileUploadListener() {
        super();
    }

    public void update(long aBytesRead, long aContentLength, int anItem) {
        bytesRead = aBytesRead;
        contentLength = aContentLength;
        item = anItem;
    }

    public long getBytesRead() {
        return bytesRead;
    }

    public long getContentLength() {
        return contentLength;
    }

    public long getItem() {
        return item;
    }



I forgot to add commons.io dependecy but adding it did not solve the 
problem.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
>
>

-- 



Thomas Favre-Bulle
Documentation Development & Software Ergonomics
Bull, Architect of an Open World TM
Tél. ext. : 04-76-297-508
Tél. int. : 229-7508
http://www.bull.com
--
Ce message contient des informations confidentielles, couvertes par le secret professionnel
ou réservées exclusivement à leur destinataire.
Toute lecture, utilisation, diffusion ou divulgation sans autorisation expresse est rigoureusement
interdite.
Si vous n'en êtes pas le destinataire, merci de prendre contact avec l'expéditeur et de
détruire ce message.

This e-mail contains material that is confidential for the sole use of the intended recipient.
Any review, reliance or distribution by others or forwarding without express permission is
strictly prohibited.
If you are not the intended recipient, please contact the sender and delete all copies.



Mime
View raw message