Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Updates to upload widget
Updates to upload widget [message #531551] Wed, 05 May 2010 11:54 Go to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi,

there have been some updates to the upload widget in the RAP sandbox
that unfortunately come with some minor API changes:

311685 [upload] Upload Widget swallows exceptions
311670 [upload] It should be possible to specify a maximum file size

There's a new listener UploadListener#uploadException() that can be used
to listen to exceptions that ocurred on the server side while processing
the request. An example for such error is that the specified maximum
file size is exceeded.

The listener UploadListener#uploadFinished() is now only called if the
upload suceeded but not in case of errors.

Sorry for any inconveniences.

Regards,
Stefan.
Re: Updates to upload widget [message #537408 is a reply to message #531551] Wed, 02 June 2010 11:27 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

Hey Stefan,

Your uploadException trough the Lister works like a charm, how ever I have a at this moment you throw back an Exception, how ever there are several error type the FileUploadBase can throw that are interesting to catch to give a clearer error for example the FileSizeLimitExceededException so that you can give a decent error. How ever at this moment we only get the Message of that error not the error it self.

If you want to check if its a FileSizeLimitExceededException you need to cast it to it. Maybe there should eb somting like a method that alouws you to see what kind of excpetion it is with the help of an Enum so that the implemantiont is free of links to org.apache.commons.fileupload.FileUploadBase.


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Re: Updates to upload widget [message #537951 is a reply to message #537408] Fri, 04 June 2010 09:44 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi Martijn,

the exception is the sames that actually is thrown by the fileupload
component. You can use sth like this in your listener implementation:

@Override
public void uploadException(final UploadEvent uploadEvent) {
final Exception exc = uploadEvent.getUploadException();
if (exc instanceof FileSizeLimitExceededException) {
MessageDialog.openError(Display.getCurrent().getActiveShell( ), "File
too large", exc.getMessage());
}
}


What excactly doesn't work for you?

Thanks & Regards,
Stefan.


Martijn Cremer schrieb:
> Hey Stefan,
>
> Your uploadException trough the Lister works like a charm, how ever I
> have a at this moment you throw back an Exception, how ever there are
> several error type the FileUploadBase can throw that are interesting to
> catch to give a clearer error for example the
> FileSizeLimitExceededException so that you can give a decent error. How
> ever at this moment we only get the Message of that error not the error
> it self.
>
> If you want to check if its a FileSizeLimitExceededException you need
> to cast it to it. Maybe there should eb somting like a method that
> alouws you to see what kind of excpetion it is with the help of an Enum
> so that the implemantiont is free of links to
> org.apache.commons.fileupload.FileUploadBase.
Re: Updates to upload widget [message #537956 is a reply to message #537951] Fri, 04 June 2010 10:23 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

That by introducing that code you have to import the org.apache.commons.fileupload package to a GUI element while you would expect that the RWT package would handle this. You do not want have to import such a thing to a GUI element the RWT widget should handle this. If you do it like that you import the org.apache.commons.fileupload plugin your creating a duble dependesie while you want it as loose as posible.

The whole I dea I have in my mind is that you try to have the most loosless dependesies between packages (eg OSGi like) and not importing things your sub package has.


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.

[Updated on: Fri, 04 June 2010 10:24]

Report message to a moderator

Re: Updates to upload widget [message #538734 is a reply to message #537956] Tue, 08 June 2010 14:00 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi Martijn,

I understand your point. However, I'm not sure if its a good idea to
wrap all possible exceptions with a own type (with the risk to miss new
exceptions that come with newer versions...).

What do others think?

Regards,
Stefan.


Martijn Cremer schrieb:
> That by introducing that code you have to import the
> org.apache.commons.fileupload package to a GUI element while you would
> expect that the RWT package would handle this. You do not want have to
> import such a thing to a GUI element the RWT widget should handle this.
> If you do it like that you import the org.apache.commons.fileupload
> plugin your creating a duble dependesie while you want it as loose as
> posible.
Re: Updates to upload widget [message #538971 is a reply to message #538734] Wed, 09 June 2010 08:48 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

Stefan Röck wrote on Tue, 08 June 2010 16:00
Hi Martijn,

I understand your point. However, I'm not sure if its a good idea to
wrap all possible exceptions with a own type (with the risk to miss new
exceptions that come with newer versions...).

What do others think?

Regards,
Stefan.



I think the main problem is that we need to catch mostly the errors concerning the FileUploadBase Errors should be cough these Exeptions are the ones you want to give your end user a proper error. (a.t.m.I am importing these Errors in the GUI so I can give decent errors to the end user).

I was thinking in the lines you can have 2 types of errors from the Widget 1st is a FileUploadExeption that gives all the information from the FileUploadBase errors and also makes sure its containing the information needed (size, max size etc). And a normal Exception for all the types you don't process. These are more often Unhanded Exceptions that have nothing directly to do with the Upload Action it self.


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Re: Updates to upload widget [message #540944 is a reply to message #538971] Thu, 17 June 2010 16:39 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Martijn,

I understand your request under the aspect of single sourcing. I think
this is a valid use case and a good reason to hide the Apache specific
API. I will change this as you suggested.

Regards,
Stefan.
Re: Updates to upload widget [message #541062 is a reply to message #540944] Fri, 18 June 2010 08:17 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

Stefan,

That's great news. Im starting to make a RCP Upload widget based on this code so when I got that working ill try to use the Same Error (if needed we can see if there is a good option in between the to extremes).

Whit kind regards,

Martijn

Stefan Röck wrote on Thu, 17 June 2010 18:39
Martijn,

I understand your request under the aspect of single sourcing. I think
this is a valid use case and a good reason to hide the Apache specific
API. I will change this as you suggested.

Regards,
Stefan.





hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Re: Updates to upload widget [message #541462 is a reply to message #541062] Mon, 21 June 2010 09:33 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

I created an enhancement request for the Upload widget to create a SWT version of this widget so that Single Sourcing with the use of the Upload Widget is possible.

I would like some feedback on this from all of you. I already had to make small changes to the current Upload Widget to make it a bit more manageable to change it to SWT.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=317403


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.

[Updated on: Mon, 21 June 2010 09:36]

Report message to a moderator

Re: Updates to upload widget [message #546828 is a reply to message #531551] Wed, 14 July 2010 11:21 Go to previous message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

Created first version of the RCP version of upload Widget based on the RAP version. Still a lot of work that needs 2 be done. But seeing its my first Widget (custom) I wouldn't mind hearing feedback from you folks.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=317403#c5


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Previous Topic:I create my custom Widget, How to show the changes for UI in js?
Next Topic:Call sequence of the Listeners
Goto Forum:
  


Current Time: Fri Apr 19 20:44:32 GMT 2024

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

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

Back to the top