Announcement

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

    Can not find the file path when deployed to weblogic?

    Hi,

    I put a file for downloading in ../war/raw/filefordownload.apk, it works fine when ran in eclipse. But when deployed in weblogic, DataSourcesServer can not find the raw/filefordownload.apk. Anybody tell me how to solve this path issue? Thanks in advance.

    Env: jdk1.7, eclipse mars, smartgwt6, gwt2.7, windows8.1

    CustomBinaryFieldDataSource.java

    Code:
        public DSResponse execute(DSRequest dsRequest) throws Exception {  
            
            
            DSResponse dsResponse = new DSResponse(this);  
      
            final Map<String, Object> criteria = dsRequest.getCriteria();  
            final Object recordId = criteria.get("id");  
            final String operationType = dsRequest.getOperationType();  
            final HttpSession httpSession = dsRequest.context.request.getSession();  
            
    
            if (operationType.equals("viewFile") || operationType.equals("downloadFile")) {  
                
                
                Map<String, Object> record22 = new HashMap<String, Object>();  
              
                byte[] filebytes = null;
                try {
                    
                    filebytes = getContent("raw/thirdexist200_no_ad.apk");//[B] How to fixed the path issue when deployed to weblogic?[/B]
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
              
                    
                record22.put("id", 1);  
                record22.put("file", filebytes);  
                record22.put("file_filename", "thirdexist200_no_ad.apk");  
                record22.put("file_filesize", filebytes.length);  
                record22.put("file_date_created", new Date());  
                record22.put("description", desc1);
                    criteria.putAll(record22);
                dsResponse.setData(criteria);  
            } else if (operationType.equals("fetch")) {  
                dsResponse = this.executeFetch(dsRequest);  
            } else if (operationType.equals("add")) {  
                dsResponse = this.executeAdd(dsRequest);  
            } else if (operationType.equals("update")) {  
                dsResponse = this.executeUpdate(dsRequest);  
            }  
      
            return dsResponse;  
        }

    downloadfile.ds.xml
    Code:
    <DataSource
        ID="download_file"
        serverConstructor="com.jeff.server.CustomBinaryFieldDataSource" 
     >
        <fields>
            <field name="id"          type="sequence" title="ID"       primaryKey="true"/>
            <field name="file"          type="binary"   title="File"/>
        </fields>
            
    </DataSource>


    UI CODE

    Code:
    ...
    downloadds = DataSource.get("download_file");
    ...
    ...
    
    dl_android_button.addClickHandler(new ClickHandler(){
                @Override
                public void onClick(ClickEvent event) {
                    ListGridRecord selectedRecord = new ListGridRecord();
                    selectedRecord.setAttribute("id", "1");
                    downloadds.downloadFile(selectedRecord);        
                }        
            });

    Jeff
    Last edited by pkuyjxu; 25 May 2016, 22:14.

    #2
    filebytes = getContent("raw/thirdexist200_no_ad.apk");// How to fixed the path issue when deployed to weblogic?

    Comment

    Working...
    X