class AjaxWidgetMiddleware implements MiddlewareInterface (View source)

A HTTP middleware specifically for Ajax widgets It's task is to interrupt the default dispatching as soon as possible if the current request is an AJAX request triggered by a Fluid widget (e.g. contains the arguments "widgetId" or "widgetContext").

Properties

protected ActionRequestFactory $actionRequestFactory
protected HashService $hashService
protected AjaxWidgetContextHolder $ajaxWidgetContextHolder
protected Context $securityContext
protected Dispatcher $dispatcher

Methods

ResponseInterface
process(ServerRequestInterface $httpRequest, RequestHandlerInterface $next)

Check if the current request contains a widget context.

WidgetContext|null
extractWidgetContext(ServerRequestInterface $httpRequest)

Extracts the WidgetContext from the given $httpRequest.

Details

ResponseInterface process(ServerRequestInterface $httpRequest, RequestHandlerInterface $next)

Check if the current request contains a widget context.

If so dispatch it directly, otherwise continue with the next HTTP component.

Parameters

ServerRequestInterface $httpRequest
RequestHandlerInterface $next

Return Value

ResponseInterface

protected WidgetContext|null extractWidgetContext(ServerRequestInterface $httpRequest)

Extracts the WidgetContext from the given $httpRequest.

If the request contains an argument "widgetId" the context is fetched from the session (AjaxWidgetContextHolder). Otherwise the argument "widgetContext" is expected to contain the serialized WidgetContext (protected by a HMAC suffix)

Parameters

ServerRequestInterface $httpRequest

Return Value

WidgetContext|null

Exceptions

WidgetContextNotFoundException
InvalidArgumentForHashGenerationException
InvalidHashException