Example usage for org.springframework.core.io.support LocalizedResourceHelper LocalizedResourceHelper

List of usage examples for org.springframework.core.io.support LocalizedResourceHelper LocalizedResourceHelper

Introduction

In this page you can find the example usage for org.springframework.core.io.support LocalizedResourceHelper LocalizedResourceHelper.

Prototype

public LocalizedResourceHelper(ResourceLoader resourceLoader) 

Source Link

Document

Create a new LocalizedResourceHelper with the given ResourceLoader.

Usage

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/*  w w  w.j  a  va 2 s . c  o m*/
* @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/*from  w w w  . jav a2 s.  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());
}