Skip to main content


How to efficiently cache static resources in a web application

This article is about an efficient technique of caching static resources on the client side (user's browser). There are quite many ways to implement caching including HTTP headers. A common disadvantage of them is that as soon as some resource is cached by the browser, it won't be updated until it's expired. Thus, the server loses control over the browser caching mechanism for some period of time. As a result we have to adjust the expiration time period or updating frequency somehow. The better alternative is the case when it's only the server that is in charge of the browser caching mechanism. Actually the idea has been borrowed here . If we append a GET parameter with some changing value (like a timestamp or a version) for a static resource URL, it'll force the browser to get the fresh version of the resource from the server. If we keep the parameter value steady, the resource will be taken from the browser cache. Finally this article is about implementation.

DynamicReports and Cocoon integration

This is one more tutorial on how to exploit DynamicReports reporting library in an existing web application. This time the application is based on  Cocoon 2.2 framework. This post is a continuation to the previous posts: Choosing Java reporting tool - part 2 and DynamicReports and Spring MVC integration . The complete code won't be provided here but only the essential code snippets together with usage remarks. First of all I'm writing the plan of this how to: Description of existing application data flow. Adding project dependencies. Implementing export servlet. Implementing XSLT extension for the export data source. Implementing XSLT for postprocessing. Modifying JX template. Modifying Cocoon sitemap. Description of existing application data flow Cocoon framework organizes data flow using the concept of pipelines. For details please refer to Cocoon documentation . My application uses the following component sequence in a pipeline: Standard JX template gener

DynamicReports and Spring MVC integration

This is a tutorial on how to exploit DynamicReports reporting library in an existing  Spring MVC based web application. It's a continuation to the previous post where DynamicReports has been chosen as the most appropriate solution to implement an export feature in a web application (for my specific use case). The complete code won't be provided here but only the essential code snippets together with usage remarks. Also I've widely used this tutorial that describes a similar problem for an alternative reporting library. So let's turn to the implementation description and start with a short plan of this how-to: Adding project dependencies. Implementing the Controller part of the MVC pattern. Modifying the View part of the MVC pattern. Modifying web.xml. Adding project dependencies I used to apply Maven Project Builder throughout my Java applications, thus the dependencies will be provided in the Maven format. Maven project pom.xml file: net.sourcefo

Choosing Java reporting tool - part 2

I've provided a general overview of possible solutions to get a reporting/exporting functionality in the previous post . This is the second overview of alternatives based on JasperReports reporting engine. Since the previous part I've done the following: Implemented a simple report using both DynamicJasper and DynamicReports to compare them from technical side. Investigated JasperServer features and tried to implement a simple report for JasperServer instance (it appeared we already have a ready licensed installation of JasperServer that makes it unreasonable to install a fresh one). First, the comparison results of Java libraries (DynamicJasper and DynamicReports): Both libraries suffer from poor-quality or missing Java docs but they look a bit better in DynamicJasper. Taking into account the point 1, a developer has to use online documentation and to review the code. Here the code looks definitely nicer and more readable for DynamicRepo

Choosing Java reporting tool

My current goal is to obtain an universal solution to be able to export application data in any format I'd prefer. Mainly it includes exporting tables with various data. I've done an overview and have considered the following alternatives: Own implementation. Here I mean implementation of own Java library that will accept some abstract data (say, valuelist) and will perform export using known open-source libraries (MS Office Excel - Apache POI, PDF - itext, etc). This is the way we've already used at work before. The critical disadvantage of this proposal is that much efforts will be required. Existing solution. This is also known as reporting engine software. Main points: JasperReports is the most popular open-source reporting engine. There are 3 ways to use it: JasperReports API - gives complete control on report creation but is extremely complex. Different visual report designers (e.g. iReport) - allows creating report templates manually. Software tools