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

This code example shows how to use the following methods:setUrlMap, setOrder
		} 
 
		Map<String, HttpRequestHandler> urlMap = new HashMap<String, HttpRequestHandler>(); 
		urlMap.put("/**", handler); 
 
		SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); 
		handlerMapping.setOrder(Integer.MAX_VALUE); 
		handlerMapping.setUrlMap(urlMap); 
		return handlerMapping; 
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:
 *  
 * Always returns null from defaultHandlerMapping  
 *  
 * @author bpolster 
 */ 
public abstract class BLCAbstractHandlerMapping extends AbstractHandlerMapping { 
    protected String controllerName; 
 
    @Override 
    /** 
     * This handler mapping does not provide a default handler.   This method 
     * has been coded to always return null. 
     */ 
    public Object getDefaultHandler() { 
        return null;         
    } 
     
    /** 
     * Returns the controllerName if set or "blPageController" by default. 
     * @return 
5
CodeRank
This code example shows how to use the following methods:
import javax.servlet.http.HttpServletRequest; 
 
import org.riotfamily.pages.model.Site; 
import org.springframework.web.servlet.handler.AbstractHandlerMapping; 
 
public class NoSiteHandlerMapping extends AbstractHandlerMapping { 
 
	private Object siteNotFoundHandler; 
 
	public void setSiteNotFoundHandler(Object siteNotFoundHandler) { 
		this.siteNotFoundHandler = siteNotFoundHandler; 
	} 
	 
	@Override 
	protected Object getHandlerInternal(HttpServletRequest request) 
			throws Exception { 
		 
		Site site = PageResolver.getSite(request); 
		if (site == null) { 
			return siteNotFoundHandler; 
5
CodeRank
This code example shows how to use the following methods:
	 
	private ScreenRepository repository; 
	 
	private String servletPrefix = ""; 
	 
	public ScreenHandlerMapping(ScreenRepository repository) { 
		this.repository = repository; 
	} 
	 
	public void setServletPrefix(String servletPrefix) { 
		this.servletPrefix = servletPrefix; 
	} 
 
	@Override 
	protected Object getHandlerInternal(HttpServletRequest request) 
			throws Exception { 
		 
		String path = ServletUtils.getPathWithoutServletMapping(request); 
		String[] s = StringUtils.tokenizeToStringArray(path, "/"); 
		 
5
CodeRank
This code example shows how to use the following methods:
/** 
 * @author Felix Gnass [fgnass at neteye dot de] 
 * @author Jan-Frederic Linde [jfl at neteye dot de] 
 * @since 6.5 
 */ 
public class PageHandlerMapping extends AbstractHandlerMapping { 
 
	@Override 
	protected Object getHandlerInternal(HttpServletRequest request) 
			throws Exception { 
 
		if (WebUtils.isIncludeRequest(request)) { 
			return null; 
		} 
		Page page = PageResolver.getPage(request); 
		if (page != null) { 
			String suffix = getRequestedSuffix(page, request); 
			if (!page.getSite().isValidSuffix(page, suffix)) { 
				String url = new PageFacade(page, request).getUrl(); 
				return new RedirectController(url, true); 
5
CodeRank
This code example shows how to use the following methods:setContentNegotiationManager, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, setAlwaysUseFullPath
public class WebConfiguration extends WebMvcConfigurationSupport { 
 
  @Bean 
  public RequestMappingHandlerMapping requestMappingHandlerMapping() { 
    RequestMappingHandlerMapping handlerMapping = super.requestMappingHandlerMapping(); 
    handlerMapping.setAlwaysUseFullPath(true); 
    return handlerMapping; 
  } 
} 

4
CodeRank
This code example shows how to use the following methods:setContentNegotiationManager, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, setInterceptors
	} 
 
	@Override 
	public RequestMappingHandlerMapping requestMappingHandlerMapping() { 
		RequestMappingHandlerMapping rm = super.requestMappingHandlerMapping(); 
		rm.setUseSuffixPatternMatch(false); 
		return rm; 
	} 
 
} 

4
CodeRank
This code example shows how to use the following methods:setContentNegotiationManager, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, setInterceptors
    @Bean 
    @Override 
    public RequestMappingHandlerMapping requestMappingHandlerMapping() { 
        RequestMappingHandlerMapping result = super.requestMappingHandlerMapping(); 
        result.setUseSuffixPatternMatch(false); 
        result.setUseTrailingSlashMatch(false); 
        return result; 
    } 
 
    @Override 
    protected void addResourceHandlers(ResourceHandlerRegistry registry) { 
        registry.addResourceHandler("/resources/**").addResourceLocations("/resources/").setCachePeriod(31556926); 
    } 
 
    @Bean 
    public ContentNegotiatingViewResolver contentNegotiatingViewResolver() { 
        ContentNegotiatingViewResolver result = new ContentNegotiatingViewResolver(); 
        Map<String, String> mediaTypes = new HashMap<String, String>(); 
        mediaTypes.put("json", MediaType.APPLICATION_JSON_VALUE); 
        result.setMediaTypes(mediaTypes); 

4
CodeRank