Passing data from page controller to responseFilter via HTTP response

Enonic version: 6.5.4
OS: Mac and linux

So If I want to pass something from a page controller to a response filter I can do this by adding headers

https://discuss-3.enonic.com/t/xp-help-creating-files/430/2

Keeping in mind:

Interestingly it seems Enonic XP has added some custom fields:
pageContributions, postProcess, applyFilters
http://xp.readthedocs.io/en/stable/developer/ssjs/http-response.html

When I try to add my own, they are stripped away before reaching the responsefilter :frowning: but I guess thats by design.

Does server-side data really belong in the HTTP response?
Or should controller perhaps return more than just the http response object?

I guess I should stick to using http headers for now, and simply strip them in the filter, so the end user never sees themā€¦

Example:

My projects havenā€™t had the need to use filters much. Using headers is a clever way to pass values to a response filter. And as you say, they can be removed in the filter so the client never sees it. But maybe there should be another custom object for passing values from controllers to filters.

1 Like

I would very much like some way to pass along server-side data.
The http headers can only be strings, so if one want to pass a data structure it must be converted to a json string in the page controller and parsed back to a js object in the filter. Which is kind of a hazzle.

1 Like