Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » FileUpload issue(FileUpload issue while uploading a file)
FileUpload issue [message #1839748] Sat, 27 March 2021 07:39 Go to next message
Jean-Baptiste Meyer is currently offline Jean-Baptiste MeyerFriend
Messages: 16
Registered: February 2021
Junior Member
Hello,
I'm building a rap application and I use a fileUpload widget.
I really simplified to code to understand what's happening.

Here is what I do
public class UploadHandler extends AbstractHandler {

	public static final String LOCAL_DEVICE_SHAPE_XMI_FILE = "localDeviceShapeXmiFile";

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		FileDialog fileDialog = new FileDialog(HandlerUtil.getActiveShell(event), SWT.OPEN);
		fileDialog.setFilterExtensions(new String[] { ".xmi" });
try {
		String file = fileDialog.open();
		MessageDialog.openInformation(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), "Info",
				"Uploaded and stored here " + file);
}catch (Throwable e) {
	e.printStackTrace();
}
}


It's working perfectly when I start the application within eclipse
index.php/fa/40225/0/

Now I start the application outside eclipse(I packaged it as a war file and deploying in tomcat 9) and the upload part is not working ( Error 500)
index.php/fa/40227/0/

The error is :
Status Report : Message
The system cannot find the path specified
Description The server encountered an unexpected condition that prevented it from fulfilling the request

I'm running equinox with servlet bridge and the osgi bundles are well started
(when I type SS )
16 ACTIVE org.apache.commons.fileupload_1.3.2.v20170320-2229
58 ACTIVE org.eclipse.rap.fileupload_3.16.0.20210107-1425
59 ACTIVE org.eclipse.rap.filedialog_3.16.0.20210107-1310

I do not see errors in the osgi console
( I started my servlet in the web.xml with the following arguments like in eclipse )
<init-param>
<param-name>commandline</param-name>
<param-value>-console -consoleLog</param-value>
</init-param>

Can someone guide me to understand what's happening ?
Thanks
  • Attachment: uploadOK.png
    (Size: 5.92KB, Downloaded 67 times)
  • Attachment: UploadNOK.png
    (Size: 54.24KB, Downloaded 57 times)

[Updated on: Sat, 27 March 2021 07:40]

Report message to a moderator

Re: FileUpload issue [message #1839751 is a reply to message #1839748] Sat, 27 March 2021 08:21 Go to previous messageGo to next message
Jean-Baptiste Meyer is currently offline Jean-Baptiste MeyerFriend
Messages: 16
Registered: February 2021
Junior Member
When starting in debug mode In FileDialog.open
I'm having this error OS.FNERR_INVALIDFILENAME
( public static final int FNERR_INVALIDFILENAME = 0x3002; )


index.php/fa/40231/0/
  • Attachment: OSError.png
    (Size: 23.52KB, Downloaded 49 times)
Re: FileUpload issue [message #1839763 is a reply to message #1839751] Sat, 27 March 2021 21:26 Go to previous message
Jean-Baptiste Meyer is currently offline Jean-Baptiste MeyerFriend
Messages: 16
Registered: February 2021
Junior Member
I was able to fix.
First my project was containing org.eclipse.swt bundle which was not the one to use. That's why the debug part was not showing the bundle org.eclipse.rap.FileDialog.

Then the temporary file seemed not to be set ( but set by eclipse that why it was working )
So I added
fileDialog.setUploadDirectory(new File(myDir));
Previous Topic:How to use nebula RichTextCellLabelProvider
Next Topic:Web Service on RAP
Goto Forum:
  


Current Time: Tue Sep 28 11:37:36 GMT 2021

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

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

Back to the top