org.springframework.core.io.support.LocalizedResourceHelper Java Examples

The following examples show how to use org.springframework.core.io.support.LocalizedResourceHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractJExcelView.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the workbook from an existing XLS document.
 * @param url the URL of the Excel template without localization part nor extension
 * @param request current HTTP request
 * @return the template workbook
 * @throws Exception in case of failure
 */
protected Workbook getTemplateSource(String url, HttpServletRequest request) throws Exception {
	LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext());
	Locale userLocale = RequestContextUtils.getLocale(request);
	Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale);

	// Create the Excel document from the source.
	if (logger.isDebugEnabled()) {
		logger.debug("Loading Excel workbook from " + inputFile);
	}
	return Workbook.getWorkbook(inputFile.getInputStream());
}
 
Example #2
Source File: AbstractExcelView.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the workbook from an existing XLS document.
 * @param url the URL of the Excel template without localization part nor extension
 * @param request current HTTP request
 * @return the HSSFWorkbook
 * @throws Exception in case of failure
 */
protected HSSFWorkbook getTemplateSource(String url, HttpServletRequest request) throws Exception {
	LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext());
	Locale userLocale = RequestContextUtils.getLocale(request);
	Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale);

	// Create the Excel document from the source.
	if (logger.isDebugEnabled()) {
		logger.debug("Loading Excel workbook from " + inputFile);
	}
	return new HSSFWorkbook(inputFile.getInputStream());
}
 
Example #3
Source File: AbstractExcelView.java    From Spring-MVC-Blueprints with MIT License 5 votes vote down vote up
protected Workbook getTemplateSource(String url, HttpServletRequest request) throws Exception {
	LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext());
	Locale userLocale = RequestContextUtils.getLocale(request);
	Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale);

	// Create the Excel document from the source.
	if (logger.isDebugEnabled()) {
		logger.debug("Loading Excel workbook from " + inputFile);
	}
	//POIFSFileSystem fs = new POIFSFileSystem(inputFile.getInputStream());
	return new XSSFWorkbook(inputFile.getInputStream());
}
 
Example #4
Source File: AbstractJExcelView.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Create the workbook from an existing XLS document.
 * @param url the URL of the Excel template without localization part nor extension
 * @param request current HTTP request
 * @return the template workbook
 * @throws Exception in case of failure
 */
protected Workbook getTemplateSource(String url, HttpServletRequest request) throws Exception {
	LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext());
	Locale userLocale = RequestContextUtils.getLocale(request);
	Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale);

	// Create the Excel document from the source.
	if (logger.isDebugEnabled()) {
		logger.debug("Loading Excel workbook from " + inputFile);
	}
	return Workbook.getWorkbook(inputFile.getInputStream());
}
 
Example #5
Source File: AbstractExcelView.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the workbook from an existing XLS document.
 * @param url the URL of the Excel template without localization part nor extension
 * @param request current HTTP request
 * @return the HSSFWorkbook
 * @throws Exception in case of failure
 */
protected HSSFWorkbook getTemplateSource(String url, HttpServletRequest request) throws Exception {
	LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext());
	Locale userLocale = RequestContextUtils.getLocale(request);
	Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale);

	// Create the Excel document from the source.
	if (logger.isDebugEnabled()) {
		logger.debug("Loading Excel workbook from " + inputFile);
	}
	return new HSSFWorkbook(inputFile.getInputStream());
}
 
Example #6
Source File: AbstractJExcelView2.java    From JDeSurvey with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Create the workbook from an existing XLS document.
 * @param url the URL of the Excel template without localization part nor extension
 * @param request current HTTP request
 * @return the template workbook
 * @throws Exception in case of failure
 */
protected Workbook getTemplateSource(String url, HttpServletRequest request) throws Exception {
	LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext());
	Locale userLocale = RequestContextUtils.getLocale(request);
	Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale);

	// Create the Excel document from the source.
	if (logger.isDebugEnabled()) {
		logger.debug("Loading Excel workbook from " + inputFile);
	}
	return Workbook.getWorkbook(inputFile.getInputStream());
}