List of usage examples for org.springframework.core.io.support LocalizedResourceHelper findLocalizedResource
public Resource findLocalizedResource(String name, String extension, @Nullable Locale locale)
The file will be searched with locations in the following order, similar to java.util.ResourceBundle 's search order:
If none of the specific files can be found, a resource descriptor for the default location will be returned.
From source file:org.centralperf.helper.view.AbstractPOIExcelView.java
/** * 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//from w w w . ja v a 2 s . c om * @return the HSSFWorkbook * @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 new XSSFWorkbook(inputFile.getInputStream()); }
From source file:com.vh.ds.iam.web.front.jxl.AbstractJxlView.java
/** * 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// w w w . ja va 2s . c o m * @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()); }