Kernel::WebApp::Controller::API::Role::ServesVirtualFSFileResource

NAME

Kernel::WebApp::Controller::API::Role::ServesVirtualFSFileResource – Serves file from the VirtualFS.

PUBLIC INTERFACE

Consume this role to have a method at disposal to serve a VirtualFS file resource as a response:

    with qw(
        Kernel::WebApp::Controller::API::Role::ServesVirtualFSFileResource
    )

The role will provide you with a ready to use ServeVirtualFSFileResource() method for serving VirtualFS file contents. If file is not found under the exact requested path, it will return a 404 Not Found response.

You can still provide your own or wrap around ServeVirtualFSFileResource() method to implement a different logic and checks behind it.

ServeVirtualFSFileResource()

This method returns a VirtualFS file resource to the requester, based on specified path. Just pass back its return value which will be a valid response.

    return $Self->ServeVirtualFSFileResource(
        VirtualFSPath      => $Path,        # (optional) Returns 404 if missing
        ContentDisposition => 'attachment', # (optional) default: 'inline'
    );
Scroll to Top