class Athena::Framework::View::ViewHandler
inherits Reference
#
Default implementation of ATH::View::ConfigurableViewHandlerInterface
.
Included modules
Athena::Framework::View::ConfigurableViewHandlerInterface
Constructors#
.new(url_generator : ART::Generator::Interface, serializer : ASR::SerializerInterface, request_store : ATH::RequestStore, format_handlers : Array(Athena::Framework::View::FormatHandlerInterface), failed_validation_status : HTTP::Status = HTTP::Status::UNPROCESSABLE_ENTITY, empty_content_status : HTTP::Status = HTTP::Status::NO_CONTENT, emit_nil : Bool = false)
#
Methods#
#create_redirect_response(view : ATH::ViewBase, location : String, format : String) : ATH::Response
#
Creates an ATH::Response
based on the provided view that'll redirect to the provided location.
location may either be a URL
or the name of a route.
#create_response(view : ATH::ViewBase, request : ATH::Request, format : String) : ATH::Response
#
Creates an ATH::Response
based on the provided view and request.
#emit_nil=(emit_nil : Bool) : Nil
#
Determines if properties with nil
values should be emitted.
#handle(view : ATH::ViewBase, request : ATH::Request | Nil = nil) : ATH::Response
#
Handles the conversion of the provided view into an ATH::Response
.
If no request is provided, it is fetched from ATH::RequestStore
.
#register_handler(format : String, handler : ATH::View::ViewHandlerInterface::HandlerType) : Nil
#
Registers the provided handler to handle the provided format.
#serialization_groups=(groups : Enumerable(String)) : Nil
#
Sets the groups that should be used as part of ASR::ExclusionStrategies::Groups
.
#serialization_version=(version : SemanticVersion) : Nil
#
Sets the version that should be used as part of ASR::ExclusionStrategies::Version
.
#supports?(format : String) : Bool
#
Determines if self
can handle the provided format.
First checks if a custom format handler supports the provided format,
otherwise falls back on the ASR::SerializerInterface
.