0

zk springboot project with regular REST API

asked 2021-11-07 03:59:27 +0800

KlausWr gravatar image KlausWr
37 5

updated 2021-11-07 04:02:35 +0800

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?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-11-08 10:36:52 +0800

cor3000 gravatar image cor3000
6270 2 7
ZK Team

updated 2021-11-08 10:39:07 +0800

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.

link publish delete flag offensive edit

Comments

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2021-11-07 03:59:27 +0800

Seen: 5 times

Last updated: Nov 08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More