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

This code example shows how to use the following methods:
public class VersionValidateInterceptor extends HandlerInterceptorAdapter { 
 
	private static final Logger logger = Logger 
			.getLogger(VersionValidateInterceptor.class.getName()); 
 
	public VersionValidateInterceptor() { 
		logger.log(Level.FINE, "Initialize VersionValidateHandler"); 
	} 
 
	@Override 
	public boolean preHandle(final HttpServletRequest request, 
			final HttpServletResponse response, final Object handler) 
			throws Exception { 
		final String version = request.getHeader(CloudifyConstants.REST_API_VERSION_HEADER); 
		final String currentVersion = PlatformVersion.getVersion(); 
		final String currentVersionNumber = PlatformVersion.getVersionNumber(); 
		if (logger.isLoggable(Level.FINEST)) { 
			logger.log(Level.FINEST, "pre handle request to " + request.getRequestURI() 
					+ ". Validating the value of " 
					+ CloudifyConstants.REST_API_VERSION_HEADER + " header, request URI = " 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
package org.resthub.web.springmvc.router.support; 
 
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; 
 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
public class TeapotHandlerInterceptor extends HandlerInterceptorAdapter { 
 
    @Override 
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 
 
        if(request.getParameter("teapot").equals("true")) { 
            // I'm a teapot 
            response.sendError(418); 
            return false; 
        } 
        return true; 
    } 
} 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * object is available. 
 *  
 * @author Arvids Grabovskis 
 * @version $Revision$ 
 */ 
public class LocaleManagementInterceptor extends HandlerInterceptorAdapter { 
     
    @Override 
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 
        Locale locale = RequestContextUtils.getLocale(request); 
        response.setLocale(locale); 
        return true; 
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
/** 
 * An interceptor to inject an instance of {@link Router} into the model for all Spring MVC views. By default the 
 * attribute name used is "route". This can be changed using {@link #setAttributeName(String)}. 
 */ 
public class RouterModelAttribute extends HandlerInterceptorAdapter { 
 
  private static final String DEFAULT_ATTRIBUTE_NAME = "route"; 
 
  private String attributeName = DEFAULT_ATTRIBUTE_NAME; 
 
  private final Router router = new Router(); 
 
  @Override 
  public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, 
      ModelAndView mav) throws Exception { 
 
    if (mav != null && mav.getModelMap() != null) { 
      mav.getModelMap().addAttribute(attributeName, router); 
    } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 
	public SitePreferenceHandlerInterceptor() { 
		this(new StandardSitePreferenceHandler(new CookieSitePreferenceRepository())); 
	} 
 
	public SitePreferenceHandlerInterceptor(SitePreferenceHandler sitePreferenceHandler) { 
		this.sitePreferenceHandler = sitePreferenceHandler; 
	} 
 
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 
		sitePreferenceHandler.handleSitePreference(request, response); 
		return true; 
	} 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * is logged in. This is especially useful if the user modifies a page via 
 * AJAX, leaves the page and hits the back button. 
 *  
 * @author Felix Gnass [fgnass at neteye dot de] 
 */ 
public class NoCacheHeaderInterceptor extends HandlerInterceptorAdapter { 
 
	@Override 
	public boolean preHandle(HttpServletRequest request, 
			HttpServletResponse response, Object handler) throws Exception { 
 
		if (!response.isCommitted() && AccessController.isAuthenticatedUser()) { 
			ServletUtils.setNoCacheHeaders(response); 
		} 
		return true; 
	} 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * Interceptor for propagating the {@link org.springmodules.feedxt.domain.User} object into every request 
 * as an attribute. 
 * 
 * @author Sergio Bossa 
 */ 
public class UserPropagationInterceptor extends HandlerInterceptorAdapter { 
     
    private UserHolder userHolder; 
     
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 
        User user = this.userHolder.getUser(); 
        request.setAttribute("user", user); 
        return true; 
    } 
     
    public void setUserHolder(UserHolder userHolder) { 
        this.userHolder = userHolder; 
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 
	/** 
	 * Create a device resolving {@link HandlerInterceptor}. 
	 * @param deviceResolver the device resolver to delegate to in {@link #preHandle(HttpServletRequest, HttpServletResponse, Object)}. 
	 */ 
	public DeviceResolverHandlerInterceptor(DeviceResolver deviceResolver) { 
		this.deviceResolver = deviceResolver; 
	} 
 
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 
		Device device = deviceResolver.resolveDevice(request); 
		request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); 
		return true; 
	} 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * Sets a custom session timeout for unauthenticated users. 
 *  
 * @author Eric Dalquist 
 * @version $Revision$ 
 */ 
public class GuestSessionExpirationInterceptor extends HandlerInterceptorAdapter { 
    private IPersonManager personManager; 
    private int unauthenticatedUserSessionTimeout = 0; 
     
    @Autowired 
    public void setPersonManager(IPersonManager personManager) { 
        this.personManager = personManager; 
    } 
     
    /** 
     * The {@link HttpSession#setMaxInactiveInterval(int)} value to set for guest users. Defaults to 0. 
     * If <= 0 no override is done. 
     */ 
    public void setUnauthenticatedUserSessionTimeout(int unauthenticatedUserSessionTimeout) { 
        this.unauthenticatedUserSessionTimeout = unauthenticatedUserSessionTimeout; 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import org.mifos.ui.core.controller.util.helpers.UrlHelper; 
import org.springframework.web.bind.annotation.SessionAttributes; 
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; 
 
@SessionAttributes({ "accessDeniedBreadcrumbs", "previousPageUrl", "configureDwDatabase", "accountingActivationStatus" }) 
public class BackUrlInterceptor extends HandlerInterceptorAdapter { 
 
    protected List<BreadCrumbsLinks> breadcrumbs = new LinkedList<BreadCrumbsLinks>(); 
 
    @Override 
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { 
        String errorPage = request.getRequestURI().replaceFirst(".+/", ""); 
        String accountingActivationStatus = null; 
        try { 
        	accountingActivationStatus = request.getSession().getAttribute("accountingActivationStatus").toString(); 
        } catch (Exception e){ 
        	accountingActivationStatus = "false"; 
        } 
        String urlToBackPage = (String) request.getSession().getAttribute("previousPageUrl"); 
         
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Spring Framework HandlerInterceptorAdapter Methods: