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

ComponentContext should be made available everywhere #1304

Closed
albe opened this issue Apr 30, 2018 · 7 comments
Closed

ComponentContext should be made available everywhere #1304

albe opened this issue Apr 30, 2018 · 7 comments

Comments

@albe
Copy link
Member

albe commented Apr 30, 2018

This context should be the single API for retrieving the "current" request and response objects inside an web request context.

Also, the ComponentContext should probably be renamed to HttpContext

See also #550

@albe
Copy link
Member Author

albe commented Jul 31, 2018

Question: How should the HttpContext be made available?

@albe
Copy link
Member Author

albe commented Oct 7, 2019

Simplest solution would be making it injectable, but that would only work after the RequestHandler has started (but still before it is "booted") and only for HTTP requests, so the injection would be somewhat fragile.

Another solution would be to just make the RequestHandler injectable, as that is created very early in the bootstrap process (see Bootstrap::run()), but would mean another level of indirection.

@kitsunet
Copy link
Member

kitsunet commented Oct 8, 2019

but hten you might as well go the route we have right now. Get Bootstrap injected -> $this->bootstrap->getActiveRequestHandler(); -> check if http request handler etc. etc.

I don't see how we can make this automatic and ensure it's actually right. Seems like the same conundrum as with the baseUris.

@albe
Copy link
Member Author

albe commented Oct 8, 2019

Well, at least we would get rid of one layer of indirection... but yeah, still far from optimal.

@albe
Copy link
Member Author

albe commented Dec 18, 2019

Related to #1889 - I think we don't even need a Component/HttpContext in the long run at all. It was a convenience artefact of passing mutable req/res classes around.

However, we still need some means to access the current request/response from places outside the controller (and even there we only have indirect access to the http request via the ActionRequest - which is good though). Now those need to be few clearly defined places - like the security stack.
Anyway, autowired injection is out of the question then. Request/Response should only directly be passed on to be immediately used and passed further/returned.

The first place I'd like to get rid of the ComponentContext is in the new ActionResponse::mergeIntoComponentContext($context) method, which should be trivial.

@albe albe added this to Backlog in Neos 5.2 & Flow 6.2 Release Board via automation Dec 18, 2019
@albe
Copy link
Member Author

albe commented Mar 8, 2020

I added the ComponentContext to early instances in https://github.com/neos/flow-development-collection/pull/1928/files#diff-c9a34331dc86f0b1a7fe83d9e9473725R97 - this should work most of the time (unless you have custom code that runs in the index/bootstrap). However, we still need to get rid of this thing anyway.

@albe albe removed this from Backlog in Neos 5.2 & Flow 6.2 Release Board Apr 3, 2020
@albe
Copy link
Member Author

albe commented Sep 18, 2020

closing as of #1928 and since this will be removed anyway

@albe albe closed this as completed Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants