Overview: mappers and static file handling

Brasato offers two ways to deliver files to the browser:
  1. Via dispatcher
  2. Via mapper

Dispatcher: static application files

To deliver static files that are part of the application brasato offers one concept:

  1. Files in webapp/static*

The first mechanism is used to embedd general framework resources, e.g. css files, themes and basic javascript files. Those files are normally embedded directly in body.html. Those files are deliverd using the StaticMediaDispatcher class.

Mapper: dynamic (content) files

While the delivery of static resources via the dispatchers described above is a service infrastructure of the framework, the mapper comes in place when you want to have control over the delivery process (e.g a protected resource) or the delivered files are generated on the fly (e.g. an excel file download).

Registration

Mappers must be registered using the mapper registry or the global mapper registry. The difference between global and normal is that globals mappers have a global mapper name based on the class that registered for the mapper. Thus, the global mapper will always have the same URL and can be cached by the browser. Global mappers are shared between all users. Make sure you implement a proper last-modified in the resources you deliver via global mappers!

The normal mapper registry registers for user session based mappers. The life-time of such mappers is bound to the user session.

Deregistration

Make sure you unregister the mappers you register. Use the BasicController to work with mappers and use the convenience methods there to register mappers

Note that global mappers don't need to be unregistered. They are registered only once in a class and cleaned up when the applicatoin shuts down.

Diagram with Apache

TODO Note this graphic is outdated !