With inspiration from widget hierarchy, I found why my get-widget-for-tokens does not get URI tokens, on-demand-selector widget are mapped to "main" by navigation widget first, so I should visit http://127.0.0.1:8080/main/asdf not http://127.0.0.1:8080/asdf1. Besides, get-widget-for-tokens can not only widget but also consumed tokens, otherwise there is a page-not-found error.
Let me clear the whole update protocol for selector widget:
- handle-normal-request get URI tokens from browser and call update-widget-tree.
- update-widget-tree call update-children which is specialized by selector, widget, so get-widget-for-token is called with URI tokens.
- if there is not http-not-found error which can be throwed by update-children, render current widget.
- make sure all tokens were consumed, or report a page-not-found error.
- Specially for on-demand-selector, it set widget returned by get-widget-for-token as its children and cached, so it best fit dynamic wiki-style content creation
1. navigation asdf is a arbitrary URI tokens just for testing.
No comments:
Post a Comment