w20-framework / w20

W20 is a Web framework, built upon a powerful RequireJS/AngularJS/Bootstrap mix to help you develop single page applications.
https://w20-framework.github.io/
Mozilla Public License 2.0
8 stars 9 forks source link

Tomcat example required #84

Closed aritrabasu104 closed 6 years ago

aritrabasu104 commented 6 years ago

I need to deploy a W20 bridge application as an war to tomcat,Which I am able to.But the server is responding with a default html instead of configured one. An example will be a great help

Sherpard commented 6 years ago

If you refer to the masterpage, you can find the oficial docs

The property you're looking for is masterpageTemplate: on your application.yaml Hope it helps!

aritrabasu104 commented 6 years ago

@Shephard I need a working example because the fragment configurations are not getting picked up by w20

Sherpard commented 6 years ago

are you pointing to automatic configuration resource? <html data-w20-app="${restPathSlash}/seed-w20/application/configuration">

you can find a project that's working with w20 bridge here you may need to convert it to war if you intend to see a tomcat working app.

aritrabasu104 commented 6 years ago

I am pointing to fragment.w20.json file, how to direct w20 bridge to fetch the Fragment configs?

aritrabasu104 commented 6 years ago

This war is not working properly, fragment configs are not getting picked

adrienlauer commented 6 years ago

Hi! Fragment manifest (*.w20.json) can only be picked by the W20 bridge when located in the classpath, so basically in META-INF/resources.

In a WAR you can also put fragments in the docroot (src/main/webapp) but they won't be detected. You have to configure them manually (with a full URL, not only the id) in the w20.app.json file.

Regarding the masterpage (homepage), the W20 bridge will automatically render a template located by default at the classpath location org/seedstack/w20/masterpage.html. Every official theme has a default masterpage. You can override it with a custom one.

Documentation for the W20 bridge is here. A full W20 bridge example can be found here. This example is not a WAR so it doesn't show how to declare fragments in the docroot.

Sherpard commented 6 years ago

In order to get the fragments recognized, you need to include them on META-INF/resources folder, as stated on Documentation

Automatic activation of fragments # The W20 bridge automatically detects W20 fragments (manifests ending with the .w20.json extension) present in the classpath under META-INF/resources and enables them in the generated W20 configuration.

Note that the W20 bridge cannot detect fragments located outside the local classpath, like the ones in the document root or external to the application. Those fragments must still be explicitly specified in the W20 configuration.

after that, point your masterpage to the configuration resource

/seed-w20/application/configuration

adrienlauer commented 6 years ago

This issue was moved to seedstack/w20-bridge-addon#24