Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Upload / Download DMI

    Hi,
    I've spent two days trying to implement a "so simple" form. The goal is to upload an image / file using Smartgwt pro and DMI architecture.
    I've seen all the posts / samples, but none is complete.
    I've an upload form to upload an image. This seems to work fine.
    In order to test the solution I've a static variable that stores all my uploaded images within objects. This is ok.
    Then, I want to dispklay the uploaded images. I've tried to disply them in aother form via an imageFile datafield type. Not working
    Then I've tried to display them in a list grid => not ok.

    Here is my DS file :
    imageTestDS.ds.xml
    Code:
    <DataSource
        ID="imageTestDS"
        serverType="generic">
        <fields>
            <field name="code"  title="Key"   type="sequence" primaryKey="true" hidden="true">
            </field>
            <field name="title"  title="Title"   type="text"  length="128" required="false">
            </field>   
            <field name="imageTest"  title="Test image"   type="imageFile" required="false" showFileInline="true">
            </field>    
        </fields>
        
    <serverObject lookupStyle="new" className="image.UploadImageDMI" />    
        <operationBindings>
    		<binding operationType="viewFile" serverMethod="viewFile">    
    	    	<serverObject lookupStyle="new" className="image.DownloadImageDMI" />
    	    </binding>
        </operationBindings>   
    </DataSource>

    Here is my POJO Serializable object :
    Code:
    import java.io.InputStream;
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;
    
    
    public class ImageObject implements Serializable{
    	static List<ImageObject> images;
    	static{
    		images = new ArrayList<ImageObject>();
    	}
    	private int code;
    	private String title;
    	private InputStream imageTest;
    		
    	public String getTitle() {
    		return title;
    	}
    	public void setTitle(String unTitle) {
    		title = unTitle;
    	}
    	public InputStream getImageTest() {
    		return imageTest;
    	}
    	public void setImageTest(InputStream unImageTest) {
    		imageTest = unImageTest;
    	}
    	public static List<ImageObject> getImages() {
    		return images;
    	}
    	public int getCode() {
    		return code;
    	}
    	public void setCode(int unCode) {
    		code = unCode;
    	}	
    }
    Here is my upload DMI class

    Code:
    import java.io.InputStream;
    
    import com.isomorphic.datasource.DSRequest;
    import com.isomorphic.datasource.DSResponse;
    import com.isomorphic.servlet.ISCFileItem;
    
    public class UploadImageDMI {
    	 public DSResponse fetch(DSRequest dsRequest) throws Exception {   
    		 DSResponse dsResponse = new DSResponse();  
    		 dsResponse.setData(ImageObject.getImages());
    		 return dsResponse;  
    	 }  
    
    	public ImageObject add(DSRequest record) throws Exception {  
    		ImageObject newImage = new ImageObject();
    		newImage.setCode(record.getParameter("code") == null ? 0 : (Integer)record.getParameter("codeDemande"));
    		newImage.setTitle((String)record.getFieldValue("title"));
    		ISCFileItem file = record.getUploadedFile("imageTest");
    		InputStream stream = file.getInputStream();
    		newImage.setImageTest(stream);
    		ImageObject.getImages().add(newImage);
    		return newImage;  
    	}  
    }
    Here is my download DMI class
    (Note the commented lines indicating all the "empiric" tests I've done)
    The viewFile method is correctly called.
    Code:
    import com.isomorphic.datasource.DSRequest;
    import com.isomorphic.datasource.DSResponse;
    import com.isomorphic.rpc.RPCManager;
    
    public class DownloadImageDMI {
    	public DSResponse viewFile(DSRequest dsRequest, RPCManager rpcManager) throws Exception {
    		 DSResponse dsResponse = new DSResponse();  
    		 rpcManager.doCustomResponse(); 
    // Not working		 List r = new ArrayList();
    // Not working		 r.add(ImageObject.getImages().get(0));
    // Not working		 dsResponse.setData(ImageObject.getImages().get(0));
    //Not working	 dsResponse.setData(new FileInputStream( "C:/testImage.png" ));
    		 dsResponse.setData(ImageObject.getImages());
    		 return dsResponse;
    	}
    }
    and finally the entry point class

    Code:
    public class TestImageEntry implements EntryPoint {
    	private ListGrid listImages;
    	private DataSource dataSource;
    	private DynamicForm uploadForm;
    	private IButton saveButton;
    	private DynamicForm getUploadForm(){
    		
    		if(uploadForm == null){
    			uploadForm = new DynamicForm();
    			uploadForm.setDataSource(dataSource);
    			uploadForm.editNewRecord();
    		}
    		return uploadForm;
    	}
    	DynamicForm viewForm;
    
    	private DynamicForm getViewForm(){
    		if(viewForm == null){
    			viewForm = new DynamicForm();
    			viewForm.setIsGroup(true);
    			viewForm.setGroupTitle("<B>Images");
    			viewForm.setDataSource(dataSource);
    			
    //			Also tested with these lines commented => not working
    			
    			ViewFileItem imageShow = new ViewFileItem("imageDemande", "view image");
    			imageShow.setShowFileInline(Boolean.TRUE);
    			imageShow.setAttribute("editorType", "ViewFileItem");
    			imageShow.setType("imageFile");
    			imageShow.setHeight(300);
    			imageShow.setWidth(300);
    
    			ViewFileItem imageHide = new ViewFileItem("imageDemande", "hide image");
    			imageHide.setShowFileInline(Boolean.FALSE);
    			imageHide.setAttribute("editorType", "ViewFileItem");
    			imageHide.setType("imageFile");
    			imageHide.setHeight(300);
    			imageHide.setWidth(300);	
    			viewForm.setItems(imageShow, imageHide);
    		}
    		return viewForm;
    	}
    	  
    	private ListGrid getListGrid(){
    		listImages = new ListGrid();
    		listImages.setDataSource(dataSource);
    	//  Also tested without these comments => not working
    		
    	//	ListGridField img = new ListGridField("imageDemande", "list image");
    	//	l.setFields(img);
    	//	l.setAutoFetchData(true);
    		return listImages;
    	}
    		       
    	public IButton getUploadButton(){
    	    if(saveButton == null){
    	    	saveButton = new IButton("Save");
    	    
    		    saveButton.setTop(100);
    		    saveButton.addClickHandler(new ClickHandler() {
    		         public void onClick(ClickEvent event) {
    		        	 uploadForm.saveData(new DSCallback() {
    						
    						@Override
    						public void execute(DSResponse unResponse, Object unRawData, DSRequest unRequest) {
    							if(viewForm != null) viewForm.fetchData();
    							if(listImages != null) listImages.fetchData();
    						}
    					});
    		         }
    		    });
    	    }
    	    return saveButton;
    	}
    	public void onModuleLoad() {
    		dataSource = DataSource.get("imageTestDS");
    		
    		RootPanel rootPanel = RootPanel.get();
    		VLayout hLayout = new VLayout();
    		hLayout.setWidth("95%");
    		hLayout.setHeight("95%");
    		hLayout.setDefaultResizeBars(LayoutResizeBarPolicy.ALL);
    		hLayout.setDefaultLayoutAlign(VerticalAlignment.TOP);
    
    		hLayout.addMember(getUploadForm());
    		hLayout.addMember(getUploadButton());
    		hLayout.addMember(getViewForm());
    		hLayout.addMember(getListGrid());
    		rootPanel.add(hLayout, 20, 20);		
    	}
    }
    I really tried so many possibilities !!!!
    Any help => really working sample would be GREAAAAAAT.

    Thanks in advance

    #2
    You forgot to post your relevant versions, the server logs for the viewFile request, what you see in the RPC tab in the Developer Console, and whether there are any warnings in the Developer Console.

    Setting a single item List with a POJO is the right approach by the way. But the diagnostics above are what to look at when troubleshooting.

    Comment


      #3
      I'm worki,g with SmartGWT Pro version 2.1. By the way, when do you intent to move in trhe 2.2 for Pro version ?

      In the Results Tab of the console, I've the following warnings (not so important I think)

      Code:
      10:32:56.390:RDQ9:WARN:Canvas:isc_ViewFileItem_0_canvas:ignoring bad or negative height: -4 [enable 'sizing' log for stack trace]
      10:32:56.406:RDQ9:WARN:Canvas:isc_ViewFileItem_0_canvas:ignoring bad or negative height: -4 [enable 'sizing' log for stack trace]
      I don't see any problem in the RPC tab (see the attached image).
      Could you try the sample and telle me where I'm wrong. I've made it self contained ans very simple in order to test it very quyickly.
      This would be very helpful for me.

      Thanks in advance
      Attached Files

      Comment


        #4
        There is already a 2.3 version available. Log in and look on the download page.

        You forgot the server logs that we asked for. That's the most important piece.

        Comment


          #5
          Ok, here are the logs.
          Code:
          === 2010-08-17 18:23:27,468 [main] INFO  ISCInit - Isomorphic SmartClient Framework - Initializing
          === 2010-08-17 18:23:27,484 [main] INFO  ConfigLoader - Attempting to load framework.properties from CLASSPATH
          === 2010-08-17 18:23:27,531 [main] INFO  ConfigLoader - Successfully loaded framework.properties from CLASSPATH at location: jar:file:/D:/CCREclipse/smartgwtpro-2.1/lib/isomorphic_core_rpc.jar!/framework.properties
          === 2010-08-17 18:23:27,531 [main] INFO  ConfigLoader - Attempting to load project.properties from CLASSPATH
          === 2010-08-17 18:23:27,531 [main] INFO  ConfigLoader - Unable to locate project.properties in CLASSPATH
          === 2010-08-17 18:23:27,531 [main] INFO  ConfigLoader - Successfully loaded isc_interfaces.properties from CLASSPATH at location: jar:file:/D:/CCREclipse/smartgwtpro-2.1/lib/isomorphic_core_rpc.jar!/isc_interfaces.properties
          === 2010-08-17 18:23:27,531 [main] INFO  ConfigLoader - Attempting to load server.properties from CLASSPATH
          === 2010-08-17 18:23:27,531 [main] INFO  ConfigLoader - Successfully loaded server.properties from CLASSPATH at location: file:/D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/WEB-INF/classes/server.properties
          === 2010-08-17 18:23:27,531 [main] INFO  Logger - Logging system started.
          === 2010-08-17 18:23:27,546 [main] INFO  ISCInit - Isomorphic SmartClient Framework (SC_SNAPSHOT-2010-03-09/Pro Deployment 2010-03-09) - Initialization Complete
          === 2010-08-17 18:23:27,546 [main] INFO  ISCInit - Auto-detected webRoot - using: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war
          === 2010-08-17 18:23:27,671 [main] INFO  PreCache - Isomorphic PreCache servlet loading
          === 2010-08-17 18:23:27,687 [main] INFO  PoolManager - SmartClient pooling disabled for 'DataSource' objects
          === 2010-08-17 18:23:27,718 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\DataSource.ds.xml: 0ms
          === 2010-08-17 18:23:27,734 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\builtinTypes.xml: 0ms
          === 2010-08-17 18:23:27,781 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\DataSourceField.ds.xml: 0ms
          === 2010-08-17 18:23:27,796 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\Validator.ds.xml: 0ms
          === 2010-08-17 18:23:27,812 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\ValueMap.ds.xml: 0ms
          === 2010-08-17 18:23:27,828 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\InstantDataApp.ds.xml: 16ms
          === 2010-08-17 18:23:27,859 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\Application.ds.xml: 16ms
          === 2010-08-17 18:23:27,859 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\IDAPage.ds.xml: 0ms
          === 2010-08-17 18:23:27,859 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\IDAUserType.ds.xml: 0ms
          === 2010-08-17 18:23:27,875 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\IDAOperation.ds.xml: 0ms
          === 2010-08-17 18:23:27,906 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\Canvas.ds.xml: 16ms
          === 2010-08-17 18:23:27,937 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\MethodDeclaration.ds.xml: 16ms
          === 2010-08-17 18:23:27,937 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\Img.ds.xml: 0ms
          === 2010-08-17 18:23:27,937 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\StatefulCanvas.ds.xml: 0ms
          === 2010-08-17 18:23:27,953 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\Button.ds.xml: 0ms
          === 2010-08-17 18:23:27,968 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\ListViewer.ds.xml: 0ms
          === 2010-08-17 18:23:27,968 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\ListGrid.ds.xml: 0ms
          === 2010-08-17 18:23:27,984 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\DynamicForm.ds.xml: 0ms
          === 2010-08-17 18:23:28,000 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\FormItem.ds.xml: 0ms
          === 2010-08-17 18:23:28,015 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\DetailViewer.ds.xml: 0ms
          === 2010-08-17 18:23:28,031 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\DetailViewerField.ds.xml: 0ms
          === 2010-08-17 18:23:28,031 [main] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\isomorphicXML.ds.xml: 0ms
          === 2010-08-17 18:23:28,031 [main] INFO  PreCache - Isomorphic PreCache complete (360ms)
          === 2010-08-17 18:23:32,906 [l0-2] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\ds\utilisateurLoginDS.ds.xml: 0ms
          === 2010-08-17 18:23:32,937 [l0-2] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\ServerObject.ds.xml: 31ms
          === 2010-08-17 18:23:32,937 [l0-2] INFO  BasicDataSource - for field: lookupStyle adding automatically generated isOneOf validator with values: [
              "attribute",
              "factory",
              "new",
              "spring"
          ]
          === 2010-08-17 18:23:32,937 [l0-2] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\ds\demandeInterventionDS.ds.xml: 0ms
          === 2010-08-17 18:23:32,937 [l0-2] INFO  BasicDataSource - for field: lookupStyle adding automatically generated isOneOf validator with values: [
              "attribute",
              "factory",
              "new",
              "spring"
          ]
          === 2010-08-17 18:23:32,953 [l0-2] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\OperationBinding.ds.xml: 16ms
          === 2010-08-17 18:23:32,953 [l0-2] INFO  BasicDataSource - for field: lookupStyle adding automatically generated isOneOf validator with values: [
              "attribute",
              "factory",
              "new",
              "spring"
          ]
          === 2010-08-17 18:23:32,968 [l0-2] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\ds\imageTestDS.ds.xml: 15ms
          === 2010-08-17 18:23:32,968 [l0-2] INFO  BasicDataSource - for field: lookupStyle adding automatically generated isOneOf validator with values: [
              "attribute",
              "factory",
              "new",
              "spring"
          ]
          === 2010-08-17 18:23:32,968 [l0-2] INFO  BasicDataSource - for field: lookupStyle adding automatically generated isOneOf validator with values: [
              "attribute",
              "factory",
              "new",
              "spring"
          ]
          === 2010-08-17 18:23:33,062 [l0-2] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/skins/Enterprise/load_skin.js
          === 2010-08-17 18:24:13,812 [l0-2] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_FileLoader.js
          === 2010-08-17 18:24:14,671 [l0-3] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_Containers.js
          === 2010-08-17 18:24:14,812 [l0-6] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_Foundation.js
          === 2010-08-17 18:24:14,875 [l0-2] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_Core.js
          === 2010-08-17 18:24:14,875 [l0-6] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_DataBinding.js
          === 2010-08-17 18:24:14,937 [l0-6] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_Tools.js
          === 2010-08-17 18:24:14,984 [l0-6] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/skins/Enterprise/load_skin.js
          === 2010-08-17 18:24:15,031 [l0-3] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_Forms.js
          === 2010-08-17 18:24:15,125 [l0-6] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_DeveloperConsole.js
          === 2010-08-17 18:24:15,421 [l0-6] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_Grids.js
          === 2010-08-17 18:24:18,156 [l0-6] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB0.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:24:18,203 [l0-6] DEBUG XML - Parsed XML from (in memory stream): 0ms
          === 2010-08-17 18:24:18,203 [l0-6] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\List.ds.xml: 0ms
          === 2010-08-17 18:24:18,218 [l0-6] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:24:18,218 [l0-6] DEBUG RPCManager - Request #1 (RPCRequest) data: {
              appID:"isc_builtin",
              className:"builtin",
              methodName:"getAvailableScriptEngines",
              arguments:[
              ],
              is_ISC_RPC_DMI:true
          }
          === 2010-08-17 18:24:18,234 [l0-6] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:24:18,250 [l0-6] DEBUG XML - Parsed XML from jar:file:/D:/CCREclipse/smartgwtpro-2.1/lib/isomorphic_core_rpc.jar!/isc_builtin.app.xml: 0ms
          === 2010-08-17 18:24:18,250 [l0-6] DEBUG XML - Parsed XML from D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\system\schema\Method.ds.xml: 0ms
          === 2010-08-17 18:24:18,265 [l0-6] DEBUG RPCDMI - appConfig: isc.Application.create({
              rpcBindings:[
                  {
                      ID:"builtin",
                      className:"com.isomorphic.rpc.BuiltinRPC",
                      visibleMethods:[
                          {
                              name:"downloadWSDL"
                          },
                          {
                              name:"downloadClientContent"
                          },
                          {
                              name:"xmlToJS"
                          },
                          {
                              name:"uploadProgressCheck"
                          },
                          {
                              name:"saveFile"
                          },
                          {
                              name:"appendToFile"
                          },
                          {
                              name:"loadFile"
                          },
                          {
                              name:"deleteFile"
                          },
                          {
                              name:"loadSharedXML"
                          },
                          {
                              name:"saveSharedXML"
                          },
                          {
                              name:"getAvailableScriptEngines"
                          },
                          {
                              name:"devConsoleEvalServerScript"
                          },
                          {
                              name:"evalJava"
                          },
                          {
                              name:"getLogNames"
                          },
                          {
                              name:"getLogEntries"
                          },
                          {
                              name:"getLogThresholds"
                          },
                          {
                              name:"setLogThreshold"
                          }
                      ]
                  },
                  {
                      ID:"builtin_tools",
                      className:"com.isomorphic.tools.BuiltinRPC",
                      visibleMethods:[
                          {
                              name:"getDataSourceFromTable"
                          },
                          {
                              name:"getDataSourceJSONFromTable"
                          },
                          {
                              name:"getDataSourceFromHibernateMapping"
                          },
                          {
                              name:"getDataSourceJSONFromHibernateMapping"
                          },
                          {
                              name:"getTables"
                          },
                          {
                              name:"getFieldsFromTable"
                          },
                          {
                              name:"getBeanFields"
                          },
                          {
                              name:"getHibernateBeans"
                          },
                          {
                              name:"getDatabaseProductNameAndVersion"
                          },
                          {
                              name:"getDatabaseTableTypes"
                          },
                          {
                              name:"setAttributes"
                          },
                          {
                              name:"clearAttributes"
                          },
                          {
                              name:"getAttributes"
                          },
                          {
                              name:"getAttribute"
                          },
                          {
                              name:"getDataSourceConfigFromJavaClass"
                          },
                          {
                              args:"cName",
                              language:"groovy",
                              name:"getJavaSource",
                              script:"\n                    if (!com.isomorphic.auth.DevModeAuthFilter.devModeAuthorized(request)) throw new Exception(\"Not Authorized\");                    \n                    //import org.apache.bcel.Repository;\n\n                    try {\n                        return org.apache.bcel.Repository.lookupClass(cName).toString();\n                    } catch (Throwable e) {\n                        return \"Unable to reverse engineer class \"+cName+\": \"+e.getMessage();\n                    }\n                "
                          },
                          {
                              name:"loadDataSource"
                          },
                          {
                              name:"dsFromXML"
                          },
                          {
                              name:"dsConfigFromXML"
                          },
                          {
                              name:"getDefinedDataSources"
                          }
                      ]
                  },
                  {
                      ID:"builtin_adminconsole",
                      className:"com.isomorphic.tools.AdminConsole",
                      visibleMethods:[
                          {
                              name:"getDefinedDatabases"
                          },
                          {
                              name:"testDB"
                          },
                          {
                              name:"saveDBConfig"
                          },
                          {
                              name:"setDefaultDB"
                          },
                          {
                              name:"importDataSources"
                          }
                      ]
                  }
              ]
          })
          
          === 2010-08-17 18:24:18,265 [l0-6] DEBUG RPCDMI - Invocation threw exception
          === 2010-08-17 18:24:18,296 [l0-6] ERROR IDACall - Top-level servlet error: 
          === 2010-08-17 18:24:21,500 [l0-6] INFO  RequestContext - URL: '/jira/sc/system/development/ISC_ServerLogViewer.js', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB0.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:24:21,500 [l0-6] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/system/development/ISC_ServerLogViewer.js
          === 2010-08-17 18:24:49,765 [l0-3] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:24:49,921 [l0-3] DEBUG XML - Parsed XML from (in memory stream): 15ms
          === 2010-08-17 18:24:49,921 [l0-3] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:24:49,921 [l0-3] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              values:{
                  imageTest:"C:\\fakepath\\epocrate2.PNG",
                  imageTest_filesize:25225,
                  imageTest_date_created:new Date(1282062289921),
                  imageTest_filename:"epocrate2.PNG"
              },
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"add"
              },
              componentId:"isc_DynamicForm_0",
              appID:"builtinApplication",
              operation:"imageTestDS_add",
              oldValues:{
              },
              criteria:{
              }
          }
          === 2010-08-17 18:24:49,921 [l0-3] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:24:50,000 [l0-3] WARN  Validation - No such type 'imageFile', not processing field value at /imageTestDS/imageTest
          === 2010-08-17 18:24:50,015 [l0-3] DEBUG RPCManager - Content type for RPC transaction: text/html; charset=UTF-8
          === 2010-08-17 18:24:50,015 [l0-3] DEBUG RPCManager - DMI response, dropExtraFields: true
          === 2010-08-17 18:24:50,046 [l0-3] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:24:50,062 [l0-3] DEBUG XML - Parsed XML from (in memory stream): 0ms
          === 2010-08-17 18:24:50,062 [l0-3] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:24:50,062 [l0-3] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"fetch"
              },
              appID:"builtinApplication",
              operation:"imageTestDS_fetch",
              criteria:{
              }
          }
          === 2010-08-17 18:24:50,062 [l0-3] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:24:50,078 [l0-4] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:24:50,078 [l0-3] INFO  DSResponse - DSResponse: List with 1 items
          === 2010-08-17 18:24:50,078 [l0-3] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
          === 2010-08-17 18:24:50,078 [l0-3] DEBUG RPCManager - DMI response, dropExtraFields: true
          === 2010-08-17 18:24:50,093 [l0-4] DEBUG XML - Parsed XML from (in memory stream): 15ms
          === 2010-08-17 18:24:50,093 [l0-4] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:24:50,093 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              criteria:{
              },
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"fetch",
                  textMatchStyle:"exact"
              },
              startRow:0,
              endRow:75,
              componentId:"isc_OID_6",
              appID:"builtinApplication",
              operation:"imageTestDS_fetch",
              oldValues:{
              }
          }
          === 2010-08-17 18:24:50,093 [l0-4] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:24:50,093 [l0-4] INFO  DSResponse - DSResponse: List with 1 items
          === 2010-08-17 18:24:50,093 [l0-4] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
          === 2010-08-17 18:24:50,093 [l0-4] DEBUG RPCManager - DMI response, dropExtraFields: true
          === 2010-08-17 18:24:50,234 [l0-4] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:24:50,250 [l0-4] DEBUG XML - Parsed XML from (in memory stream): 0ms
          === 2010-08-17 18:24:50,250 [l0-4] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:24:50,250 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              criteria:{
                  code:0,
                  download_fieldname:"imageTest"
              },
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"viewFile"
              },
              appID:"builtinApplication",
              operation:"imageTestDS_viewFile",
              oldValues:{
                  code:0,
                  download_fieldname:"imageTest"
              }
          }
          === 2010-08-17 18:24:50,250 [l0-4] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:24:50,250 [l0-4] INFO  DSResponse - DSResponse: List with 1 items
          === 2010-08-17 18:25:01,093 [l0-4] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:25:01,109 [l0-4] DEBUG XML - Parsed XML from (in memory stream): 0ms
          === 2010-08-17 18:25:01,109 [l0-4] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:25:01,109 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              values:{
                  imageTest:"C:\\fakepath\\epocrate2.PNG",
                  _transaction:null,
                  code:null,
                  imageTest_filesize:25225,
                  imageTest_date_created:new Date(1282062301109),
                  imageTest_filename:"epocrate2.PNG"
              },
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"add"
              },
              componentId:"isc_DynamicForm_0",
              appID:"builtinApplication",
              operation:"imageTestDS_add",
              oldValues:{
              },
              criteria:{
              }
          }
          === 2010-08-17 18:25:01,109 [l0-4] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:25:01,125 [l0-4] WARN  Validation - No such type 'imageFile', not processing field value at /imageTestDS/imageTest
          === 2010-08-17 18:25:01,125 [l0-4] DEBUG RPCManager - Content type for RPC transaction: text/html; charset=UTF-8
          === 2010-08-17 18:25:01,125 [l0-4] DEBUG RPCManager - DMI response, dropExtraFields: true
          === 2010-08-17 18:25:01,156 [l0-4] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:25:01,156 [l0-4] DEBUG XML - Parsed XML from (in memory stream): 0ms
          === 2010-08-17 18:25:01,171 [l0-4] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:25:01,171 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"fetch"
              },
              appID:"builtinApplication",
              operation:"imageTestDS_fetch",
              criteria:{
              }
          }
          === 2010-08-17 18:25:01,171 [l0-4] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:25:01,171 [l0-4] INFO  DSResponse - DSResponse: List with 2 items
          === 2010-08-17 18:25:01,171 [l0-4] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
          === 2010-08-17 18:25:01,171 [l0-4] DEBUG RPCManager - DMI response, dropExtraFields: true
          === 2010-08-17 18:25:01,203 [l0-4] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:25:01,203 [l0-4] DEBUG XML - Parsed XML from (in memory stream): 0ms
          === 2010-08-17 18:25:01,203 [l0-4] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:25:01,203 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              criteria:{
                  code:0,
                  download_fieldname:"imageTest"
              },
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"viewFile"
              },
              appID:"builtinApplication",
              operation:"imageTestDS_viewFile",
              oldValues:{
                  code:0,
                  download_fieldname:"imageTest"
              }
          }
          === 2010-08-17 18:25:01,203 [l0-4] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:25:01,203 [l0-4] INFO  DSResponse - DSResponse: List with 2 items
          === 2010-08-17 18:25:11,781 [l0-4] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:25:11,781 [l0-4] DEBUG XML - Parsed XML from (in memory stream): 0ms
          === 2010-08-17 18:25:11,781 [l0-4] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:25:11,796 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              values:{
                  imageTest:"C:\\fakepath\\epocrate2.PNG",
                  _transaction:null,
                  code:null,
                  imageTest_filesize:25225,
                  imageTest_date_created:new Date(1282062311796),
                  imageTest_filename:"epocrate2.PNG"
              },
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"add"
              },
              componentId:"isc_DynamicForm_0",
              appID:"builtinApplication",
              operation:"imageTestDS_add",
              oldValues:{
              },
              criteria:{
              }
          }
          === 2010-08-17 18:25:11,796 [l0-4] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:25:11,796 [l0-4] WARN  Validation - No such type 'imageFile', not processing field value at /imageTestDS/imageTest
          === 2010-08-17 18:25:11,796 [l0-4] DEBUG RPCManager - Content type for RPC transaction: text/html; charset=UTF-8
          === 2010-08-17 18:25:11,796 [l0-4] DEBUG RPCManager - DMI response, dropExtraFields: true
          === 2010-08-17 18:25:11,828 [l0-4] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:25:11,843 [l0-4] DEBUG XML - Parsed XML from (in memory stream): 15ms
          === 2010-08-17 18:25:11,843 [l0-4] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:25:11,843 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"fetch"
              },
              appID:"builtinApplication",
              operation:"imageTestDS_fetch",
              criteria:{
              }
          }
          === 2010-08-17 18:25:11,843 [l0-4] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:25:11,843 [l0-4] INFO  DSResponse - DSResponse: List with 3 items
          === 2010-08-17 18:25:11,843 [l0-4] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
          === 2010-08-17 18:25:11,843 [l0-4] DEBUG RPCManager - DMI response, dropExtraFields: true
          === 2010-08-17 18:25:11,875 [l0-4] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)': MSIE with Accept-Encoding header, ready for compressed JS
          === 2010-08-17 18:25:11,890 [l0-4] DEBUG XML - Parsed XML from (in memory stream): 15ms
          === 2010-08-17 18:25:11,890 [l0-4] DEBUG RPCManager - Processing 1 requests.
          === 2010-08-17 18:25:11,890 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              criteria:{
                  code:0,
                  download_fieldname:"imageTest"
              },
              operationConfig:{
                  dataSource:"imageTestDS",
                  operationType:"viewFile"
              },
              appID:"builtinApplication",
              operation:"imageTestDS_viewFile",
              oldValues:{
                  code:0,
                  download_fieldname:"imageTest"
              }
          }
          === 2010-08-17 18:25:11,890 [l0-4] INFO  IDACall - Performing 1 operation(s)
          === 2010-08-17 18:25:11,890 [l0-4] INFO  DSResponse - DSResponse: List with 3 items
          Did you try my sample on your environment ?
          Could you write a functional sample with this
          Code:
          <field name="imageTest"  title="Test image"   type="imageFile" required="false" showFileInline="true">
          in a DMI architecture ?

          Comment


            #6
            Thanks for providing the logs. Unfortunately they still leave the problem ambiguous - there are a few "viewFile" operations, in some the response is clearly wrong (the logs report "DSResponse: List with 3 items") when there should be no more than one. But there is also one response where only one item is returned, which presumably still didn't work?

            We'd suggest:
            1) update to 2.3, since there were fixes in the area which might solve your problem
            2) try to figure out how you end up returning more than one item, and avoid that

            Comment


              #7
              Hi,
              Thanks for the answer.
              I upgraded to 2.3 of SmartGWTPro, but it didn't change anything.
              I enclose some new logs. As you can see it in my DownloadDMI java class, the list with more than one element came from the tests I did (see commented lines), but it doesn't change anything to the problem.
              server logs :
              Code:
              === 2010-08-18 14:05:22,187 [l0-9] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\load_skin.js
              === 2010-08-18 14:05:23,343 [l0-5] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\skin_styles.css
              === 2010-08-18 14:05:27,765 [l0-5] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\blank.gif
              === 2010-08-18 14:05:27,843 [l0-9] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_stretch.png
              === 2010-08-18 14:05:27,859 [l0-5] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_start.png
              === 2010-08-18 14:05:27,859 [0-12] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_end.png
              === 2010-08-18 14:05:27,859 [0-12] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\ListGrid\header.png
              === 2010-08-18 14:05:27,937 [0-12] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Splitbar\hsplit_snap.png
              === 2010-08-18 14:05:27,937 [l0-5] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Splitbar\hsplit_bg.png
              === 2010-08-18 14:05:29,906 [0-12] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\ListGrid\header_menu.png
              === 2010-08-18 14:05:29,906 [0-12] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\ListGrid\header_Over.png
              === 2010-08-18 14:05:32,578 [0-12] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_Over_start.png
              === 2010-08-18 14:05:32,578 [l0-5] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_Over_stretch.png
              === 2010-08-18 14:05:32,578 [l0-9] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_Over_end.png
              === 2010-08-18 14:05:33,046 [l0-9] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_Down_start.png
              === 2010-08-18 14:05:33,046 [l0-9] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_Down_end.png
              === 2010-08-18 14:05:33,046 [l0-5] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\button\button_Down_stretch.png
              === 2010-08-18 14:05:33,234 [l0-9] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Window\window_TR.png
              === 2010-08-18 14:05:33,234 [0-11] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Window\window_BL.png
              === 2010-08-18 14:05:33,234 [0-11] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Window\window_BR.png
              === 2010-08-18 14:05:33,234 [l0-9] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Window\window_B.png
              === 2010-08-18 14:05:33,234 [0-10] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Window\window_L.png
              === 2010-08-18 14:05:33,234 [l0-8] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Window\window_R.png
              === 2010-08-18 14:05:33,234 [l0-5] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Window\window_TL.png
              === 2010-08-18 14:05:33,234 [0-12] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\Window\window_T.png
              === 2010-08-18 14:05:33,265 [l0-5] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11': Moz (Gecko) with Accept-Encoding header
              === 2010-08-18 14:05:33,265 [l0-5] DEBUG XML - Parsed XML from (in memory stream): 0ms
              === 2010-08-18 14:05:33,281 [l0-5] DEBUG RPCManager - Processing 1 requests.
              === 2010-08-18 14:05:33,281 [l0-5] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  values:{
                      imageTest:"epocrate2.PNG",
                      imageTest_filesize:25225,
                      imageTest_date_created:new Date(1282133133281),
                      imageTest_filename:"epocrate2.PNG"
                  },
                  operationConfig:{
                      dataSource:"imageTestDS",
                      operationType:"add"
                  },
                  componentId:"isc_DynamicForm_1",
                  appID:"builtinApplication",
                  operation:"imageTestDS_add",
                  oldValues:{
                  },
                  criteria:{
                  }
              }
              === 2010-08-18 14:05:33,281 [l0-5] INFO  IDACall - Performing 1 operation(s)
              === 2010-08-18 14:05:33,281 [l0-5] WARN  Validation - No such type 'imageFile', not processing field value at /imageTestDS/imageTest
              === 2010-08-18 14:05:33,281 [l0-5] DEBUG RPCManager - Content type for RPC transaction: text/html; charset=UTF-8
              === 2010-08-18 14:05:33,281 [l0-5] DEBUG RPCManager - DMI response, dropExtraFields: true
              === 2010-08-18 14:05:33,312 [l0-5] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11': Moz (Gecko) with Accept-Encoding header
              === 2010-08-18 14:05:33,312 [0-12] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11': Moz (Gecko) with Accept-Encoding header
              === 2010-08-18 14:05:33,328 [l0-5] DEBUG XML - Parsed XML from (in memory stream): 16ms
              === 2010-08-18 14:05:33,328 [l0-5] DEBUG RPCManager - Processing 1 requests.
              === 2010-08-18 14:05:33,328 [l0-5] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                  },
                  operationConfig:{
                      dataSource:"imageTestDS",
                      operationType:"fetch"
                  },
                  componentId:"isc_DynamicForm_2",
                  appID:"builtinApplication",
                  operation:"imageTestDS_fetch",
                  oldValues:{
                  }
              }
              === 2010-08-18 14:05:33,328 [l0-5] INFO  IDACall - Performing 1 operation(s)
              === 2010-08-18 14:05:33,328 [l0-5] INFO  DSResponse - DSResponse: List with 1 items
              === 2010-08-18 14:05:33,328 [l0-5] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
              === 2010-08-18 14:05:33,328 [l0-5] DEBUG RPCManager - DMI response, dropExtraFields: true
              === 2010-08-18 14:05:33,328 [0-12] DEBUG XML - Parsed XML from (in memory stream): 16ms
              === 2010-08-18 14:05:33,328 [0-12] DEBUG RPCManager - Processing 1 requests.
              === 2010-08-18 14:05:33,328 [0-12] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                  },
                  operationConfig:{
                      dataSource:"imageTestDS",
                      operationType:"fetch",
                      textMatchStyle:"exact"
                  },
                  startRow:0,
                  endRow:75,
                  componentId:"isc_ListGrid_0",
                  appID:"builtinApplication",
                  operation:"imageTestDS_fetch",
                  oldValues:{
                  }
              }
              === 2010-08-18 14:05:33,328 [0-12] INFO  IDACall - Performing 1 operation(s)
              === 2010-08-18 14:05:33,328 [0-12] INFO  DSResponse - DSResponse: List with 1 items
              === 2010-08-18 14:05:33,328 [0-12] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
              === 2010-08-18 14:05:33,328 [0-12] DEBUG RPCManager - DMI response, dropExtraFields: true
              === 2010-08-18 14:05:33,437 [0-12] INFO  RequestContext - URL: '/jira/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11': Moz (Gecko) with Accept-Encoding header
              === 2010-08-18 14:05:33,453 [0-12] DEBUG XML - Parsed XML from (in memory stream): 16ms
              === 2010-08-18 14:05:33,453 [0-12] DEBUG RPCManager - Processing 1 requests.
              === 2010-08-18 14:05:33,453 [0-12] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                      code:0,
                      download_fieldname:"imageTest"
                  },
                  operationConfig:{
                      dataSource:"imageTestDS",
                      operationType:"viewFile"
                  },
                  appID:"builtinApplication",
                  operation:"imageTestDS_viewFile",
                  oldValues:{
                      code:0,
                      download_fieldname:"imageTest"
                  }
              }
              === 2010-08-18 14:05:33,453 [0-12] INFO  IDACall - Performing 1 operation(s)
              === 2010-08-18 14:05:33,453 [0-12] INFO  DSResponse - DSResponse: List with 1 items
              === 2010-08-18 14:05:34,671 [0-12] INFO  Download - Returning 304: Not modified on conditional get of: D:\CCREclipse\workspace\CCRFichesJiraUtilisateurs\war\jira\sc\skins\Enterprise\images\ListGrid\row_Over.png
              === 2010-08-18 14:05:35,437 [0-12] INFO  RequestContext - URL: '/jira/sc/skins/Enterprise/images/ListGrid/row_Over_Selected.png', User-Agent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11': Moz (Gecko) with Accept-Encoding header
              === 2010-08-18 14:05:35,437 [0-12] INFO  Download - done streaming: D:/CCREclipse/workspace/CCRFichesJiraUtilisateurs/war/jira/sc/skins/Enterprise/images/ListGrid/row_Over_Selected.png
              Download DMI
              Code:
              import java.util.ArrayList;
              import java.util.List;
              
              import com.isomorphic.datasource.DSRequest;
              import com.isomorphic.datasource.DSResponse;
              import com.isomorphic.rpc.RPCManager;
              
              public class DownloadImageDMI {
              	public DSResponse viewFile(DSRequest dsRequest, RPCManager rpcManager) throws Exception {
              		 DSResponse dsResponse = new DSResponse();  
              		 rpcManager.doCustomResponse(); 
              //	 dsResponse.setData(new FileInputStream( "C:/testImage.png" ));
              //	 dsResponse.setData(ImageObject.getImages());
              		 
              		 List<ImageObject> r = new ArrayList<ImageObject>();
              		 r.add(ImageObject.getImages().get(0));
              		 dsResponse.setData(r);
              
              		 return dsResponse;
              	}
              }
              Have you tried to copy and paste my sample in order to reproduce the problem ?
              I'm very upset with this bug / misunderstanding.

              Thanks in advance for your answer

              Comment


                #8
                Hi KFang,

                Basically you have 2 approaches here:

                The recommended approach is to make use of the SmartClient server's ability to extract the file directly from a single record type object (actually a Map) stored on a DSResponse.

                To do this: firstly, remove the call to rpcManager.doCustomResponse(). This setting would disable the standard SmartClient server logic that serializes a dsResponse out to the ServletResponse object.

                For binary / imageFile type fields we send a couple of additional fields down to the server in the add/update type requests and expect them to be present on the response data for viewFile operations (and also on the record objects for the dataSource). These are the fieldName_filename and fieldName_filesize fields.
                The easiest way to get things working is to add these directly to your ImageObject class
                Code:
                    ...
                	private long imageTest_filesize;
                	
                	private String imageTest_filename;
                	
                    ...
                	public void setImageTest_filesize(long imageTest_filesize) {
                		this.imageTest_filesize = imageTest_filesize;
                	}
                	public long getImageTest_filesize() {
                		return imageTest_filesize;
                	}
                	public void setImageTest_filename(String imageTest_filename) {
                		this.imageTest_filename = imageTest_filename;
                	}
                	public String getImageTest_filename() {
                		return imageTest_filename;
                	}
                You'll need to hang onto these in your add operation (and they'll automatically be present as part of fetch responses):
                Code:
                	public ImageObject add(DSRequest record) throws Exception {  
                		ImageObject newImage = new ImageObject();
                		newImage.setCode(record.getParameter("code") == null ? 0 : (Integer)record.getParameter("codeDemande"));
                		newImage.setTitle((String)record.getFieldValue("title"));
                		ISCFileItem file = record.getUploadedFile("imageTest");
                		InputStream stream = file.getInputStream();
                		newImage.setImageTest(stream);
                		newImage.setImageTest_filesize(file.getSize());
                		newImage.setImageTest_filename(file.getFileName());
                		
                		ImageObject.getImages().add(newImage);
                		
                		return newImage;  
                	}
                When you're putting together your dsResponse in the special viewFile method the dsResponse.data object should be set to a Map, and should contain the image InputStream, but also the filename and filesize - like this:
                Code:
                	public DSResponse viewFile(DSRequest dsRequest, RPCManager rpcManager) throws Exception {
                		 DSResponse dsResponse = new DSResponse();  
                		 if (ImageObject.getImages().size() == 0) return dsResponse;
                		 
                		 // Note: demo code is getting the first image - you'd actually want to look at the dsRequest 
                		 // criteria and pick up the image based on the primary key of the record of course
                		 ImageObject img = ImageObject.getImages().get(0);
                		
                		 Map rData = new HashMap();
                		 rData.put("imageTest_filesize", img.getImageTest_filesize());
                		 rData.put("imageTest_filename", img.getImageTest_filename());
                		 rData.put("imageTest", img.getImageTest());
                		 dsResponse.setData(rData);
                		
                		 return dsResponse;
                	}
                The other approach would be to handle writing your file InputStream directly into the HttpServletResponse yourself. In this case you would call rpcManager.doCustomResponse(); in viewFile. You could get a pointer to the HttpServletResponse object by simply adding a parameter for it to your method signature, and you could interact with it directly to return the file.

                Comment


                  #9
                  Hi,

                  Thanks a lot for your answer, it's now working (or almost).
                  Do you know how I could resize the downloaded image in the form (ie give it a max width and max height ) ?

                  Thans in advance

                  Comment


                    #10
                    You should be able to set a *fixed* width and height by applying field.imageWidth/Height, or with field.imageSize - let us know if that isn't sufficient

                    Comment


                      #11
                      Thanks for the answer, the
                      Code:
                      setAttribute("imageHeight", 150)
                      method works fine for the type
                      Code:
                      ViewFileItem

                      Comment


                        #12
                        Hi,
                        I was wonder if I can use this same concept to create a file download manager that would download a file to a client machine. I want to be able to handle force download, monitor file size ...

                        Thanks,

                        Comment


                          #13
                          Sure. Note that most of this thread is about an already-corrected bug, so you'd start by just following the example in the Showcase, which covers picking which file to download from a list.

                          Comment

                          Working...
                          X