Package org.chiba.web.upload

Examples of org.chiba.web.upload.UploadInfo


                    }

                    this.chibaBean.updateControlValue(id, item.getContentType(), item.getName(), data);
                   
                    // After the value has been set and the RRR took place, create new UploadInfo with status set to 'done'
                    request.getSession().setAttribute(XFormsSession.ADAPTER_PREFIX + sessionKey+"-uploadInfo", new UploadInfo(1, 0, 0, 0,"done"));
                }
                else {
                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug("ignoring empty upload " + id);
                    }
View Full Code Here


     *         param is the upload control id and second will be the current
     *         progress of the upload.
     */
    public org.w3c.dom.Element fetchProgress(String id, String filename, String sessionKey) {
        String progress;
        UploadInfo uploadInfo;

        if (session.getAttribute(XFormsSession.ADAPTER_PREFIX + sessionKey + "-uploadInfo") != null) {
            uploadInfo = (UploadInfo) session.getAttribute(XFormsSession.ADAPTER_PREFIX + sessionKey + "-uploadInfo");

            if (uploadInfo.isInProgress()) {
                double p = uploadInfo.getBytesRead() / uploadInfo.getTotalSize();

                progress = p + "";
                float total = uploadInfo.getTotalSize();
                float read = uploadInfo.getBytesRead();
                int iProgress = (int) Math.ceil((read / total) * 100);
                if (iProgress < 100) {
                  progress = Integer.toString(iProgress);
                }
                else {
                  progress = "99";
                }
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Bytes total: " + uploadInfo.getTotalSize());
                    LOGGER.debug("Bytes read: " + uploadInfo.getBytesRead());
                    LOGGER.debug("elapsed time: " + uploadInfo.getElapsedTime());
                    LOGGER.debug("status: " + uploadInfo.getStatus());
                    LOGGER.debug("Percent completed: " + Math.ceil((read / total) * 100));
                }
            } else {
                progress = "100";
            }
View Full Code Here

TOP

Related Classes of org.chiba.web.upload.UploadInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.