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

This code example shows how to use the following methods:getPrefix, getSuffix, resolveViewName
	public ExtendedInternalResourceViewResolver() { 
		setContentType("text/html;charset=" + ResourceUtils.getProperty("app.encoding")); 
	} 
 
	public String getPrefix() { 
		return super.getPrefix(); 
	} 
 
	public String getSuffix() { 
		return super.getSuffix(); 
	} 
 
	public View resolveViewName(String viewName, Locale locale) throws Exception { 
		if (!viewName.startsWith("/")) { 
			viewName = "/" + viewName; 
		} 
		if (viewName.endsWith(getSuffix())) { 
			viewName = viewName.substring(0, viewName.length() - getSuffix().length()); 
		} 
		String path = getPrefix() + viewName + getSuffix(); 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPrefix, getSuffix, resolveViewName
			throws Exception 
	{ 
		View result = null; 
		 
		HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); 
		String viewFile = request.getServletContext().getRealPath(this.getPrefix() + viewName + this.getSuffix()); 
		File reqFile = new File(viewFile); 
 
		if(reqFile.exists()) { 
			result = super.resolveViewName(viewName, locale); 
		}		 
		 
		return result; 
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setCacheLimit
	 * Specify the maximum number of entries for the view cache. 
	 * Default is 1024. 
	 * @see org.springframework.web.servlet.view.UrlBasedViewResolver#setCache(boolean) 
	 */ 
	public UrlBasedViewResolverRegistration cacheLimit(int cacheLimit) {
		this.viewResolver.setCacheLimit(cacheLimit);
		return this;
	} 
 
	/** 
	 * Enable or disable caching. 
	 * <p>This is equivalent to setting the {@link #cacheLimit "cacheLimit"} 
	 * property to the default limit (1024) or to 0, respectively. 
	 * <p>Default is "true": caching is enabled. 
	 * Disable this only for debugging and development. 
	 * @see org.springframework.web.servlet.view.UrlBasedViewResolver#setCache(boolean) 
	 */ 
	public UrlBasedViewResolverRegistration cache(boolean cache) {
		this.viewResolver.setCache(cache);
		return this;
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
package org.gliderwiki.framework.util.ajax; 
 
import java.util.Locale; 
 
import org.springframework.web.servlet.View; 
import org.springframework.web.servlet.view.AbstractCachingViewResolver; 
 
public class AjaxViewResolver extends AbstractCachingViewResolver{ 
	 
	private String ajaxPrefix; 
	private View ajaxView; 
 
	@Override 
	protected View loadView(String viewName, Locale locale) throws Exception { 
		View view = null; 
		if(viewName.startsWith(this.ajaxPrefix)){ 
			view =  ajaxView; 
		} 
		return view; 
	} 

4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
package org.gliderwiki.framework.util.ajax; 
 
import java.util.Locale; 
 
import org.springframework.web.servlet.View; 
import org.springframework.web.servlet.view.AbstractCachingViewResolver; 
 
public class JsonViewResolver extends AbstractCachingViewResolver{ 
	 
	private String jsonPrefix; 
	private View jsonView; 
 
	@Override 
	protected View loadView(String viewName, Locale locale) throws Exception { 
		View view = null; 
		if(viewName.startsWith(this.jsonPrefix)){ 
			view =  jsonView; 
		} 
		return view; 
	} 

4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * <p> 
     *   Create an instance of ThymeleafViewResolver. 
     * </p> 
     */ 
    public ThymeleafViewResolver() { 
        super(); 
    } 
     
     
 
 
    /** 
     * <p> 
     *   Set the view class that should be used to create views. This must be a subclass 
     *   of {@link AbstractThymeleafView}. The default value is {@link ThymeleafView}. 
     * </p> 
     *  
     * @param viewClass class that is assignable to the required view class 
     *        (by default, ThmeleafView). 
     *         
1
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * <p> 
     *   Create an instance of ThymeleafViewResolver. 
     * </p> 
     */ 
    public ThymeleafViewResolver() { 
        super(); 
    } 
     
     
 
 
    /** 
     * <p> 
     *   Set the view class that should be used to create views. This must be a subclass 
     *   of {@link AbstractThymeleafView}. The default value is {@link ThymeleafView}. 
     * </p> 
     *  
     * @param viewClass class that is assignable to the required view class 
     *        (by default, ThmeleafView). 
     *         
1
CodeRank
Experience pair programming with AI  Get Codota for Java