Java 类org.apache.commons.fileupload.ProgressListener 实例源码

项目:ProteanBear_Java    文件:FileUploadServlet.java   
/**
 * 方法(受保护)<br>
 * 名称: init<br>
 * 描述: Servlet初始化时调用此方法,初始化连接器以及数据层接口的实现方法<br>
 *
 * @throws javax.servlet.ServletException
 */
@Override
public void init() throws ServletException
{
    super.init();

    //初始化文件上传器
    this.fileUploader=new FileUploader(UPLOAD_PATH,ACCEPT_TYPES,MAX_SIZE,MAX_FILE_SIZE);

    // 根据实际情况设置对象属性(可选)
    //设置名字生成器
    /*this.fileUploader.setFileNameGenerator(new FileNameGenerator()
    {
        @Override
        public String generate(FileItem item,
                String suffix)
        {
            return String.format("%d_%d", item.hashCode(), item.get().hashCode());
        }
    });*/
    //设置进度监听器
    this.fileUploader.setServletProgressListener(
            new ProgressListener()
            {
                @Override
                public void update(long pBytesRead,
                                   long pContentLength,
                                   int pItems)
                {
                    System.out.printf("%d: length -> %d, read -> %d.\n",pItems,pContentLength,pBytesRead);
                }
            }
    );
}
项目:ProteanBear_Java    文件:BusiCmsResourceUploadServlet.java   
/**
 * 方法(受保护)<br/>
 * 名称: init<br/>
 * 描述: Servlet初始化时调用此方法,初始化连接器以及数据层接口的实现方法<br/>
 *
 * @throws javax.servlet.ServletException
 */
@Override
public void init() throws ServletException
{
    super.init();

    //初始化文件上传器
    this.fileUploader=new FileUploader(UPLOAD_PATH,ACCEPT_TYPES,MAX_SIZE,MAX_FILE_SIZE);
    this.processor=new ImageProcessor();

    // 根据实际情况设置对象属性(可选)
    //设置名字生成器
    /*this.fileUploader.setFileNameGenerator(new FileNameGenerator()
    {
        @Override
        public String generate(FileItem item,
                String suffix)
        {
            return String.format("%d_%d", item.hashCode(), item.get().hashCode());
        }
    });*/
    //设置进度监听器
    this.fileUploader.setServletProgressListener(
            new ProgressListener()
            {
                @Override
                public void update(long pBytesRead,
                                   long pContentLength,
                                   int pItems)
                {
                    System.out.printf("%d: length -> %d, read -> %d.\n",pItems,pContentLength,pBytesRead);
                }
            }
    );
}
项目:Equella    文件:ProgressServlet.java   
public void addListener(String id, ProgressListener listener)
{
    String key = getKey(id);
    sessionService.setAttribute(key, listener);
}
项目:ymate-platform-v2    文件:DefaultModuleCfg.java   
public ProgressListener getUploadFileListener() {
    return __uploadFileListener;
}
项目:ProteanBear_Java    文件:FileUploader.java   
/**
 * 设置上传组件的处理进程监听器,参考:{@link ServletFileUpload#setProgressListener(ProgressListener)}
 *
 * @param servletProgressListener
 */
public void setServletProgressListener(
        ProgressListener servletProgressListener)
{
    this.servletProgressListener=servletProgressListener;
}
项目:dcs-sdk-java    文件:MultipartStreamCopy.java   
/**
 * Creates a new instance with the given listener
 * and content length.
 *
 * @param pListener      The listener to invoke.
 * @param pContentLength The expected content length.
 */
ProgressNotifier(ProgressListener pListener, long pContentLength) {
    listener = pListener;
    contentLength = pContentLength;
}
项目:ymate-platform-v2    文件:IWebMvcModuleCfg.java   
/**
 * @return 文件上传状态监听器
 */
ProgressListener getUploadFileListener();
项目:ProteanBear_Java    文件:FileUploader.java   
/**
 * 获取上传组件的处理进程监听器,参考:{@link ServletFileUpload#getProgressListener()}
 *
 * @return
 */
public ProgressListener getServletProgressListener()
{
    return servletProgressListener;
}
项目:actframework    文件:MultipartStream.java   
/** Creates a new instance with the given listener
 * and content length.
 * @param pListener The listener to invoke.
 * @param pContentLength The expected content length.
 */
ProgressNotifier(ProgressListener pListener, long pContentLength) {
    listener = pListener;
    contentLength = pContentLength;
}
项目:restcommander    文件:MultipartStream.java   
/** Creates a new instance with the given listener
 * and content length.
 * @param pListener The listener to invoke.
 * @param pContentLength The expected content length.
 */
ProgressNotifier(ProgressListener pListener, long pContentLength) {
    listener = pListener;
    contentLength = pContentLength;
}