class AjaxWidgetComponent implements ComponentInterface (View source)

A HTTP component 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

void
handle(ComponentContext $componentContext)

Check if the current request contains a widget context.

WidgetContext|null
extractWidgetContext(ServerRequestInterface $httpRequest)

Extracts the WidgetContext from the given $httpRequest.

Details

void handle(ComponentContext $componentContext)

Check if the current request contains a widget context.

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

Parameters

ComponentContext $componentContext

Return Value

void

Exceptions

Exception

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