Tried setting content lenght it didn't help.
There is something really wrong with the content type.  The popup thinks
it's html and tries downlad the file that has my page link's name.  There is
something silly in the code below.
Hope you can spot it...
public ActionResult onExtractClick() { 
 ActionResult actionResult = null; 
         try 
         { 
              String myString = "test"; 
                                    
             HttpServletResponse response = getContext().getResponse(); 
             response.setContentType("text/plain"); 
             response.setHeader("Pragma", "public"); 
             response.setHeader("Cache-Control", "max-age=0"); 
             response.setHeader("Content-Disposition", "attachment;
filename=\"report.txt\""); 
             response.setContentLength(myString.getBytes().length);  
              
             String contentType = ClickUtils.getMimeType(".txt"); 
            byte[] bytes = myString.getBytes(); 
                                                
            actionResult = new ActionResult(bytes, contentType ); 
        } 
        catch(Exception e) 
         { 
                         Log.error(e.getMessage()); 
         } 
        return actionResult; 
         }  



--
View this message in context: 
http://click.1134972.n2.nabble.com/File-Download-with-Click-tp7179077p7185377.html
Sent from the click-user mailing list archive at Nabble.com.

Reply via email to