Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add request.render() support #39

Closed
hueniverse opened this issue Aug 10, 2015 · 2 comments
Closed

Add request.render() support #39

hueniverse opened this issue Aug 10, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@hueniverse
Copy link
Member

@hueniverse hueniverse commented Aug 10, 2015

The server.render() method does not work when used inside a request handler via request.server.render() when the view manager was created by a plugin. This is breaks because the request.server does not have access to the plugin realm where the view manager is configured (only has access to a view manager setup directly on the server root outside of any plugin).

The request.render() method works exactly the same way but it gets its realm from the route the request was bound to instead of the global server root.

Note that this will not work in onRequest extensions added by the plugin because the route isn't yet set at this point in the request lifecycle and the request.render() method will produce the same limited results server.render() can. If you need to call render() within onRequest, save a reference to the views manager direction from server.realm.plugins.vision.manager within the plugin and use that in the extension method.

@felipekm

This comment has been minimized.

Copy link

@felipekm felipekm commented Oct 17, 2016

Hey @hueuniverse you mentioned

If you need to call render() within onRequest, save a reference to the views manager direction from server.realm.plugins.vision.manager within the plugin and use that in the extension method.

How can I use it in the extensio method?
Could you show me some sample? Thanks.

@hueniverse

This comment has been minimized.

Copy link
Member Author

@hueniverse hueniverse commented Oct 25, 2016

@felipekm sorry. I don't have the time to write an example. You are better off asking this question in hapijs/discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.