related spring docs: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/view/InternalResourceViewResolver.html
cor3000 ( 2021-11-08 10:39:18 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I just started to use zk with SpringBoot which works fine.
But now I would like to add a regular REST controller to my project.
But whatever I try: zk will always try to interpret any REST path as a zul file name rsp. the result of the REST call is taken as a zul file name.
So where do I need to do a configuration to "protect" a certain REST path from this automatic behavior?
By default the zul-view-resolver is enabled and it's configuration is implemented here: https://github.com/zkoss/zkspringboot/blob/v2.5.3/zkspringboot-autoconfig/src/main/java/org/zkoss/zkspringboot/ZkWebMvcConfiguration.java#L25-L38
As you can see it's configured to use the LOWEST_PRECENDENCE
, so any view resolver before it can resolve to something else, before trying to resolve a zul file.
If you need a different behavior you can disable it (zk.zul-view-resolver-enabled=true
in application properties) and configure your own mechanism.
In order to resolve to a zul file you need to generate an internal URL "/zkau/web/your/path/your-zul-file.zul" ... that's what Spring's InternalResourceViewResolver
does using the prefix and suffix around the view-name.
related spring docs: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/view/InternalResourceViewResolver.html
cor3000 ( 2021-11-08 10:39:18 +0800 )editAsked: 2021-11-07 03:59:27 +0800
Seen: 9 times
Last updated: Nov 08 '21