Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Path variable values missing in RedirectView when PathPattern are used #33422

Closed
Assignees
bclozel
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug
Milestone
@buletti

Description

@buletti

Affects: 6.1.2+ (probably since the introduction of PathPatterns)


When you use aRedirectView with an URI that contains a path variable, andPathPatterns are enabled, then the variable value is missing.

This is due to the fact that thePathPatterncodepath ofAbstractUrlHandlerMapping is callingbuildPathExposingHandler() with uriTemplateVariables parameter of null.

As a consequence noPathExposingHandlerInterceptor is added to the execution chain. The variable values are never parsed from the URI.

WhenRedirectView tries to access the variable values of the variables in the URI atreplaceUriTemplateVariables() it throws an IllegalArgumentException.

WhenAntPatterns are used instead ofPathPatterns, then the variable values are parsed and all is well.

@ConfigurationpublicclassTestMvConfigurationimplementsWebMvcConfigurer {@OverridepublicvoidaddViewControllers(ViewControllerRegistryregistry) {StringsrcPath ="/some/path/{variable}/foo";StringtgtPath ="/some/path/{variable}/bar";registry.addRedirectViewController(srcPath,tgtPath)                .setStatusCode(HttpStatus.PERMANENT_REDIRECT);    }@OverridepublicvoidconfigurePathMatch(PathMatchConfigurerconfigurer) {configurer.setPatternParser(newPathPatternParser());// broken//       configurer.setPathMatcher(new AntPathMatcher());      // works    }}

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp