I have a Greasemonkey script that reads contents of a file from one site and sends it via HTTP POST method to a servlet in my GWT application. Once the content is available in my servlet I want to pass on the file content to the GWT client(i.e. trigger open the application with the file contents).
For triggering the application, I use this in my servlet code:
response.sendRedirect("/path/to/my/application");
Is there any way to read the file contents in the onModuleLoad() of my GWT entry point class? Because I am redirecting the response from servlet to the client, will the response contain the string file that was read from the other site?
Currently what I do is,
read the file from the site and send it via HTTP-POST to my server.
store the String contents in session
send a cookie to the client to indicate that a file is available in server session to be read
client on reading the cookie, sends a request to the server to get the file.
I find that this method seems to be sort of round about. Is there an easier way to do this, by accessing the file contents directly by reading the response content in client side?