Example usage for org.apache.wicket.protocol.http.servlet MultipartServletWebRequestImpl getUploadInfo

List of usage examples for org.apache.wicket.protocol.http.servlet MultipartServletWebRequestImpl getUploadInfo

Introduction

In this page you can find the example usage for org.apache.wicket.protocol.http.servlet MultipartServletWebRequestImpl getUploadInfo.

Prototype

public static UploadInfo getUploadInfo(final HttpServletRequest req, String upload) 

Source Link

Document

Retrieves UploadInfo from session, null if not found.

Usage

From source file:org.opensingular.form.wicket.panel.SUploadProgressBar.java

License:Apache License

/**
 * @param attributes/*from  ww  w.j a va2s  . c om*/
 * @return status string with progress data that will feed the progressbar.js variables on
 *         browser to update the progress bar
 */
private String getStatus(final Attributes attributes) {
    final String upload = attributes.getParameters().get(UPLOAD_PARAMETER).toString();

    final HttpServletRequest req = (HttpServletRequest) attributes.getRequest().getContainerRequest();

    UploadInfo info = MultipartServletWebRequestImpl.getUploadInfo(req, upload);

    String status;
    if ((info == null) || (info.getTotalBytes() < 1)) {
        status = "100|";
    } else {
        status = info.getPercentageComplete() + "|"
                + new StringResourceModel(RESOURCE_STATUS, (Component) null, Model.of(info)).getString();
    }
    return status;
}