org.springframework.web.method.HandlerTypePredicate Java Examples
The following examples show how to use
org.springframework.web.method.HandlerTypePredicate.
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: RequestMappingHandlerMappingTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void pathPrefix() throws Exception { this.handlerMapping.setEmbeddedValueResolver(value -> "/${prefix}".equals(value) ? "/api" : value); this.handlerMapping.setPathPrefixes(Collections.singletonMap( "/${prefix}", HandlerTypePredicate.forAnnotation(RestController.class))); Method method = UserController.class.getMethod("getUser"); RequestMappingInfo info = this.handlerMapping.getMappingForMethod(method, UserController.class); assertNotNull(info); assertEquals(Collections.singleton(new PathPatternParser().parse("/api/user/{id}")), info.getPatternsCondition().getPatterns()); }
Example #2
Source File: RequestMappingHandlerMappingTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void pathPrefix() throws NoSuchMethodException { this.handlerMapping.setEmbeddedValueResolver(value -> "/${prefix}".equals(value) ? "/api" : value); this.handlerMapping.setPathPrefixes(Collections.singletonMap( "/${prefix}", HandlerTypePredicate.forAnnotation(RestController.class))); Method method = UserController.class.getMethod("getUser"); RequestMappingInfo info = this.handlerMapping.getMappingForMethod(method, UserController.class); assertNotNull(info); assertEquals(Collections.singleton("/api/user/{id}"), info.getPatternsCondition().getPatterns()); }
Example #3
Source File: RequestMappingHandlerMappingTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void pathPrefix() throws NoSuchMethodException { this.handlerMapping.setEmbeddedValueResolver(value -> "/${prefix}".equals(value) ? "/api" : value); this.handlerMapping.setPathPrefixes(Collections.singletonMap( "/${prefix}", HandlerTypePredicate.forAnnotation(RestController.class))); Method method = UserController.class.getMethod("getUser"); RequestMappingInfo info = this.handlerMapping.getMappingForMethod(method, UserController.class); assertNotNull(info); assertEquals(Collections.singleton(new PathPatternParser().parse("/api/user/{id}")), info.getPatternsCondition().getPatterns()); }
Example #4
Source File: RequestMappingHandlerMappingTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void pathPrefix() throws NoSuchMethodException { this.handlerMapping.setEmbeddedValueResolver(value -> "/${prefix}".equals(value) ? "/api" : value); this.handlerMapping.setPathPrefixes(Collections.singletonMap( "/${prefix}", HandlerTypePredicate.forAnnotation(RestController.class))); Method method = UserController.class.getMethod("getUser"); RequestMappingInfo info = this.handlerMapping.getMappingForMethod(method, UserController.class); assertNotNull(info); assertEquals(Collections.singleton("/api/user/{id}"), info.getPatternsCondition().getPatterns()); }
Example #5
Source File: WebFluxConfigurationSupportTests.java From spring-analysis-note with MIT License | 4 votes |
@Override public void configurePathMatching(PathMatchConfigurer configurer) { configurer.setUseTrailingSlashMatch(false); configurer.addPathPrefix("/api", HandlerTypePredicate.forAnnotation(RestController.class)); }
Example #6
Source File: WebMvcConfigurationSupportExtensionTests.java From spring-analysis-note with MIT License | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer.setPathMatcher(new TestPathMatcher()); configurer.setUrlPathHelper(new TestPathHelper()); configurer.addPathPrefix("/api", HandlerTypePredicate.forAnnotation(RestController.class)); }
Example #7
Source File: WebFluxConfigurationSupportTests.java From java-technology-stack with MIT License | 4 votes |
@Override public void configurePathMatching(PathMatchConfigurer configurer) { configurer.setUseTrailingSlashMatch(false); configurer.addPathPrefix("/api", HandlerTypePredicate.forAnnotation(RestController.class)); }
Example #8
Source File: WebMvcConfigurationSupportExtensionTests.java From java-technology-stack with MIT License | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer.setPathMatcher(new TestPathMatcher()); configurer.setUrlPathHelper(new TestPathHelper()); configurer.addPathPrefix("/api", HandlerTypePredicate.forAnnotation(RestController.class)); }
Example #9
Source File: WebMvcConfig.java From shardingsphere-elasticjob-lite with Apache License 2.0 | 4 votes |
@Override public void configurePathMatch(final PathMatchConfigurer configurer) { HandlerTypePredicate handlerTypePredicate = HandlerTypePredicate.forAnnotation(RestController.class); configurer.addPathPrefix("/api", handlerTypePredicate); }