Upload file code deprecation [message #938260] |
Tue, 09 October 2012 18:10 |
Lily Ye Messages: 3 Registered: October 2012 |
Junior Member |
|
|
Hi,
We bought a production from a vendor many years ago, who used eclipse to develop the application. But the vendor is no longer support this application. Right now we have to make some changes to the applications, although we don't have any expertise in eclipse/java. Anyway, we imported the application to eclipse workspace (we are using
Eclipse for RCP and RAP developers; version Indigo Service Release 2, Build id 20120216-1857). We were able to compile the application (although we do see some warning messages) and created a war file and deployed it to tomcat on linux server. And we were able to upload a file. BUT the name of the upload file was changed to 'upload.1508403605239944151.tmp' instead of keeping the original file name (i.e. tran1009.xml). This caused problem to the application to continue processing. We realize/understand "org.eclipse.rwt.widgets.Upload" and "org.eclipse.rwt.widgets.UploadItem" are obsolete or no longer valid in new eclipse. We are wondering if it's still possible we can use the old code (upload function) by including some some lib/jar/patch... So we don't have to change the program if we could avoid. OR if we have to change our programs, would you please give us some guideline or sample to convert the old upload codes to new upload function.
Thank you so much for your help!
Lily
=======
private void createUploadWidget1(Composite parent) {
final Upload upload = new Upload(parent, SWT.BORDER, SWT.NONE);
upload.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Label l = new Label(parent, SWT.WRAP);
l.setText("");
ClassLoader classLoader = getClass().getClassLoader();
Image buttonImage = Graphics.getImage(BUTTON_IMAGE_PATH, classLoader);
final Button btnStartUpload = new Button(parent, SWT.PUSH);
btnStartUpload.setText("Upload selected file");
btnStartUpload.setImage(buttonImage);
btnStartUpload.setEnabled(false);
btnStartUpload.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
upload.performUpload();
handleUploadFinished(upload);
}
});
upload.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
if (!"".equals(upload.getPath())) {
btnStartUpload.setEnabled(true);
}
}
});
}
|
|
|
Re: Upload file code deprecation [message #938283 is a reply to message #938260] |
Tue, 09 October 2012 18:33 |
Ivan Furnadjiev Messages: 2427 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi,
this has been fixed with bug:
358248: File upload handler does not return actual selected filename
https://bugs.eclipse.org/bugs/show_bug.cgi?id=358248
the file name is preserved when uploading. You should use the FileUpload
for RAP 1.5.
Best,
Ivan
On 10/9/2012 9:10 PM, Lily Ye wrote:
> Hi,
> We bought a production from a vendor many years ago, who used eclipse
> to develop the application. But the vendor is no longer support this
> application. Right now we have to make some changes to the
> applications, although we don't have any expertise in eclipse/java.
> Anyway, we imported the application to eclipse workspace (we are using
> Eclipse for RCP and RAP developers; version Indigo Service Release 2,
> Build id 20120216-1857). We were able to compile the application
> (although we do see some warning messages) and created a war file and
> deployed it to tomcat on linux server. And we were able to upload a
> file. BUT the name of the upload file was changed to
> 'upload.1508403605239944151.tmp' instead of keeping the original file
> name (i.e. tran1009.xml). This caused problem to the application to
> continue processing. We realize/understand
> "org.eclipse.rwt.widgets.Upload" and
> "org.eclipse.rwt.widgets.UploadItem" are obsolete or no longer valid
> in new eclipse. We are wondering if it's still possible we can use the
> old code (upload function) by including some some lib/jar/patch... So
> we don't have to change the program if we could avoid. OR if we have
> to change our programs, would you please give us some guideline or
> sample to convert the old upload codes to new upload function.
> Thank you so much for your help!
> Lily
> ======= private void createUploadWidget1(Composite parent) {
>
> final Upload upload = new Upload(parent, SWT.BORDER, SWT.NONE);
> upload.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
> true));
>
> Label l = new Label(parent, SWT.WRAP);
> l.setText("");
>
> ClassLoader classLoader = getClass().getClassLoader();
> Image buttonImage = Graphics.getImage(BUTTON_IMAGE_PATH,
> classLoader);
>
> final Button btnStartUpload = new Button(parent, SWT.PUSH);
> btnStartUpload.setText("Upload selected file");
> btnStartUpload.setImage(buttonImage);
> btnStartUpload.setEnabled(false);
> btnStartUpload.addSelectionListener(new SelectionAdapter() {
> @Override
> public void widgetSelected(SelectionEvent e) {
> upload.performUpload();
> handleUploadFinished(upload);
> }
> });
>
> upload.addModifyListener(new ModifyListener() {
> public void modifyText(ModifyEvent event) {
> if (!"".equals(upload.getPath())) {
> btnStartUpload.setEnabled(true);
> }
> }
>
> });
>
> }
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04144 seconds