Grails

Evaluating Expressions with groovy.util.Eval

A few days ago I faced a problem of evaluating dynamic expressions on domain objects. The scenario was that, depending upon the user input, I needed to sort a list of objects on some properties, which were nested deep in the object, e.g., [java] student.course?.college?.name // if a user chose to sort students by college name ...

by Imran Mir
Tag: Grails
27-Aug-2012

Grails

Integrating Spring AOP with Grails Application

AOP means Aspect Oriented Programming Enables encapsulation of functionality that affects multiple classes in separate units. Complements Object Oriented Programming. Cross Cutting Concerns : Functionality whose implementation spans multiple modules. Different From OOPS Sometimes we want to implement common functionality...

by Mohit Garg
Tag: Grails
27-Aug-2012

Grails

Login with Twitter

This application saves user’s time for registration by providing a way through which user can login into application with its twitter credentials. Application will get the user details from his corresponding twitter account and will do the registration programmatically, so user can easily manage account through his twitter account. ...

by Amit Kumar
Tag: Grails
24-Aug-2012

Grails

Manage Multiple Log File

Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In that case we...

by Amit Kumar
Tag: Grails
24-Aug-2012

Grails

Auto Completion for Grails Scripts with Dynamic Version Determination

We are constantly striving to be more productive by minimizing key-strokes for a lot of commonly used shell commands. Alias is one way of achieving it, but it isn't always the answer. Bash auto completion is one feature that I use a lot. To avoid the hassles of working with multiple grails projects, I use this script and for auto...

by Vivek Krishna
Tag: Grails
16-Aug-2012

Grails

How to configure SSL on Tomcat server and run Grails/Java application on HTTPS

To run your Grails application on SSL, firstly you need to configure the Tomcat server. Here in this example, I will show how to configure Tomcat instance and run Grails/Java application. For SSL/HTTPS: We need .keystore file. You can generate it by using command“keytool -genkey”. Run this command on linux terminal or window...

by Mohit Garg
Tag: Grails
29-Jun-2012

Grails

Facebook ‘Like’ a wall post using Graph API

Hi, In one of my Grails project, i needed to 'Like' any Facebook wall post using facebook API. I searched about it and found a way to achieve this using Facebook Graph API and thought it worth sharing. To achieve it, we should have a valid facebook access_token, which can be obtained using steps described here. After obtaining a...

by Vishal Sahu
Tag: Grails
28-Jun-2012

Grails

Posting photos to Facebook album using Graph API

Hi, In my recent grails project, i needed to post images to the albums for Facebook Profile/ Fan page/ Group using facebook API. I searched a lot and find a way to achieve this using Facebook Graph API. To post any content over facebook, we need to have facebook access_token which can be obtained using steps described here After...

by Vishal Sahu
Tag: Grails
28-Jun-2012

Grails

Integrating Grails With Weceem 2 : Creating custom content

Hiya.... Last time we met, we  were talking about how to get started on Integrating Grails With Weceem CMS. Moving on, when you actually use it in a typical product development scenario, you will more often that end up customizing the content being served by Weceem. So this blog will concentrate on exactly that..... Creating...

by Manoj Mohan
Tag: Grails
26-Jun-2012

Grails

Setting JVM args for grails run-war

While working on my project using Grails 2.0.3, I was getting java.lang.OutOfMemoryError with grails run-war even when my JAVA_OPTS are set. Then while going through documentation and this thread i found how to set jvm args for grails run-war. Just add this code in your BuildConfig.groovy and you are done. [code]...

by Ankur Tripathi
Tag: Grails
19-May-2012

Grails

Overriding properties in a Spring Bean with BeanFactoryPostProcessor

I was going through the source code of one of the Grails Plugins where I found the use of Spring's BeanDefinitionRegistryPostProcessor to override some configurations that are available in DataSource.groovy. That involved a complete over riding of a PropertyValue definition.   It set me thinking about whether there is a way to...

by Vivek Krishna
Tag: Grails
12-May-2012

Grails

Change user preferred locale using spring’s SessionLocaleResolver

Here we are going to talk about a scenario where there are some records in database which are specific to locale and they need to be displayed as per user's current locale at number of places.Also user can change its preferred locale. For this I preferred to set the user's locale in the session object. There are two ways to do this :- ...

by Nitesh
Tag: Grails
11-May-2012