Clean Up Your ThreadLocals

Forgetting to clean up ThreadLocal variables might really hurt you. Let’s see how. I have several integration tests with Spring WebFlow and JSF and in one of them I have an setUp method like that: @Before public void setUp() {      RequestContextHolder.setRequestContext(new MockRequestContext()); } I just create a MockRequestContext and put it into RequestContextHolder so […]

JSF Required Validation Still Giving Headaches…

For some time ago, we had decided not to use JSF’s required attribute and instead handle required validation with a validator object implementing Validator interface, attached to current UIInput component. By that way, we were able to develop validation bypass mechanism while being able to update model, and group validation capability which let us to […]

How to create a custom FacesContext

Although I am not happy with several issues in JSF spec, I like its customizability. A couple of days ago, I needed to introduce Mediator pattern in my case studies. FacesContext instance seemed to be a good candidate as Mediator object. You need to execute three easy steps to introduce custom FacesContext implementation into your […]

Integrating JSFUnit To Your Project

Actually I am not a big fun of in-container unit testing approaches. They have longer execution times, e.g. container and database startup, intialization times etc. In addition, they create configuration complexity in terms of packaging of tests and deployment of application together with them. Anyway, recently I needed to examine JSFUnit solution more closely for […]

Configuring web.xml According to Target Deployment Platform

It is a very common requirement to configure JEE web applications according to their current runtime environment. In JEE, web.xml file is aimed to be the configuration unit of those web applications. Unfortunately, it is not designed with such a requirement in mind. For example, we use JSF and Facelets in our current project. In […]

Acegi-JSF 1.1.3 is released

It was over one year ago that Çağatay developed some JSF components which correspond to Acegi JSP taglib. We were in the same project at that time, and were using Acegi Security Framework extensively. Later, our ways were separated and we focused on different tasks. Recently, I started work on a new project to enable […]

Customizing JSF Required Field Messages per Component Instance

JSF is nice that it provides some useful built-in features to validate entered values or if provided any required one, but it fails at providing enough mechanism to let developers customize those features at the level of each component instance. This is a common drawback of JSF specification in general. We specify that user input […]

Mocking ResourceBundle

If you want to unit test a method that depends java.util.ResourceBundle, and want to isolate bundle access code with mocking ResourceBundle, using for example, JMock Dynamic Mocking Library, you will face with a restriction, that commonly used methods, such as getString(key) are defined as final in ResourceBundle class. There is no way to extend and […]