Many bugfixes and improvements
This commit is contained in:
parent
c3e3bbf787
commit
363e0c6cfc
52 changed files with 2021 additions and 982 deletions
|
|
@ -33,9 +33,9 @@ import zutil.StringUtil;
|
|||
import zutil.io.file.FileUtil;
|
||||
import zutil.jee.upload.FileUploadListener.Status;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.parser.json.JSONNode;
|
||||
import zutil.parser.DataNode;
|
||||
import zutil.parser.DataNode.DataType;
|
||||
import zutil.parser.json.JSONWriter;
|
||||
import zutil.parser.json.JSONNode.JSONType;
|
||||
|
||||
/**
|
||||
* <XMP>
|
||||
|
|
@ -139,7 +139,7 @@ public abstract class AjaxFileUpload extends HttpServlet {
|
|||
}
|
||||
|
||||
// Generate JSON
|
||||
JSONNode root = new JSONNode( JSONType.List );
|
||||
DataNode root = new DataNode( DataType.List );
|
||||
Iterator<FileUploadListener> it = list.iterator();
|
||||
while( it.hasNext() ) {
|
||||
FileUploadListener listener = it.next();
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package zutil.jee.upload;
|
|||
import org.apache.commons.fileupload.ProgressListener;
|
||||
|
||||
import zutil.StringUtil;
|
||||
import zutil.parser.json.JSONNode;
|
||||
import zutil.parser.json.JSONNode.JSONType;
|
||||
import zutil.parser.DataNode;
|
||||
import zutil.parser.DataNode.DataType;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -121,18 +121,18 @@ public class FileUploadListener implements ProgressListener{
|
|||
return (int)((100 * bytes) / length);
|
||||
}
|
||||
|
||||
public JSONNode getJSON() {
|
||||
JSONNode node = new JSONNode( JSONType.Map );
|
||||
node.add("id", id);
|
||||
public DataNode getJSON() {
|
||||
DataNode node = new DataNode( DataType.Map );
|
||||
node.set("id", id);
|
||||
|
||||
node.add("status", status.toString());
|
||||
node.add("message", message.replaceAll("\"", "\\\"") );
|
||||
node.add("filename", filename);
|
||||
node.add("percent", getPercentComplete());
|
||||
node.set("status", status.toString());
|
||||
node.set("message", message.replaceAll("\"", "\\\"") );
|
||||
node.set("filename", filename);
|
||||
node.set("percent", getPercentComplete());
|
||||
|
||||
node.add("uploaded", StringUtil.formatBytesToString( bytes ));
|
||||
node.add("total", StringUtil.formatBytesToString( length ));
|
||||
node.add("speed", StringUtil.formatBytesToString( speed )+"/s");
|
||||
node.set("uploaded", StringUtil.formatBytesToString( bytes ));
|
||||
node.set("total", StringUtil.formatBytesToString( length ));
|
||||
node.set("speed", StringUtil.formatBytesToString( speed )+"/s");
|
||||
return node;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue