Results 1 to 1 of 1

Thread: File download in swf-booking-faces project

  1. #1
    Join Date
    Feb 2010
    Posts
    19

    Default File download in swf-booking-faces project

    Hello all,

    Would anyone help us with how to implement the download function in the swf-booking-faces project in SWF 2.0.8 and Spring 3.0? We have a null-transition in the flow where we evaluate the following service:

    Code:
    public void showDocument{...}
    	HttpServletResponse response = (HttpServletResponse) requestContext.getExternalContext().getNativeResponse();
    	response.reset();
    	response.setCharacterEncoding("UTF-8");
    	response.setContentType(getFileContentType());		
    	response.setHeader("Content-disposition", "attachment; filename=\"" + getOriginalFileName() +"\"");
    	response.setContentLength(getFileContent().length);
    	response.setHeader("Pragma", "public");
    	response.setHeader("Cache-control", "private");
    	try {				            
    		ServletOutputStream sos = response.getOutputStream();	
    		sos.write(getFileContent());
    		sos.flush();
    		requestContext.getExternalContext().recordResponseComplete();	
    	}
    }
    The service run successfully, however, the download dialog is not displayed on the client side.

    Any help would be appreciated.

    Thanks,

    Fanta
    Last edited by fantabk; Mar 25th, 2010 at 12:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •