![viewbase section annotation edit viewbase section annotation edit](https://photos1.blogger.com/blogger/7963/1881/1600/Elev-S1.jpg)
One or more ATH::Arguments::Resolvers::Interface will then be used to resolve each specific argument's value. This is achieved via an ATH::Arguments::ArgumentResolverInterface that facilitates gathering all the arguments. Argument Resolution #īefore Athena can call the controller action, it first needs to determine what arguments, if any, should be passed to it. This next step is not an event, but a important concept within Athena nonetheless executing the controller action related to the current request. This is the event that ATH::Listeners::ParamConverter and ATH::Listeners::ParamFetcher listen on to apply custom conversion logic via an ATH::ParamConverter, or resolve request parameters such as ATHA::QueryParams. If enabled it is able to return a CORS preflight response even before routing is invoked. An example of this would be the ATH::Listeners::CORS listener. In some cases the listener may have enough information to return an ATH::Response immediately. The primary purpose of this event is to create an ATH::Response directly, or to add information to the requests' attributes a simple key/value store tied to request instance accessible via ATH::Request#attributes. The very first event that is dispatched is the ATH::Events::Request event and can have a variety of listeners. The flow of a request, and the related events that are dispatched, is depicted below in a visual format:
![viewbase section annotation edit viewbase section annotation edit](https://iastate.pressbooks.pub/app/uploads/sites/50/2020/10/16_02_03_Add-views-on-a-sheet-1-225x107.jpg)
These events are listened on internally in order to handle each request custom listeners on these events can also be registered. Powered By Events #Īthena is an event based framework, meaning it emits various events via the Event Dispatcher component during the life-cycle of a request. Steps 1 and 3 are handled via Crystal's HTTP::Server, while step 2 is where Athena fits in.