ResourceManager

Released 4 years ago , Last update 4 years ago

ResourceManager is used to avoid multiple HTTP requests when loading resources like Javascript or CSS files. It uses one Servlet that receives the name of all wanted files, load and process them. The response can be sent in two formats: all resources concatenated in a single result or a JSON array containing each resource associated with its path.

The ResourceManager is composed by one ContextListener that holds all resources that were already loaded and processed. It is also responsible for loading new resources needed.

Loaders are used to load resources from any place. This module comes with two implementations: WebApplicationFileLoader and ClasspathLoader. The first one loads resources contained in the application directory. The second loads resources that were added to the classpath (through a jar or whatever).
To add a new Loader to the application, just implement the interface and set it up as a service.

Before being handled to the servlet resources can be processed (compressed, obfuscated, etc.) by Processors. Processors can also be registered as services and will be loaded automatically just by adding them to the classpath. No processor is included in this module.

Another feature that was added to this module is a tag that configure a link to the servlet automatically. In the last two screenshots there is an example of how to use it and what is generated.

Pricing

FREE

MIT license

The MIT license is an open-source license.

Installation

Step 0 - This module depends on the Jackson JSON Processor to create JSON outputs. Download and add it to your project before continuing.

Step 1 - Add the jar that comes inside the zip file into your WEB-INF/lib directory.

Step 2 - Configure the ResourceContextListener just add a listener element to your web.xml file:

   
        br.com.depasser.web.resource.ResourceContextListener
   

Step 3 - Add the servlet and servlet mappings:

   
       
        ResourceServlet
        ResourceServlet
        br.com.depasser.web.resource.ResourceServlet
   

   
        ResourceServlet
        /resources.do
   

   
        ResourceServlet
        /resources.json
   

That's it, you can start using it!

License » MIT license Download

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
No comments have been posted yet.