Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 package de.xwic.etlgine.server.admin.datapool;
 
 

Author(s):
lippisch
public class CubeDownloadControl extends Control implements IResourceControl {
	private boolean showDownload = false;
	private ICube cube = null;
	private boolean leafsOnly;

Parameters:
container
name
	public CubeDownloadControl(IControlContainer containerString name) {
		super(containername);
	}

Initiate the download

Parameters:
inTpl
dataPool
filters
	public void startDownload(ICube cubeboolean leafsOnly) {
		this. = cube;
		this. = leafsOnly;
	}
	/* (non-Javadoc)
	 * @see de.jwic.base.IResourceControl#attachResource(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
		CubeExportUtil exportUtil = new CubeExportUtil();
		try {
			String filename = .getKey() + ".csv";
			res.setContentType("application/x-msdownload");
			// added double quotes to fix chrome error: Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks. 
			res.setHeader("Content-Disposition""attachment; filename=\"" + filename + "\"");
			exportUtil.export(res.getOutputStream(), );
catch (Exception e) {
			.error("Error generating CSV File"e);
		}
	}

Returns the URL that calls the attachResource method.

Returns:
	public String getDownloadURL() {
		return getSessionContext().getCallBackURL() + "&"
 + "=1&"
	}


Returns:
the showDownload
	public boolean isShowDownload() {
		return ;
	}

Parameters:
showDownload the showDownload to set
	public void setShowDownload(boolean showDownload) {
		this. = showDownload;
	}
New to GrepCode? Check out our FAQ X