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

CodeListInterceptor works on paths other than handler methods #1212

Open
yoshikawaa opened this issue Jan 13, 2023 · 0 comments
Open

CodeListInterceptor works on paths other than handler methods #1212

yoshikawaa opened this issue Jan 13, 2023 · 0 comments

Comments

@yoshikawaa
Copy link
Contributor

Description

A HandlerInterceptor can only works on paths of handler method by determining the type of handler argument.

TraceLoggingInterceptor and TransactionTokenInterceptor are limited to handler methods only, but CodeListInterceptor works on paths other than handler methods.

@Override
public void postHandle(HttpServletRequest request,
HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
if (codeLists == null) {
return;
}
for (CodeList codeList : codeLists) {
String attributeName = codeList.getCodeListId();
request.setAttribute(attributeName, codeList.asMap());
}
}

Note: Currently in blank projects we exclude the static resource path.

https://github.com/terasolunaorg/terasoluna-gfw-web-blank/blob/3416cde73b35f60ecc92e9c37e42b6da35d36b97/src/main/resources/META-INF/spring/spring-mvc.xml#L48-L54

Possible Solution

Change CodeListInterceptor to work only on handler methods.

There is a concern that this will prevent CodeList from being referenced when forwarding to JSP without going through Controller. When using Thymeleaf as View, all Views are called through Controller.

@Override
public void postHandle(HttpServletRequest request,
HttpServletResponse response, Object handler,
ModelAndView modelAndView) {
if (!(handler instanceof HandlerMethod)) {
return;
}

Note: A way to reference the CodeList directly from the View is provided.

http://terasolunaorg.github.io/guideline/current/ja/ArchitectureInDetail/WebApplicationDetail/Codelist.html#jspbean

Affect versions

  • 5.x.x.RELEASE

Issue links

Links to related issues.

  • #xx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant