Hello I have used File Upload
in struts2
with commons-fileuplod
.
Edit :
When i run my demo from eclipse with right click and run on server
so time taken to upload File is very small
**Run From ECLIPSE :**
File Size : 247 MB
Time TAken By upload using Run On server From eclipse :--> 2989 MS
On other side when i deploy same demo war file to Tomcat in webapps folder
and run . So it take more time to upload file compare to previous case . (Why this big time difference ?)
**Run Using Deploy Demo In Tomcat :**
File Size : 247 MB
Time TAken By upload By deploed war file to tomcat web apps folder :--> 14162 MS
I have change java.io.tmpdir
in MonitoredMultiPartRequest.java
:
System.setProperty("java.io.tmpdir", "D:\\ankit");
System.out.println("java.io.tmpdir :--> " + System.getProperty("java.io.tmpdir"));
UploadListener listener = new UploadListener(servletRequest);
// Create a factory for disk-based file items
FileItemFactory factory = new MonitoredDiskFileItemFactory(listener);
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
try{
long start = System.currentTimeMillis();
List items = upload.parseRequest(servletRequest);
long end = System.currentTimeMillis();
System.out.println("Time TAken By upload 3.2.1 :--> " + (end - start));
getsystemDetail();
} catch (Exception e){
errors.add(e.getMessage());
}
Here I mention My Log:
Run From ECLIPSE :
==== System Property =========
java.io.tmpdir :--> D:\ankit
================================
Time TAken By upload File :--> 2989
==================================
##### Heap utilization statistics [MB] #####
Used Memory:46
Free Memory:85
Total Memory:132
Max Memory:675
File system root: C:\
Total space (mb): 79899
Free space (mb): 31833
Usable space (mb): 31833
File system root: D:\
Total space (mb): 158472
Free space (mb): 117366
Usable space (mb): 117366
This is ServletContext RealPath path ::--> D:\eclipseWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\FILEUPLOAD_DEMO_OldLIB\
File Uploaded Succ. TO ::-> D:\ankit\eclipse.zip
Run Using Deploy Demo In Tomcat :
==== System Property =========
java.io.tmpdir :--> D:\ankit
================================
Time TAken By upload File :--> 14162
==================================
##### Heap utilization statistics [MB] #####
Used Memory:100
Free Memory:31
Total Memory:132
Max Memory:1820
File system root: C:\
Total space (mb): 79899
Free space (mb): 31830
Usable space (mb): 31830
File system root: D:\
Total space (mb): 158472
Free space (mb): 117358
Usable space (mb): 117358
This is ServletContext RealPath path ::--> D:\tools\tomcat7-6\webapps\FILEUPLOAD_DEMO_OldLIB\
File Uploaded Succ. TO ::-> D:\ankit\eclipse.zip