Open neos-bot opened 9 years ago
Comment created by @bwaidelich:
Note: We "hotfixed" this for Neos 1.1.* with NEOS-108 but we need a general solution in Flow (see comments on NEOS-108 for previous discussions)
Comment created by sorenmalling:
[~bwaidelich] So, I did some looking into this yesterday.
I focused on the ExceptionHandler classes. My idea is to add a configuration similar to matchingStatusCodes
and matchingExceptionClassNames
for the mediatype
What puzzles me, is that I have no connection to the Request
object, so I can't see what media type is accepted.
In that way, a configuration like to following could be an example
TYPO3:
Flow:
error:
exceptionHandler:
renderingGroups:
'someFancyGroupName':
matchingExceptionClassNames: ['TYPO3\Flow\Persistence\Doctrine\Exception\DatabaseException']
matchingMediaType: 'application/xml'
options:
Comment created by sorenmalling:
So, the actual question is:
How do I get the accepted mediatype for the request, when Request
is not available?
Can I somehow inject it or just initialize it?
Comment created by @bwaidelich:
[~sorenmalling] I had a similar idea and I like it, although it should be matchingMediaTypes
(plural) IMO.
Getting hold of the Request
is indeed a problem we need to solve.. We can get it via
/****
* @Flow\Inject
* @var \TYPO3\Flow\Core\Bootstrap
****/
protected $bootstrap;
// ...
$httpRequest = $this->bootstrap->getActiveRequestHandler()->getHttpRequest();
..That's not the best solution in terms of clean coding, but it should work for our case
Comment created by @bwaidelich:
..but, true, a problem remains, because we don't know what the negotiated format is, because that's set by AbstractController::initializeController()
in the ActionRequest
..
Comment created by pumatertion:
I am still pretty unsure about the response format. Except cli response the format should be detected by request header data instead of extension .whatever? Example: Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Jira issue originally created by user @bwaidelich:
The Flow
ExceptionHandler
s currently only adjust their rendering based on request type (Web/CLI) and context (DebugExceptionHandler
/ProductionExceptionHandler
).They should, in addition, be able to react upon the requested format, e.g. by evaluating the
Accept
HTTP header of the current request.Jira-URL: https://jira.neos.io/browse/FLOW-202