I\'m trying to send a file to a user from an http servlet. The servlet runs some identification tests (on the request) and then sends the client a file.
This general
The solution to the problem is the "Client-Pull" technique.
By adding a Refresh
value to the header we make the browser ask for the file.
This is the only solution I could come up to that overcomes the fact the gmail will use redirection when pressing a link from within an email.
In the code I did this:
response.setHeader("Refresh", "3; URL=\"" + url.toString() + "\"");
forwardToJSP(request, response, "waitForBrowserRefreshPage.jsp");
Meaning - after 3 seconds ask the user for the specified url which will, in turn, deliver the file to the client.
The forwardToJSP
method displays the "You will be forwarded soon, here a link if it fails" message.