Task #63643
closedStory #63642: Introduce Request/Response model for frontend rendering
Use Request Response model in JsonView
0%
Updated by Mathias Schreiber almost 7 years ago
do you mean PSR7 responses here?
Updated by Helmut Hummel almost 7 years ago
at the time of writing, there was no psr7 yet.
But yes, a response object might be based on
psr7 nowadays.
Point is to not directly send headers in the view object,
but add the headers to any type of response object instead.
Updated by Mathias Brodala over 6 years ago
- Sprint Focus set to On Location Sprint
Updated by Mathias Brodala over 6 years ago
- Sprint Focus deleted (
On Location Sprint)
Not doing this now since PSR-7 request/response is vastly different from Extbase request/response.
Updated by Alexander Schnitzler about 4 years ago
Making JsonView use Request/Response is not that easily possible without changing the ViewInterface in general since method render() must return a string. Still, this bug report is totally valid and must be addressed. My idea is as follows:
Make every action return a ResponseInterface and make the user do something like this:
$response = new Response($this->view->render());
$response->setHeader('Content-Type', 'application/json');
Unfortunately we need people to set headers manually outside the JsonView or we let them use the core JsonResponse which does the job for them. But setting headers in the view is a no go indeed.
Updated by Alexander Schnitzler about 4 years ago
- Related to Epic #92512: PSR-7 Request/Response handling in Extbase added
Updated by Christian Kuhn almost 3 years ago
- Status changed from New to Closed
If I understand the issue correctly, we addressed this in v11 in a slightly different way: jsonview renders the json_encode'd string, ActionController->jsonResponse() can be used to create a response with appropriate headers from it.
I'll close the issue for now since I think it's resolved. Re-open or create a new one if anyone disagrees.