org.springframework.web.servlet.config.annotation.PathMatchConfigurer Java Examples
The following examples show how to use
org.springframework.web.servlet.config.annotation.PathMatchConfigurer.
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: WebMvcConfig.java From spring-boot-cookbook with Apache License 2.0 | 6 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { // configurePathMatch(PathMatchConfigurer configurer)函数让开发人员可以根据需求定制URL路径的匹配规则。 // configurer.setUseSuffixPatternMatch(false)表示设计人员希望系统对外暴露的URL不会识别和匹配.*后缀。 // 在这个例子中,就意味着Spring会将[email protected]当做一个{email}参数传给Controller层接口 // configurer.setUseTrailingSlashMatch(true)表示系统不区分URL的最后一个字符是否是斜杠/。 // 在这个例子中,就意味着http://localhost:8080/email/[email protected]和http://localhost:8080/email/[email protected]/含义相同 // 后缀模式匹配模式: //如果没有setUseSuffixPatternMatch(false)的设置,则http://localhost/hello和http://localhost/hello.html会访问相同的接口, //因为/hello是可以匹配到/hello.*的,/hello.test,/hello.world都可以访问到/hello接口 // 末尾斜杠匹配 // setUseTrailingSlashMatch (boolean useSuffixPatternMatch): // 设置是否自动后缀路径模式匹配,如“/user”是否匹配“/user/”,默认真即匹配; // 当此参数设置为true的会后,那么地址/user,/user/都能正常访问。 // 当此参数设置为false的时候,那么就只能访问/user了 configurer.setUseSuffixPatternMatch(false) .setUseTrailingSlashMatch(true); }
Example #2
Source File: WebConfig.java From tutorials with MIT License | 5 votes |
@Override public void configurePathMatch(final PathMatchConfigurer configurer) { final UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setRemoveSemicolonContent(false); configurer.setUrlPathHelper(urlPathHelper); }
Example #3
Source File: WebMVCConfig.java From spring-boot with Apache License 2.0 | 5 votes |
/** * PathMatchConfigurer 函数让开发人员可以根据需求定制URL路径的匹配规则。 * * @param configurer */ @Override public void configurePathMatch(PathMatchConfigurer configurer) { /** * spring mvc 默认忽略 url 中点"."后面的部分,如 * http://localhost:8080/abc.mm 会直接匹配为 * http://localhost:8080/abc 忽略了 mm * 如果不想忽略,设置 setUseSuffixPatternMatch(false) */ configurer.setUseSuffixPatternMatch(false); }
Example #4
Source File: WebMVCConfig.java From spring-boot with Apache License 2.0 | 5 votes |
/** * PathMatchConfigurer 函数让开发人员可以根据需求定制URL路径的匹配规则。 * * @param configurer */ @Override public void configurePathMatch(PathMatchConfigurer configurer) { /** * spring mvc 默认忽略 url 中点"."后面的部分,如 * http://localhost:8080/abc.mm 会直接匹配为 * http://localhost:8080/abc 忽略了 mm * 如果不想忽略,设置 setUseSuffixPatternMatch(false) */ configurer.setUseSuffixPatternMatch(false); }
Example #5
Source File: PresentationConfiguration.java From hesperides with GNU General Public License v3.0 | 5 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setUrlDecode(false); configurer.setUrlPathHelper(urlPathHelper); configurer.setUseSuffixPatternMatch(false); // avoids bug with getInstanceFiles when instance name ends with .digit and it gets mangled }
Example #6
Source File: RestSpringModuleConfig.java From herd with Apache License 2.0 | 5 votes |
/** * Configure the path match by disabling suffix pattern matching. * * @param configurer the path match configurer. */ @Override public void configurePathMatch(PathMatchConfigurer configurer) { // Turn off suffix pattern matching which will ensure REST URL's that end with periods and some other text get matched in full and not without // the period and the following text suffix. This is due to Spring's extension suffix matching logic that we don't need and don't want // (e.g. .txt could be parsed by a specific handler). configurer.setUseSuffixPatternMatch(false); }
Example #7
Source File: AssetApplication.java From pacbot with Apache License 2.0 | 5 votes |
/** * Configures the PathMatchConfigurer with UrlPathHelper * @param configurer PathMatchConfigurer */ @Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setUrlDecode(false); configurer.setUrlPathHelper(urlPathHelper); }
Example #8
Source File: StatisticsApplication.java From pacbot with Apache License 2.0 | 5 votes |
/** * Configures the PathMatchConfigurer with UrlPathHelper * @param configurer PathMatchConfigurer */ @Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setUrlDecode(false); configurer.setUrlPathHelper(urlPathHelper); }
Example #9
Source File: ComplianceApplication.java From pacbot with Apache License 2.0 | 5 votes |
/** * Configures the PathMatchConfigurer with UrlPathHelper * @param configurer PathMatchConfigurer */ @Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setUrlDecode(false); configurer.setUrlPathHelper(urlPathHelper); }
Example #10
Source File: SpringMvcConfiguration.java From chassis with Apache License 2.0 | 5 votes |
/** * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping * requests to annotated controllers. */ @Bean @Override public RequestMappingHandlerMapping requestMappingHandlerMapping() { PathMatchConfigurer configurer = new PathMatchConfigurer(); configurePathMatch(configurer); RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping(); handlerMapping.setOrder(0); handlerMapping.setDetectHandlerMethodsInAncestorContexts(true); handlerMapping.setInterceptors(getInterceptors()); handlerMapping.setContentNegotiationManager(mvcContentNegotiationManager()); if (configurer.isUseSuffixPatternMatch() != null) { handlerMapping.setUseSuffixPatternMatch(configurer.isUseSuffixPatternMatch()); } if (configurer.isUseRegisteredSuffixPatternMatch() != null) { handlerMapping.setUseRegisteredSuffixPatternMatch(configurer.isUseRegisteredSuffixPatternMatch()); } if (configurer.isUseTrailingSlashMatch() != null) { handlerMapping.setUseTrailingSlashMatch(configurer.isUseTrailingSlashMatch()); } if (configurer.getPathMatcher() != null) { handlerMapping.setPathMatcher(configurer.getPathMatcher()); } if (configurer.getUrlPathHelper() != null) { handlerMapping.setUrlPathHelper(configurer.getUrlPathHelper()); } return handlerMapping; }
Example #11
Source File: SpringMvcConfiguration.java From junit-servers with MIT License | 5 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setAlwaysUseFullPath(true); configurer.setUrlPathHelper(urlPathHelper); configurer.setUseSuffixPatternMatch(true); }
Example #12
Source File: SpringMvcConfiguration.java From junit-servers with MIT License | 5 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setAlwaysUseFullPath(true); configurer.setUrlPathHelper(urlPathHelper); configurer.setUseSuffixPatternMatch(true); }
Example #13
Source File: SpringMvcConfiguration.java From junit-servers with MIT License | 5 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setAlwaysUseFullPath(true); configurer.setUrlPathHelper(urlPathHelper); configurer.setUseSuffixPatternMatch(true); }
Example #14
Source File: SpringMvcConfiguration.java From junit-servers with MIT License | 5 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setAlwaysUseFullPath(true); configurer.setUrlPathHelper(urlPathHelper); configurer.setUseSuffixPatternMatch(true); }
Example #15
Source File: SpringMvcConfiguration.java From junit-servers with MIT License | 5 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setAlwaysUseFullPath(true); configurer.setUrlPathHelper(urlPathHelper); configurer.setUseSuffixPatternMatch(true); }
Example #16
Source File: SpringMvcConfiguration.java From junit-servers with MIT License | 5 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setAlwaysUseFullPath(true); configurer.setUrlPathHelper(urlPathHelper); configurer.setUseSuffixPatternMatch(true); }
Example #17
Source File: MatrixWebConfig.java From tutorials with MIT License | 5 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { final UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setRemoveSemicolonContent(false); configurer.setUrlPathHelper(urlPathHelper); }
Example #18
Source File: CustomWebMvcConfigurationSupport.java From tutorials with MIT License | 5 votes |
@Override protected PathMatchConfigurer getPathMatchConfigurer() { PathMatchConfigurer pathMatchConfigurer = super.getPathMatchConfigurer(); pathMatchConfigurer.setUseSuffixPatternMatch(false); return pathMatchConfigurer; }
Example #19
Source File: MvcConfigurer.java From servicecomb-pack with Apache License 2.0 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { super.configurePathMatch(configurer); configurer.setUseSuffixPatternMatch(false); }
Example #20
Source File: WebConfiguration.java From servicecomb-pack with Apache License 2.0 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer pathMatchConfigurer) { //compatible with spring-webmvc 4.x from spring boot 1.x }
Example #21
Source File: WebConfiguration.java From atsea-sample-shop-app with Apache License 2.0 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { AntPathMatcher matcher = new AntPathMatcher(); matcher.setCaseSensitive(false); configurer.setPathMatcher(matcher); }
Example #22
Source File: MyMvcConfig.java From springMvc4.x-project with Apache License 2.0 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer.setUseSuffixPatternMatch(false); }
Example #23
Source File: TestController.java From aws-serverless-java-container with Apache License 2.0 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer.setUseSuffixPatternMatch(false); }
Example #24
Source File: MVCConfig.java From elucidate-server with MIT License | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer.setUseTrailingSlashMatch(false); configurer.setUseSuffixPatternMatch(false); }
Example #25
Source File: AlfrescoMvcServletConfigModuleConfiguration.java From alfresco-mvc with Apache License 2.0 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer.setUseSuffixPatternMatch(false); }
Example #26
Source File: AlfrescoMvcCustomServletConfigModuleConfiguration.java From alfresco-mvc with Apache License 2.0 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer.setUseSuffixPatternMatch(false); }
Example #27
Source File: WebMvcAutoConfiguration.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
@Override public void configurePathMatch(final PathMatchConfigurer configurer) { configurer.setUseSuffixPatternMatch(false); configurer.setUseRegisteredSuffixPatternMatch(false); }
Example #28
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); }
Example #29
Source File: MolgenisWebAppConfig.java From molgenis with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer.setUseSuffixPatternMatch(false); }
Example #30
Source File: DefaultWebMvcConfigurerAdapter.java From dk-foundation with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void configurePathMatch(PathMatchConfigurer configurer) { AntPathMatcher matcher = new AntPathMatcher(); matcher.setCaseSensitive(false); configurer.setPathMatcher(matcher); }