Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Corrupted file using IRemoteFileService ...
Corrupted file using IRemoteFileService ... [message #989193] Wed, 05 December 2012 07:20 Go to next message
Boy D'Poy is currently offline Boy D'PoyFriend
Messages: 67
Registered: October 2011
Member
Hi!

I followed the example listed here : http://wiki.eclipse.org/Scout/HowTo/3.7/Use_RemoteFileService.


I have this configuration:

### Server RemoteFileService root path
org.eclipse.scout.rt.server.services.common.file.RemoteFileService#rootPath=/home/me/remotefiles/

*

In my source code, this portion works fine ...

String source = "pdfFile.pdf";
final RemoteFile result = SERVICES.getService(IRemoteFileService.class).getRemoteFile(new RemoteFile(source, 0L));
MyForm#this#AbstractBrowserField#setValue(result);

Except that the result file seems to be corrupted!

So, the used AbstractBrowserField renders for example, for this pdf file, the same number of pages as the source file on the scout server but the texts disappears ... even if the result file is flushed on another directory (i.e. not in the AbstractBrowserField).

What could be the reason?
Thank you!


Once You Go Scout, You Never Come Out!
Re: Corrupted file using IRemoteFileService ... [message #989234 is a reply to message #989193] Wed, 05 December 2012 10:19 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
You need to identify where something get wrong:
- When putting a PDF File into the RemoteFile Object (could be an encoding problem).
- When transfering the Remote file from the Server to the Client
- When the AbstractBrowserField read the PDF file
- When the AbstractBrowserField renders the PDF.

You could start your investigation with:
* An other file than a PDF file (eg. Text file without any special char).
* Loading the PDF directly on the client and passing it to the AbstractBrowserField.

Do not hesitate to post your findings here...
Re: Corrupted file using IRemoteFileService ... [message #989282 is a reply to message #989234] Wed, 05 December 2012 14:07 Go to previous messageGo to next message
Boy D'Poy is currently offline Boy D'PoyFriend
Messages: 67
Registered: October 2011
Member
I think it's a matter of charset:

when trying to get a simple text file, everything works fine even with special characters!
typing the command "file -i sample.txt" returns utf-8 encoding; the default charset.

So I tried "file -i pdffile.pdf" and I got binary as encoding charset.

the new problem is now that I don't know how to supply 'binary' as charset (final RemoteFile result = SERVICES.getService(IRemoteFileService.class).getRemoteFile(new RemoteFile(source, 0L, "binary")); always returns an incorrect file)


Once You Go Scout, You Never Come Out!
Re: Corrupted file using IRemoteFileService ... [message #990072 is a reply to message #989282] Mon, 10 December 2012 18:02 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I think that you try to do something was never done with Eclipse Scout.
I am not sure that the RemoteFile and IRemoteFileService is suitable to transfert PDF. That is something we could try to support.

Do you have a minimal application (I imagine a just need a single from application with a Browser Field) and an example PDF (Or does it append with every PDF File) ?
Re: Corrupted file using IRemoteFileService ... [message #990086 is a reply to message #990072] Mon, 10 December 2012 19:44 Go to previous messageGo to next message
Boy D'Poy is currently offline Boy D'PoyFriend
Messages: 67
Registered: October 2011
Member
the same problem happens on evrey kind of file (mp3, jpg, ....) except text files for wich the transfert is successful.

you're right saying that the this is new to Scout, in my opinion, the RemoteFileService only works right now for text files. (DecompressedReader/Writer should be enhanced to handle binary files I think)


Once You Go Scout, You Never Come Out!

[Updated on: Mon, 10 December 2012 19:48]

Report message to a moderator

Re: Corrupted file using IRemoteFileService ... [message #990207 is a reply to message #990086] Tue, 11 December 2012 12:02 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

For your information, I am using remote file service (Scout Indigo SR2) to transfer mp3 files from server to client and then play them. That works fine.

Regards Bertin


      @Override
      protected void execAction() throws ProcessingException {

        String filename = getGeluidFilenameColumn().getSelectedValue();

        RemoteFile file = SERVICES.getService(IRemoteFileService.class).getRemoteFile(new RemoteFile("sounds", filename, 0l));
        if (file.exists()) {
          try {
            file.extractData();
            InputStream is = new ByteArrayInputStream(file.extractData());
            Sound.playMP3(is);
          }
          catch (IOException e) {
            e.printStackTrace();
          }
        }
        else {
          MessageBox mb = new MessageBox("File not found", filename, "OK");
          mb.setIconId(Icons.StatusError);
          mb.setAutoCloseMillis(2000);
          mb.startMessageBox();
        }
      }


Re: Corrupted file using IRemoteFileService ... [message #990353 is a reply to message #990207] Wed, 12 December 2012 06:41 Go to previous message
Boy D'Poy is currently offline Boy D'PoyFriend
Messages: 67
Registered: October 2011
Member
hello,

thank you for your answer, but your proposed solution requires to transform the resulting as your destination component (the MP3 players) uses an InputStream.

This doesn't macth well with my situation where I use an AbstractBrowser, which needs a (result) RemoteFile as parameter.


Once You Go Scout, You Never Come Out!
Previous Topic:Deleting Rows in TableField not calling store
Next Topic:Reusing the same formData member on more than one field
Goto Forum:
  


Current Time: Thu Apr 25 11:38:28 GMT 2024

Powered by FUDForum. Page generated in 3.83460 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top