Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-930

Fileupload.get fail in cluster server

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 5.0.10
    • Fix Version/s: 5.0.11, 6.0.1
    • Component/s: Clustering
    • Security Level: Jimmy
    • Labels:
      None

      Description

      http://www.zkoss.org/forum/listComment/18814-FileUpload-throws-NotSerializableException-in-JBoss-Cluster-ZK-6

      <window id="devWindow" apply="test.EntryComposer"
      	title="ZK Version: ${desktop.webApp.version}">
      
      	<div>
      		Fileupload: <button id="upload" label="Upload" />
      	</div>	
      </window>
      
      package test;
      
      import java.util.logging.Logger;
      
      import org.zkoss.util.media.Media;
      import org.zkoss.zk.ui.Component;
      import org.zkoss.zk.ui.event.Event;
      import org.zkoss.zk.ui.event.Events;
      import org.zkoss.zk.ui.event.SerializableEventListener;
      import org.zkoss.zk.ui.event.UploadEvent;
      import org.zkoss.zk.ui.util.GenericForwardComposer;
      import org.zkoss.zul.Fileupload;
      import org.zkoss.zul.Window;
      
      public class EntryComposer extends GenericForwardComposer {
      
      	private final static long serialVersionUID = -6886252025064558162L;
      	private Window devWindow;
          
      	@Override
      	public void doAfterCompose(Component comp) throws Exception {
      		super.doAfterCompose(comp);
      
      		devWindow.addEventListener(Events.ON_UPLOAD, new SerializableEventListener() {
      			private static final long serialVersionUID = -4371040477798783952L;
      
      			public void onEvent(Event event) throws Exception {
      				handleFileUpload((UploadEvent)event);
      			}
      		});
      	}
      
      	public void onClick$upload() {
      		try {
      			int maxFiles = 3; 
      			int maxSize = 104857600; 
      			boolean alwaysNative = true;
      			
      			// always returns null, handle UploadEvent in listener 
      			Fileupload.get("message", "title", maxFiles, maxSize, alwaysNative);
      		} catch (Exception e) {
      			System.out.println("{} Upload failed onClick$upload()");			
      		} 
      	}
      		
      	public void handleFileUpload(UploadEvent event)  {
      		try {
      			Media[] multiMedia = event.getMedias();
      			
      			for (Media uploadedMedia : multiMedia) {				
      				System.out.println("{} Media inMemory? {} handleFileUpload()"+ uploadedMedia.inMemory());			
      				System.out.println("{} Media isBinary? {} handleFileUpload()"+ uploadedMedia.isBinary());			
      			}
      		} catch (Exception e) {
      		} 
      	}
      }
      
      

        Attachments

          Activity

            People

            • Assignee:
              jumperchen jumperchen
              Reporter:
              jimmyshiau jimmyshiau
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: