Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 536620

Summary: File upload issue with RAP 3.5.0 (Photon)
Product: [RT] RAP Reporter: Fabrice Teichteil Koenigsbuch <fteichteil>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: r.maegel
Version: 3.5   
Target Milestone: 3.6   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Bug Depends on: 536708    
Bug Blocks:    

Description Fabrice Teichteil Koenigsbuch CLA 2018-07-03 06:32:49 EDT
There is a problem with file upload on RAP 3.5.0. After some debugging I noticed the following change compared to RAP 3.2.0:

- With 3.2.0, everything is working fine, the FileUploadServiceHandler receives a POST request:

POST //127.0.0.1:50100/myapp/?servicehandler=org.eclipse.rap.fileupload&cid=e5db989c&token=9d5d72fe257b96

- With 3.5.0, the FileUploadServiceHandler receives a GET request:

GET //127.0.0.1:50100/myapp/?servicehandler=org.eclipse.rap.fileupload&cid=e5db989c&token=9d5d72fe257b96

The request is rejected as the upload service is expecting a POST request:

if( !"POST".equals( request.getMethod().toUpperCase() ) ) {
String message = "Only POST requests allowed";
response.sendError( HttpServletResponse.SC_METHOD_NOT_ALLOWED, message );
}
Comment 1 Ivan Furnadjiev CLA 2018-07-03 06:57:32 EDT
RAP core bundles work fine with Oxygen.3 platform and Jetty 9.4.7. Still not sure where is the problem... In Equinox or in Jetty. The multipart POST request is still there, but it's answered with 302. The GET request that follows it is expected (see [1]).

[1] https://en.wikipedia.org/wiki/HTTP_302
Comment 2 Ivan Furnadjiev CLA 2018-07-03 07:03:00 EDT
Some more information. Just built the RAP Examples demo and deployed it in Tomcat 9.0.4. File upload IS operational. This means that the problem is in Jetty 9.4.10. Could you try to use another Jetty version in your target platform. I tested it with Jetty 9.4.7.
Comment 3 Fabrice Teichteil Koenigsbuch CLA 2018-07-04 06:48:51 EDT
I tested by replacing the Jetty bundles on Photon target with the ones on Oxygen target and the problem is still here for me.

However, thanks to your first analysis I did another test by replacing the Equinox bundles related to HTTP on Photon target with the ones on Oxygen target and that fixes the problem for me. The bundles I changed are the following:
- replaced org.eclipse.equinox.http.jetty_3.6.0.v20180328-1442.jar by org.eclipse.equinox.http.jetty_3.4.0.v20170503-2025.jar
- replaced org.eclipse.equinox.http.registry_1.1.500.v20171221-2204.jar by org.eclipse.equinox.http.registry_1.1.400.v20150715-1528.jar
- replaced org.eclipse.equinox.http.servlet_1.5.0.v20180501-1936.jar by org.eclipse.equinox.http.servlet_1.4.0.v20170524-1452.jar
- replaced org.eclipse.equinox.http.servletbridge_1.1.0.v20180120-0803.jar by org.eclipse.equinox.http.servletbridge_1.0.300.v20130327-1442.jar
- replaced org.eclipse.equinox.servletbridge_1.4.0.v20180121-0944.jar by org.eclipse.equinox.servletbridge_1.3.200.v20160128-1435.jar
Comment 4 Ivan Furnadjiev CLA 2018-07-04 08:01:51 EDT
Fabrice, could you please try to exchange the bundles one by one. We need to figure out which bundle introduce the regression in order to continue with the investigation.
Comment 5 Ivan Furnadjiev CLA 2018-07-04 08:10:22 EDT
As file upload is operation under Tomcat with RAP 3.5 target platform, I suspect "org.eclipse.equinox.http.jetty" to be the bad one.
Comment 6 Ivan Furnadjiev CLA 2018-07-04 08:55:17 EDT
The problem is in "org.eclipse.equinox.http.servlet" bundle... It's time to investigate why multiform upload request is answered with 302 there.
Comment 7 Ivan Furnadjiev CLA 2018-07-04 09:28:46 EDT
This is [1] the problematic commit in "org.eclipse.equinox.http.servlet" bundle that breaks the things.

[1] https://github.com/eclipse/rt.equinox.bundles/commit/ea94523fefb5b36def9cda1062495008e47b4795
Comment 8 Ivan Furnadjiev CLA 2018-08-20 06:28:22 EDT
For now the workaround is to not register yor app at root path "/".
Comment 9 Robert Mägel CLA 2018-11-12 08:02:05 EST
I investigated the requests on the RAP Examples Demo.

The post-request of the Upload will be sent to http://rap.eclipsesource.com/rapdemo/ . The correct url would be http://rap.eclipsesource.com/demo/release/rapdemo/.