Spring Framework AbstractTemplateViewResolver - 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 AbstractTemplateViewResolver class.

This code example shows how to use the following methods:getServletContext, getSuffix, setSuffix
	protected Class<?> requiredViewClass() { 
		return HttlView.class; 
	} 
 
	public void afterPropertiesSet() throws Exception { 
		WebEngine.setServletContext(getServletContext()); 
		if (getSuffix() == null || getSuffix().length() == 0) { 
			super.setSuffix(WebEngine.getTemplateSuffix()); 
		} 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:setViewClass
 */ 
public class MustacheViewResolver extends AbstractTemplateViewResolver implements ViewResolver { 
 
    private MustacheTemplateFactory templateFactory; 
 
    public MustacheViewResolver() { 
        setViewClass(MustacheView.class); 
    } 
 
    @Override 
    protected Class<?> requiredViewClass() { 
        return MustacheView.class; 
    } 
 
    @Override 
    protected AbstractUrlBasedView buildView(String viewName) throws Exception { 
 
        final MustacheView view = (MustacheView) super.buildView(viewName); 
 
        final MustacheTemplate template = templateFactory.getTemplate(view.getUrl()); 
6
CodeRank
This code example shows how to use the following methods:buildView, getSuffix
	/** 
	 * if viewName start with / , then ignore prefix. 
	 */ 
	@Override 
	protected AbstractUrlBasedView buildView(String viewName) throws Exception { 
		AbstractUrlBasedView view = super.buildView(viewName); 
		// start with / ignore prefix 
		if (viewName.startsWith("/")) { 
			view.setUrl(viewName + getSuffix()); 
		} 
		return view; 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:setViewClass
package org.springframework.web.servlet.view.cambridge; 
 
import org.springframework.web.servlet.view.AbstractTemplateViewResolver; 
 
/** 
 * @author Erdinc Yilmazel (eyilmazel@tripadvisor.com) 
 * @since 6/13/13 
 */ 
public class CambridgeViewResolver extends AbstractTemplateViewResolver 
{ 
    public CambridgeViewResolver() 
    { 
        setViewClass(requiredViewClass()); 
    } 
 
    @Override 
    protected Class requiredViewClass() 
    { 
        return CambridgeView.class; 
    } 

6
CodeRank
This code example shows how to use the following methods:buildView, getSuffix
	/** 
	 * if viewName start with / , then ignore prefix. 
	 */ 
	@Override 
	protected AbstractUrlBasedView buildView(String viewName) throws Exception { 
		AbstractUrlBasedView view = super.buildView(viewName); 
		// start with / ignore prefix 
		if (viewName.startsWith("/")) { 
			view.setUrl(viewName + getSuffix()); 
		} 
		return view; 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:getServletContext, getSuffix, setSuffix
        return JetTemplateView.class; 
    } 
 
    @Override 
    public void afterPropertiesSet() throws Exception { 
        JetWebEngineLoader.setServletContext(getServletContext()); 
        if (getSuffix() == null || getSuffix().length() == 0) { 
            setSuffix(JetWebEngineLoader.getTemplateSuffix()); 
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:setViewClass
 
	private JadeConfiguration configuration; 
	private boolean renderExceptions = false; 
	private String contentType = "text/html;charset=UTF-8"; 
 
	public JadeViewResolver() { 
		setViewClass(requiredViewClass()); 
	} 
 
	@Override 
	@SuppressWarnings("rawtypes") 
	protected Class requiredViewClass() { 
		return JadeView.class; 
	} 
 
	@Override 
	protected AbstractUrlBasedView buildView(String viewName) throws Exception { 
		JadeView view = (JadeView) super.buildView(viewName); 
		view.setConfiguration(this.configuration); 
		view.setContentType(contentType); 
5
CodeRank
This code example shows how to use the following methods:getApplicationContext, getContentType, setContentType
			SecurityException, NoSuchFieldException 
	{ 
		// 如果未指定groupTemplate,取上下文中唯一的GroupTemplate对象 
		if (config == null) 
		{ 
			config = getApplicationContext().getBean(BeetlGroupUtilConfiguration.class); 
			this.groupTemplate = config.getGroupTemplate(); 
		} 
 
		// 如果没有设置ContentType,设置个默认的 
		if (getContentType() == null) 
		{ 
			String charset = groupTemplate.getConf().getCharset(); 
			setContentType("text/html;charset=" + charset); 
		} 
 
	} 
 
	/* ----- ----- ----- ----- 其他方法 ----- ----- ----- ----- */ 
	/** 
5
CodeRank
This code example shows how to use the following methods:setViewClass
    private boolean preCompile = false; 
    private long cacheExpiration = 0l; 
    private Map<String, Helper> helpers = Maps.newHashMap(); 
    private MustacheEngine engine; 
 
    public TrimouViewResolver() { 
        setViewClass(TrimouView.class); 
    } 
 
    @Override 
    protected AbstractUrlBasedView buildView(String viewName) throws Exception { 
        TrimouView view = (TrimouView) super.buildView(viewName); 
        try { 
            view.setViewName(viewName); 
            view.setEngine(engine); 
            // Validate the template exists 
            engine.getMustache(viewName); 
            return view; 
        } catch (Exception e) { 
            throw new MustacheException(view.getUrl() + " : " + e.getMessage()); 
4
CodeRank