zkoss / zkspringboot

ZK - Spring Boot integration
Apache License 2.0
53 stars 56 forks source link

ZKSpringBoot HomePage Isnt Being Used #36

Open mrother-stoneriver opened 1 year ago

mrother-stoneriver commented 1 year ago

I have a web application based on ZKSpringBoot. I am deploying as a war file in tomcat. If I hit the login page directly, I see the login and the application works fine. However I am having problems when I try the root URL "/". I look at the tomcat access logs and see the access for URL "/". If I set a breakpoint in the FilterChainProxy, the request URL is "index.zul". So somewhere the request is being converted from "/" to "index.zul" I looked at the ZKSpringBoot code and cant find where that is happening.

When I specify the zk homepage the property to zk.homepage=login and hit the root URL in the browser, I see in the filter chain that it is mapping it to /index.zul.

I tried setting the property to zk.homepage= and add a mapping to the Controller but see no difference.

@RequestMapping("/") public String home() { return "login"; }

I tried disabling both zk.homepage and request mapping and added a welcomepage but again no difference.

Has anyone else observed this issue or have a possible solution?

cor3000 commented 1 year ago

To be sure it's not the default zk spring boot view resolver you can disable it via

zk.zul-view-resolver-enabled=false

Next it sounds like a spring security redirect taking effect before reaching your application. RequestMapping. Since you didn't mention that, I can only guess.

Maybe it's just the default redirect mentioned here https://stackoverflow.com/questions/68082468/spring-security-change-login-default-path

mrother-stoneriver commented 1 year ago

I changed the view-resolver to false and still see same behavior (forwarding to /index.zul). I have checked our code everywhere for /index.zul and cant find anywhere. I even disabled spring security (made all the URL's permitAll()) and see same behavior. But I agree, something is intercepting and changing the request URL. The access log does not show any additional requests from the browser side.

cor3000 commented 1 year ago

then the only thing I offer is too run and look into your application configuration directly... can you share a zip file or github repo I can unzip/checkout locally to see where the internal forward/redirect happens?

cor3000 commented 1 year ago

another idea coming to mind is ... since you're using a war file deployment, could it be you have a <welcome-file-list> configured in your web.xml?

In case you are using the zkwebfragment dependency for automatic zk-servlet/listener configuration you might unknowingly inherit the default from there:

https://github.com/zkoss/zk/blob/011040eb4c33cf90cedde08f641fbc4ee29a5247/zkwebfragment/src/main/resources/META-INF/web-fragment.xml#L68