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

Getting property class from property name

Recently in one of my project i had a requirement of identifying the class of a property of an object with object class and property name and then determining whether it’s an Enum class or not. I found an easy solution for this using Reflection API. Using Java Reflection you can inspect the fields (member […]

Sachin Verma
Sachin Verma
Read

Grails

FindResults and FindResult Methods of Groovy

In almost all the applications that we work on, we have to transform elements of a collection in one way or the other. We can do it in different ways. Let there be a domain “Employee” with following attributes: [java] class Employee{ String firstName String lastName Double salary } [/java] And we have 5 Employees: […]

Vivek Sachdeva
Vivek Sachdeva
Read

Grails

Fire Plugin OnChange/onConfigChange Event at Run Time Manually

Hi,   Suppose you have implemented some logic in your application which updates the Config at runtime.   Now after you have updated the config, you should notify the plugins about configChanges such that they reload their configurations. This can be done by firing the onConfigChange Event of the plugins.   Similarly you can also […]

Kushal Likhi
Kushal Likhi
Read

Grails

Reading comments of LinkedIn wall post

Hi, In one of my grails project, i needed to show the comments on any wall post of linkedin through API. I used the Java wrapper to connect any linkedIn account with the grails application which can be seen here. But somehow this library was not working when we need to fetch comments from any […]

Vishal Sahu
Vishal Sahu
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

Get recent twitter followers using Twitter4j

Hi, In the previous blog we saw how to fetch twitter users based on some search criteria using the Twitter4j library, a java wrapper available for Twitter API calls. In the same grails project, i had the requirement to display the recent twitter followers of authenticated twitter accounts. Twitter4j library provides a way to get […]

Vishal Sahu
Vishal Sahu
Read

Grails

Search Twitter Users using Twitter4j

Hi, In the previous blog we saw how to fetch tweets based on some search criteria using the Twitter4j, a java wrapper library available for Twitter API calls. In the same grails project, i had the requirement to search users based of their name or words. Twitter4j library provides a cool way to search users […]

Vishal Sahu
Vishal Sahu
Read
Services