Spring annotation in Grails 3

I was recently working on a grails project and found that it is possible to read the configuration/properties defined in application.yml using spring annotation in Grails 3. Its possible in Grails 3 because it uses Spring boot under the hood. Here is an example:...

Handle session timeout in Ajax request

Recently, I was working on a grails application in which I wanted to handle session timeout when ajax request was fired. When session expires in case of normal request, the browser redirects to login page which is handled by spring security.   In case of Ajax...

Test forward method of Controller

This blogpost titled “Test forward method of Controller” explains the technique that can be used to test forward method of controller. Recently, I was writing test cases in grails to test an action : def performAction() { forward(controller:...

Working with Stripe in Grails

In a recent project, I got a requirement to integrate a Payment gateway. I choose Stripe as it is PCI Level 1 complaint which is the most stringent level of all 4. Following are the steps to integrate stripe in Grails.   Create an Account on Stripe. Goto Account...

Using dynamic path in Jasper Report

In this post, I will explain how we can add images using dynamic path in Jrxml. First of all, we need to add the image component to JRXML file. Click on Window Menu> Palette and then drag-drop the image component on the designer window.   Once we add image...

URL mapping with constraints in Grails

Hi guys,I am back with my new blog post. As some times we have scenario to map specific URL for example “www.myexample.com/someusername” we can do this mapping easily '$_username'{ controller= "profile" action= "show" } but the issue is...