|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
AttachmentHello,
I would like to allow my user to download a file thanks to a windows download box. I succeed while using a simple page with a rialto pop-up and a button "download" but now that I've integrated it in my application, it doesn't work anymore. ----------------------------------------------------------------- My servlet : response.reset(); response.setHeader("Expires", "0"); response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma", "public"); response.setContentType("application/x-download"); response.setHeader("Content-Disposition", "attachment; filename=\"" + chemin + "\""); OutputStream os = response.getOutputStream(); InputStream is = url.openStream(); int count; byte buf[] = new byte[4096]; while ((count = is.read(buf)) > -1) { os.write(buf, 0, count) } is.close(); os.flush(); ------------------------------------------------------------------- The result is that a rialto pop-up is opened. Its title is "response" (like when I've a servlet error) and its content corresponds to the content of the xml file download by the user. Thanks by advance |
|
|
Re: AttachmentHello,
Can you post the javascript code so that i can test it Cyril --- In rialto-dev@..., "cati_project" <pouk06@...> wrote: > > Hello, > > I would like to allow my user to download a file thanks to a windows > download box. I succeed while using a simple page with a rialto pop-up > and a button "download" but now that I've integrated it in my > application, it doesn't work anymore. > > ----------------------------------------------------------------- > My servlet : > response.reset(); > response.setHeader("Expires", "0"); > response.setHeader("Cache-Control","must-revalidate, post-check=0, > pre-check=0"); > response.setHeader("Pragma", "public"); > response.setContentType("application/x-download"); > response.setHeader("Content-Disposition", "attachment; filename=\"" + > chemin + "\""); > > OutputStream os = response.getOutputStream(); > InputStream is = url.openStream(); > int count; > byte buf[] = new byte[4096]; > while ((count = is.read(buf)) > -1) { > os.write(buf, 0, count) > } > is.close(); > os.flush(); > > ------------------------------------------------------------------- > > The result is that a rialto pop-up is opened. Its title is "response" > (like when I've a servlet error) and its content corresponds to the > content of the xml file download by the user. > > Thanks by advance > |
|
|
Re: AttachmentHello,
With some other tests, I've found that if the form isn't in Asynchronous mode, it works, but not if it is in Asynchronous mode. -------------------------------------------------------------------- this is my form : <% String url = response.encodeURL("saving.do"); %> <rialto:form name="SavingForm" url="<%= url %>" boolAsynch="false" boolWithFenWait="false" method="post"> <rialto:button name="SAVE" title="Save" top="180" left="360" alt="Save"/> SAVE.onclick = function () { this.getParentForm().submitForm(); }; </rialto:form> ---------------------------------------------------------------------- > > My servlet : > > response.reset(); > > response.setHeader("Expires", "0"); > > response.setHeader("Cache-Control","must-revalidate, post-check=0, > > pre-check=0"); > > response.setHeader("Pragma", "public"); > > response.setContentType("application/x-download"); > > response.setHeader("Content-Disposition", "attachment; filename=\"" + > > chemin + "\""); > > > > OutputStream os = response.getOutputStream(); > > InputStream is = url.openStream(); > > int count; > > byte buf[] = new byte[4096]; > > while ((count = is.read(buf)) > -1) { > > os.write(buf, 0, count) > > } > > is.close(); > > os.flush(); > > > > ------------------------------------------------------------------- > > > > The result is that a rialto pop-up is opened. Its title is "response" > > (like when I've a servlet error) and its content corresponds to the > > content of the xml file download by the user. > > > > Thanks by advance > > > |
| Free Forum Powered by Nabble | Forum Help |