The problem arises from the frames that are used in the GWT application. Often, during file uploads, cross-calls inside Javascript are often used, which are not allowed. During application development, you open development mode, that is, on port 9999, so your browser uses http://127.0.0.1:9999/YourApp.html . The servlet that should process the downloaded file runs on another computer or on the same computer, but on a different port (i.e. http://127.0.0.1:6544/servlet/upload ). Both cases fall into the Javascript security issue because the port number is included in the domain.
But you can install Apache on your development machine and use mod_proxy to move both parts of your application to the same domain. Set -bindAddress to localhost and use the static port (i.e. 9999) for your GWT application. Also run the servlet on the local host with a static port (i.e. 6544). Then you can add
ProxyRequests Off ProxyPreserveHost Off ProxyTimeout 3600 <Location /gui> Allow from All ProxyPass http://localhost:9999 ProxyPassReverse http://localhost:9999 </Location> <Location /api> Allow from All ProxyPass http://localhost:6544/servlet ProxyPassReverse http://localhost:6544/servlet </Location>
for your apache configuration. Now you can start the GWT application using http: //localhost/gui/YourApp.html "and refer to" / api / upload "(relative Url) in FormPanel.setAction (). Now both domains (GWT application and upload-servlet) are within the same domain ( http: // localhost ) and you will get SubmitCompleteEvent.getResults (). Inside the servlet, you should also set the “Content-Type” HTTP response header to “text / html”.
source share