Spring Framework LocalizedResourceHelper - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework LocalizedResourceHelper class.

This code example shows how to use the following methods:findLocalizedResource
	 * @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()); 
	} 
 
	/** 
	 * Subclasses must implement this method to create an Excel Workbook 
	 * document, given the model. 
	 * @param model the model Map 
6
CodeRank
This code example shows how to use the following methods:findLocalizedResource
	 * @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); 
		} 
		POIFSFileSystem fs = new POIFSFileSystem(inputFile.getInputStream()); 
		return new HSSFWorkbook(fs); 
	} 
 
	/** 
	 * Subclasses must implement this method to create an Excel HSSFWorkbook document, 
	 * given the model. 
6
CodeRank
This code example shows how to use the following methods:findLocalizedResource
     * @param encoding The encoding of the template. 
     * @return The loaded template resource. 
     */ 
    protected Resource loadTemplateResource(String name, String encoding) {
        Locale locale = LocaleContextHolder.getLocale();
        return helper.findLocalizedResource(prefix + name, extension, locale);
    } 
 
 
    //============================================== Setter/Getter ===================================================== 
 
    /** 
     * Sets the prefix to be prepended to the template name before resolving takes place. 
     * 
     * @param prefix The prefix to be prepended to the template name before resolving takes place. 
     */ 
    public void setPrefix(String prefix) {
        this.prefix = prefix;
    } 
 
4
CodeRank
See Code Examples for Spring Framework LocalizedResourceHelper Methods: