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

Bug 299633

Summary: [upload] absolute URL in FileUploadServiceHandler
Product: [RT] RAP Reporter: falko
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: austin.riddle, a_mergey, stefan.roeck
Version: 1.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
path for FileUploadServiceHandler
none
Proposed patch for proxy compatibility none

Description falko CLA 2010-01-14 08:58:48 EST
Environment: independent of browser

The upload widget does not work behind a HTTP reverse-proxy. The FileUploadServiceHandler creates an absolute URL, which the browser cannot resolve.

I have attached a patch against the current CVS.
Comment 1 falko CLA 2010-01-14 09:01:46 EST
Created attachment 156097 [details]
path for FileUploadServiceHandler
Comment 2 Stefan Röck CLA 2010-02-22 04:25:23 EST
This has been fixed with 301280.
Comment 3 falko CLA 2010-04-06 08:56:53 EDT
the code now has changed to:

---
// convert to relative URL
int firstSlash = url.indexOf( "/" , url.indexOf( "//" ) + 2 ); // first slash after double slash of "http://"

url.delete( 0, firstSlash ); //Result is sth like"/rap?custom_service_handler..."

return RWT.getResponse().encodeURL(url.toString());
---

which still does not work behind a reverse-proxy; "/rap?custom_service_handler.." is not a relative URL; second line needs to be changed to:

url.delete( 0, firstSlash + 1 );
Comment 4 Arnaud MERGEY CLA 2011-05-05 05:53:19 EDT
Because of this bug, the new FileDialog (and more generally FileUpload using url given by FileUploadServiceHandler) doesn't work if the application is packaged as a WAR file and deployed in server like tomcat.

Changes suggested by falko@polymap.de fixes it

( url.delete( 0, firstSlash + 1 ); )
Comment 5 Austin Riddle CLA 2011-06-02 17:59:28 EDT
Created attachment 197282 [details]
Proposed patch for proxy compatibility

Hello Arnaud and Falko,

Please see if this patch fixes the problem in your environment.
Comment 6 Arnaud MERGEY CLA 2011-06-03 06:37:31 EDT
Hello,

I have tested your patch, and it fixes the issue in my environment (RAP application deployed as a WAR file in Tomcat)
In my previous comment, I forgot to mention In my case I am not behind an HTTP reverse-proxy
It seems this issue prevent FileDialog to be working when RAP application is package as a legacy WAR file.
So your patch is welcome, thanks :)
Comment 7 Austin Riddle CLA 2011-06-03 10:43:06 EDT
Patch committed to CVS HEAD.
Comment 8 Arnaud MERGEY CLA 2011-06-09 03:09:19 EDT
Unless FileDialog HEAD will be usable with RAP 1.4,  would it be possible to backport your fix in 1.4 maintenance branch ? 

I am quite sure packaging RAP application as a legacy war file is a usual use case for RAP, and if FileDialog HEAD is not usable with RAP 1.4, it prevents it to be used in this case.