Grails

Cool way to get/set processed HTML Markup in filters

Hi,   There was a case where i had to encrypt the HTML output of the GSP before displaying it to user. There are a lot of ways to do it, but i wanted to make is as simple as possible. Hence here is the pattern i used:   Note: This is just an example, […]

Kushal Likhi
Kushal Likhi
Read

Grails

Groovy: Overriding “Plus” operator in a class with interesting example

Have you ever wondered how to overload “plus” operator in Groovy ? It is as easy as adding toppings to your favourite pizza. Let me explain. Let us taka a class for Pizza:   [java] @ToString class Pizza { String name List<Topping> toppings double price } [/java] And another for the Topping: [java] @ToString class […]

Imran Mir
Imran Mir
Read

Grails

Instance based login in spring security core

Spring security loads the roles of user from user role table based on all roles assigned to user and that role is application specific. But In my project i require to assign roles to user based on instance . So when the instance is changed roles should be changed .In grails we can overide the […]

Shaurav
Shaurav
Read

Grails

Few Simple steps for integrating Rabbit MQ with Grails

Rabbit MQ as defined by rabbitmq.com is a robust messaging for applications. We used RabbitMQ to achieve asynchronous communication between two parts of the application. I would like to share the same in a step by step fashion. Here are few simple steps that I followed to make my grails application use rabbitmq: 1.Install rabbitmq […]

Mohd Farid
Mohd Farid
Read

Grails

Redis: Heavyweight Tags – an awesome use-case for caching with Redis

Redis plugin provides a beautiful way to cache the html tags. Using this plugin we can make big savings on the time taken to render the gsp tags. [java] <redis:memoize key="someKey" expire="3600" > //Some heavy weight tags rendering // Lots of db / network operations. </redis:memoize> [/java] I found this tag extremely helpful in rendering […]

Mohd Farid
Mohd Farid
Read

Grails

Redis: Tag Cloud using Redis

I would like to share a simple and efficient way of creating tagclouds that I discovered very recently. A Tag Cloud is a pictorial representation of some tags/text. The size of the tag/text is drirectly proportional to the weightage of that tag/text. A sample tag cloud could be seen on our blogs site. How to […]

Mohd Farid
Mohd Farid
Read

Grails

How to implement AOP Profiling in Grails application

In one of my recent project, i want to profile method execution time. I have used Spring AOP to profile method execution time. It’s very easy to implement AOP profiling in grails 1. Suppose we have below mentioned service class, we want to log execution time of method saveDataStudent,saveDataUpdated methods in service class. We need […]

Mohit Garg
Mohit Garg
Read

Grails

Attributes of Spring Cache

In my previous blog, i have mentioned how to integrate spring cache plugin in grails. In this blog we will see how we can use different attributes of cache. Different attributes of cache :- maxElementsInMemory- How many elements you can store in cache overflowToDisk-The attribute overflowToDisk is true, meaning that whenever the maximum number of […]

Mohit Garg
Mohit Garg
Read

Grails

How to integrate Spring cache plugin with Grails

In one of my recent project, i want to cache  method output. For implementing method level cache, i have used spring cache. For implement Spring cache, we can use grails cache plugin. It’s very easy to integrate cache plugin with grails. 1. Add following plugin dependency in BuildConfig.groovy. [groovy]compile ":springcache:1.3.1" [/groovy] 2.  We need to […]

Mohit Garg
Mohit Garg
Read
Services