Java Code Examples for org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#setOrder()
The following examples show how to use
org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#setOrder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultServletHandlerConfigurer.java From spring-analysis-note with MIT License | 5 votes |
/** * Return a handler mapping instance ordered at {@link Integer#MAX_VALUE} containing the * {@link DefaultServletHttpRequestHandler} instance mapped to {@code "/**"}; * or {@code null} if default servlet handling was not been enabled. * @since 4.3.12 */ @Nullable protected SimpleUrlHandlerMapping buildHandlerMapping() { if (this.handler == null) { return null; } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setUrlMap(Collections.singletonMap("/**", this.handler)); handlerMapping.setOrder(Integer.MAX_VALUE); return handlerMapping; }
Example 2
Source File: ResourceHandlerRegistry.java From spring-analysis-note with MIT License | 5 votes |
/** * Return a handler mapping with the mapped resource handlers; or {@code null} in case * of no registrations. */ @Nullable protected AbstractHandlerMapping getHandlerMapping() { if (this.registrations.isEmpty()) { return null; } Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<>(); for (ResourceHandlerRegistration registration : this.registrations) { for (String pathPattern : registration.getPathPatterns()) { ResourceHttpRequestHandler handler = registration.getRequestHandler(); if (this.pathHelper != null) { handler.setUrlPathHelper(this.pathHelper); } if (this.contentNegotiationManager != null) { handler.setContentNegotiationManager(this.contentNegotiationManager); } handler.setServletContext(this.servletContext); handler.setApplicationContext(this.applicationContext); try { handler.afterPropertiesSet(); } catch (Throwable ex) { throw new BeanInitializationException("Failed to init ResourceHttpRequestHandler", ex); } urlMap.put(pathPattern, handler); } } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setOrder(this.order); handlerMapping.setUrlMap(urlMap); return handlerMapping; }
Example 3
Source File: DefaultServletHandlerConfigurer.java From java-technology-stack with MIT License | 5 votes |
/** * Return a handler mapping instance ordered at {@link Integer#MAX_VALUE} containing the * {@link DefaultServletHttpRequestHandler} instance mapped to {@code "/**"}; * or {@code null} if default servlet handling was not been enabled. * @since 4.3.12 */ @Nullable protected SimpleUrlHandlerMapping buildHandlerMapping() { if (this.handler == null) { return null; } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setUrlMap(Collections.singletonMap("/**", this.handler)); handlerMapping.setOrder(Integer.MAX_VALUE); return handlerMapping; }
Example 4
Source File: ResourceHandlerRegistry.java From java-technology-stack with MIT License | 5 votes |
/** * Return a handler mapping with the mapped resource handlers; or {@code null} in case * of no registrations. */ @Nullable protected AbstractHandlerMapping getHandlerMapping() { if (this.registrations.isEmpty()) { return null; } Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<>(); for (ResourceHandlerRegistration registration : this.registrations) { for (String pathPattern : registration.getPathPatterns()) { ResourceHttpRequestHandler handler = registration.getRequestHandler(); if (this.pathHelper != null) { handler.setUrlPathHelper(this.pathHelper); } if (this.contentNegotiationManager != null) { handler.setContentNegotiationManager(this.contentNegotiationManager); } handler.setServletContext(this.servletContext); handler.setApplicationContext(this.applicationContext); try { handler.afterPropertiesSet(); } catch (Throwable ex) { throw new BeanInitializationException("Failed to init ResourceHttpRequestHandler", ex); } urlMap.put(pathPattern, handler); } } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setOrder(this.order); handlerMapping.setUrlMap(urlMap); return handlerMapping; }
Example 5
Source File: DefaultServletHandlerConfigurer.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Return a handler mapping instance ordered at {@link Integer#MAX_VALUE} containing the * {@link DefaultServletHttpRequestHandler} instance mapped to {@code "/**"}; * or {@code null} if default servlet handling was not been enabled. * @since 4.3.12 */ protected SimpleUrlHandlerMapping buildHandlerMapping() { if (this.handler == null) { return null; } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setUrlMap(Collections.singletonMap("/**", this.handler)); handlerMapping.setOrder(Integer.MAX_VALUE); return handlerMapping; }
Example 6
Source File: ResourceHandlerRegistry.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Return a handler mapping with the mapped resource handlers; or {@code null} in case * of no registrations. */ protected AbstractHandlerMapping getHandlerMapping() { if (this.registrations.isEmpty()) { return null; } Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<String, HttpRequestHandler>(); for (ResourceHandlerRegistration registration : this.registrations) { for (String pathPattern : registration.getPathPatterns()) { ResourceHttpRequestHandler handler = registration.getRequestHandler(); handler.setServletContext(this.servletContext); handler.setApplicationContext(this.applicationContext); handler.setContentNegotiationManager(this.contentNegotiationManager); try { handler.afterPropertiesSet(); } catch (Throwable ex) { throw new BeanInitializationException("Failed to init ResourceHttpRequestHandler", ex); } urlMap.put(pathPattern, handler); } } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setOrder(order); handlerMapping.setUrlMap(urlMap); return handlerMapping; }
Example 7
Source File: DefaultServletHandlerConfigurer.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Return a handler mapping instance ordered at {@link Integer#MAX_VALUE} containing the * {@link DefaultServletHttpRequestHandler} instance mapped to {@code "/**"}; or {@code null} if * default servlet handling was not been enabled. */ protected AbstractHandlerMapping getHandlerMapping() { if (handler == null) { return null; } 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; }
Example 8
Source File: ResourceHandlerRegistry.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Return a handler mapping with the mapped resource handlers; or {@code null} in case of no registrations. */ protected AbstractHandlerMapping getHandlerMapping() { if (registrations.isEmpty()) { return null; } Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<String, HttpRequestHandler>(); for (ResourceHandlerRegistration registration : this.registrations) { for (String pathPattern : registration.getPathPatterns()) { ResourceHttpRequestHandler handler = registration.getRequestHandler(); handler.setServletContext(this.servletContext); handler.setApplicationContext(this.appContext); try { handler.afterPropertiesSet(); } catch (Exception e) { throw new BeanInitializationException("Failed to init ResourceHttpRequestHandler", e); } urlMap.put(pathPattern, handler); } } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setOrder(order); handlerMapping.setUrlMap(urlMap); return handlerMapping; }
Example 9
Source File: JournalAutoConfiguration.java From pro-spring-boot with Apache License 2.0 | 5 votes |
@Bean public SimpleUrlHandlerMapping urlHandler() { SimpleUrlHandlerMapping handler = new SimpleUrlHandlerMapping(); handler.setOrder(Integer.MAX_VALUE - 2); Properties mappings = new Properties(); mappings.put(journal.getContextPath(), "journalController"); handler.setMappings(mappings); return handler; }
Example 10
Source File: JournalAutoConfiguration.java From pro-spring-boot with Apache License 2.0 | 5 votes |
@Bean public SimpleUrlHandlerMapping urlHandler() { SimpleUrlHandlerMapping handler = new SimpleUrlHandlerMapping(); handler.setOrder(Integer.MAX_VALUE - 2); Properties mappings = new Properties(); mappings.put(journal.getContextPath(), "journalController"); handler.setMappings(mappings); return handler; }
Example 11
Source File: SimulatorRestAutoConfiguration.java From citrus-simulator with Apache License 2.0 | 5 votes |
@Bean public HandlerMapping simulatorRestHandlerMapping(ApplicationContext applicationContext) { SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setOrder(Ordered.HIGHEST_PRECEDENCE); handlerMapping.setAlwaysUseFullPath(true); Map<String, Object> mappings = new HashMap<>(); mappings.put(getUrlMapping(), createRestController(applicationContext)); handlerMapping.setUrlMap(mappings); handlerMapping.setInterceptors(interceptors()); return handlerMapping; }
Example 12
Source File: BlazeDsAutoConfiguration.java From flex-blazeds with Apache License 2.0 | 5 votes |
/** * Tell the Dispatcher Servlet to redirect any requests in the * "/messagebroker/" context to the BlazeDS MessageBroker. * * @return SimpleUrlHandlerMapping instance. */ @Bean public SimpleUrlHandlerMapping sampleServletMapping() { SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping(); mapping.setOrder(Integer.MAX_VALUE - 2); Properties urlProperties = new Properties(); urlProperties.put("/messagebroker/*", "_messageBroker"); mapping.setMappings(urlProperties); return mapping; }
Example 13
Source File: WallRideWebMvcConfiguration.java From wallride with Apache License 2.0 | 5 votes |
@Bean public SimpleUrlHandlerMapping mediaUrlHandlerMapping( ApplicationContext applicationContext, ServletContext servletContext, ContentNegotiationManager contentNegotiationManager) { MediaHttpRequestHandler handler = new MediaHttpRequestHandler(); handler.setServletContext(servletContext); handler.setApplicationContext(applicationContext); handler.setContentNegotiationManager(contentNegotiationManager); handler.setWallRideProperties(wallRideProperties); handler.setMediaService(mediaService); handler.setResourceLoader(resourceLoader); handler.setCacheSeconds(86400); try { handler.afterPropertiesSet(); } catch (Exception e) { throw new BeanInitializationException("Failed to init MediaHttpRequestHandler", e); } Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<>(); urlMap.put("/media/{key}", handler); SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setOrder(0); handlerMapping.setUrlMap(urlMap); return handlerMapping; }
Example 14
Source File: FaviconConfiguration.java From tutorials with MIT License | 5 votes |
@Bean public SimpleUrlHandlerMapping myFaviconHandlerMapping() { SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping(); mapping.setOrder(Integer.MIN_VALUE); mapping.setUrlMap(Collections.singletonMap("/favicon.ico", faviconRequestHandler())); return mapping; }
Example 15
Source File: HandlerMappingPrioritiesConfig.java From tutorials with MIT License | 5 votes |
@Bean public SimpleUrlHandlerMapping simpleUrlHandlerMappingOrder0() { SimpleUrlHandlerMapping simpleUrlHandlerMapping = new SimpleUrlHandlerMapping(); simpleUrlHandlerMapping.setOrder(0); Map<String, Object> urlMap = new HashMap<>(); urlMap.put("/welcome", simpleUrlMapping()); simpleUrlHandlerMapping.setUrlMap(urlMap); return simpleUrlHandlerMapping; }