Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多个方法上的@Path导致路径错误 #14

Open
CNYuYang opened this issue Mar 1, 2021 · 1 comment · May be fixed by #15
Open

多个方法上的@Path导致路径错误 #14

CNYuYang opened this issue Mar 1, 2021 · 1 comment · May be fixed by #15

Comments

@CNYuYang
Copy link

CNYuYang commented Mar 1, 2021

org.geektimes.web.mvc.FrontControllerServletinitHandleMethods方法

 // 处理方法支持的 HTTP 方法集合
for (Method method : publicMethods) {
    Set<String> supportedHttpMethods = findSupportedHttpMethods(method);
    Path pathFromMethod = method.getAnnotation(Path.class);
    if (pathFromMethod != null) {
        requestPath += pathFromMethod.value();
    }
    handleMethodInfoMapping.put(requestPath,
            new HandlerMethodInfo(requestPath, method, supportedHttpMethods));
}

错误代码:

requestPath += pathFromMethod.value();

直接修改requestPath,导致请求路径错误

@tanpenggood
Copy link

DiligentNezha pushed a commit to DiligentNezha/geekbang-lessons that referenced this issue Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants