0

ZK SpringBoot 2.5.3, zkspringboot-demo-jar project, zhtml extension is not working.

asked 2021-08-26 22:40:04 +0800

franferri gravatar image franferri
48 2

updated 2021-08-26 22:59:50 +0800

Hello

ZK SpringBoot 2.5.3, zkspringboot-demo-jar project, zhtml extension is not working.

I have placed my .zhtml in the resources/web/zul website where the .zul files are. I have created the following mapping (in the DemoApplication.java file):

@GetMapping("/html")
public String htmlExample() {
    return "html";
}

Why is not picking it?

the demo application.properties files shows:

zk.zul-view-resolver-prefix=/zul

How do we use in Springboot demo project zhtml files?

thanks!

Update with more data: I run the server with:

./mvnw clean package -DskipTests;
./mvnw spring-boot:run

Maybe this is a limitation due the current implementation, and only will work using a .war in a webserver instead of running the .jar (with embedded tomcat):

Can anybody help me? Thanks!

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-08-27 11:20:39 +0800

cor3000 gravatar image cor3000
6094 2 7
ZK Team

short answer: The DHtmlLayoutServlet which handles both .zul and .zhtml pages is not available in a jar deployment. The DHtmlUpdateServlet can only handle .zul files .zhtml files cannot be processed right now. For now you have to use the war-deployment method for full backwards compatiblity with existing zk applications, include .zhtml support.

Long answer:

Why is not picking it? The view resolver can be configured to pick up zhtml files by specifying a different view resolver suffix, the prefix is irrelevant there and can be anything that matches your folder structure.

zk.zul-view-resolver-suffix=.zhtml

Then the view resolver will zhtml files. However there's a shorter way to verify this by just using the explicit URL to the servlet directly, no need to go through spring-mvc's dispatcher servlet.

e.g. http://myserver:8080/zkau/web/zul/html.zhtml

The problem now is what I described above... the zhtml file is not parsed/processed and returned as plain text instead ... which is of course useless.

Further it's possible to also configure the ZumlExtendlet (handling zul files, via /zkau/web/*/.zul) also for zhtml files. But that isn't supported/working right now (possibly never considered a use case) and leads to an exception. ---> That means back to war-deployment.

I posted a new Feature Request: ZK-5007 to enable handling .zhtml files through the DHtmlUpdateServlet to allow this configuration in a jar deployment as well.

Once that's available, I can also implement an auto-config option for ZK Spring Boot (I am the maintainer of zkspringboot).

link publish delete flag offensive edit

Comments

cor3000 many thanks for all the details. Delightful. I'm using 100% spring boot auto-config, quite nice. I think if is possible to enable all the options for the .jar too will be amazing, so, for developers is a no brainer.

franferri ( 2021-08-27 21:56:41 +0800 )edit

yes I agree that would be great, I don't think this FR will get the highest priority since (most zhtml scenarios can be also represented as zul files). Anyway you can watch/vote for the ticket in JIRA and I'll keep you updated here.

cor3000 ( 2021-08-30 11:45:12 +0800 )edit
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-08-26 22:40:04 +0800

Seen: 5 times

Last updated: Aug 27

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