Hi, i implemented the PageAction, and it's kind of working but not exactly...
I'm doing something wrong.
The code is posted below, but here are the problems:
1.  The action result (text) opens in the same window.  How can I open it in
a new browser window.
2.  I can't save the file....  The type is shown as HTML.  The file name
shows the actual actionLink with parameters even though I supply the file
name.....   When i click save it says "Unable to download myFileName.htm
from localhost."  And myfileName is the actual Click Page name...
What am I doing wrong??

public ActionResult onExtractClick() {
 ActionResult actionResult = null;
         try
         {
                                                 
             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\"");
                        
        String contentType = ClickUtils.getMimeType(".txt");
        String myString = "test"; 
        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-tp7179077p7181680.html
Sent from the click-user mailing list archive at Nabble.com.

Reply via email to