Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Can't make work UploadItem - Client freeze on SocketInputStream

$
0
0
I have a DynamicForm with only an UploadItem in order to upload an image file to the server.

Code:

mainForm = new DynamicForm();
mainForm.setNumCols(2);
mainForm.setHeight100();

UploadItem fileItem = new UploadItem("imageData", "Image Data");
fileItem.setShowTitle(false);

DataSource dsImageBinary = DataSources.IMAGEBINARY.rest();

mainForm.setDataSource(dsImageBinary);
mainForm.setItems(fileItem);
addMember(mainForm);

I have the corresponding datasource.ds.xml file

Code:

<DataSource ID="imagebinary" dataURL="../catv_webservices/imagebinary?app=catv_client">

    <fields>
    <field primaryKey="true" name="id" hidden="true" type="sequence" />
    <field name="imageData" type="imageFile" />
  </fields>
</DataSource>

I choose a file with the UploadItem and perform
Code:

mainForm.saveData();
On the server side, my REST WS handle the request and retrieve the file, I create file in some directory and answer back the file encoded in Base64

Code:

"response" : {
    "status" : 0,
    "data" : [ {
      "id" : 1,
      "imageData" : "data:image/png;base64,iVBOR..."
    } ]
  }
}

As the result my client is freeze waiting in the read() method of SocketInputStream, i don't know why. Can somebody help me ?

Viewing all articles
Browse latest Browse all 4756

Trending Articles