Comments (7)
That would obviously only work for uncached segments to manipulate that global state but still.
Wouldn't that be already the state we have now? If a cached fusion object manipulates the response, that will happen only on the first uncached render and not on subsequent ones.
from neos-development-collection.
How about just having a FusionRuntime->mergeResponse($additionalResponse)
and internally the FusionRuntime carries a response around, which is merged in the HttpResponseImplementation
?
SomeFusionObjectImplementation {
render() {
// warning this only works if the object is evaluated consistently via mode=uncached.!!!
$myResponse = new ActionResponse();
$myResponse->....doStuff/setHeaders
$runtime->mergeResponse($myResponse);
}
}
from neos-development-collection.
Wouldn't that be already the state we have now? If a cached fusion object manipulates the response, that will happen only on the first uncached render and not on subsequent ones.
exactly, so no change here.
It worked actually out quite good and even with a working legacy layer so neos fusion form still works :D
And any code interacting with $this->runtime->getControllerContext()->getResponse();
:D
from neos-development-collection.
Sadly it seems it doesnt work perfectly and there are test cases to proof it :D
The header, if existent in the the parent response is currently duplicated and not correctly overridden:
The whole replaceHttpResponse / buildHttpResponse is a bit flaky, see neos/flow-development-collection#2492
I dont think its unfixable we just have to find a way.
from neos-development-collection.
I think multiple competing headers like that are a broken use case anyways. Headers by definition can appear multiple times, we can't really know if we should remove the first one and when not. IMHO the test is misleading the result might as well (correctly) be key => [value, value]
It shows a potential use case for the exceptions though, if you actualyl want to redirect the main request from within a plugin
you kinda have be able to throw to escape your plugin prison. Not sure how well that actually works with the code base right now as the plugin has it's own dispatch loop, but that could be a valid reason. I don't think status codes upmerging makes any sense as it's always unclear what should win. What if there are two plugins on the page? Either we allow it by excepting and thereby preventing the second plugin from even running, or we don't allow it at all.
from neos-development-collection.
It shows a potential use case for the exceptions though, if you actualyl want to redirect the main request from within a plugin
you kinda have be able to throw to escape your plugin prison. Not sure how well that actually works with the code base right now as the plugin has it's own dispatch loop, but that could be a valid reason.
As far as i can tell that cannot work due to the own loop. A ForwardException
will be catched and handled there and the forward will only affect the plugin subrequest and the main request is not forwarded. So i would not say that this is a reason for exceptions, especially considering that no one might need that feature...
I don't think status codes upmerging makes any sense as it's always unclear what should win. What if there are two plugins on the page? Either we allow it by excepting and thereby preventing the second plugin from even running, or we don't allow it at all.
well yes i agree it all is a bit muddy, but @mficzel relies on some behaviour to upmerge a redirect (with status code) for the Neos.Fusion.Form.Runtime:Redirect
action:
but sure if there are other headers set or things rendered the redirect will just win without question (even in the fusion form, a returned action Message will be just ignored / never shown). Its wild west.
from neos-development-collection.
I think we should keep at first the proposed unsafeAdditionalDynamicHeaders
/ unsafeHttpResponseConstrains
feature out of the game.
Fusion objects interacting with $this->runtime->getControllerContext()->getResponse()->set...
are hacky as it is and changing the part $this->runtime->getControllerContext()->getResponse()
to $this->runtime->bla
is just syntactic sugar.
What is important that the controller context available will not be the actual controller context from the controller but self crafted by the fusion runtime which will be used to return the psr response.
At some point we might actually find out what we want to support, headers, redirects or status codes by plugin and by then we can decide on a nice api.
from neos-development-collection.
Related Issues (20)
- 9.0 `Node::hasProperty` might lie in combination with entity privileges where property will be null still
- BUG: 9.0 `cr:export` doesnt work with resource stream wrapper
- BUG: 9.0 `cr:prune` is a noop if projections are empty already or not up to date HOT 1
- Regression: 4838 Fusion `ParsePartials` cache broken in latest `8.3.10` release
- FEATURE: "Connect" new site entity to site node
- Flow Query Replacement HOT 1
- AssetUsage Interface
- TASK: Remove obsolete i18 label `content.inspector.editors.dateTimeEditor.apply` HOT 1
- BUG: Fusion translations not working in Neos 9 HOT 4
- 9.0 Test, (Refactor) and rename Neos' Fusion View
- 9.0 Dev & Debugging add human readable node database view
- 9.0 Odd `RebasableToOtherWorkspaceInterface` commands `AddDimensionShineThrough` and `MoveDimensionSpacePoint` HOT 2
- BUG: autocomplete in Neos password update HOT 1
- BUG: Make Neos.Neos independent of Neos.Ui
- BUG: Raw Content shows no formatting when inline editing HOT 1
- BUG: Use preview `renderingMode` for page preview
- BUG: 1062 Duplicate entry when trying to publish workspace or run node:repair in it HOT 1
- [BUG?] FusionExceptionView drops all header information from rendered output HOT 1
- BUG: Projection errors in nested transaction are obscured HOT 2
- TASK: Introduce (internal) low level content graph api for constraint checks and write side
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neos-development-collection.