Google API with Grails

Creating a Google API Console project and client ID     Before you can integrate Google Sign-In into your website, you must have a Google API Console project. In the project, you create a client ID, which you need to call the sign-in API. To create a Google...

Facebook SDK in Grails 3 (3.2.9)

Facebook SDK : no more 0Auth remote database…no more sign up form…use Facebook for sign up… use own database to validate users…no more third party database… short coding ( need only 2 JavaScript – sdk.js and facebook.js ) Fast...

Geofencing

Geofencing is actually a process of creating/defining geofence on the maps. It can be either circle,rectangle or n-sided polygon shaped. Geofence is nothing but a virtual boundary that is drawn on map. Geofence have many applications like:   If a vehicle moves...

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:...

CSS Wildcard characters

Hello Everyone! Recently, I was working on a UI task and I had to give CSS styling to a div on the basis of ID. The div was being generated dynamically(with dynamic ID/class) using jquery mobile. I observed that the ID contained some identifiable pattern(along with...

Change Mysql password.

  We all have worked in Mysql with the default username ‘root’ and password ‘root’ but we should not keep our Mysql password to default as its insecure. I am here with a blog which helps you change the password of Mysql with minimal steps...

Observer Design pattern

Hello folks, This post is all about to the Observer Design pattern. There is common occurring problem where we need to define ” a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated...

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:...

Nginx selective forwarding to tomcat

Nginx selective forwarding I encountered a situation today where Nginx had to forward all requests to tomcat except couple of URL’s which will be served by static content located inside Nginx root folder. This is what I did:   server { server_name...

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...

Spring Bean Life Cycle

Good Evening Folks. Every Java developer knows that at the time of creation of any object if some initialization is required we keep in constructor. Example. Class Math{ Math(){ // initialization code } } When it comes to J2EE Technology like Servlet we can do same...

Spring static factory method

Good Evening Folks. Today we will deal with a situation where we need an Object in our Spring bean class which can not be created with normal spring bean configuration tag. Lets take a example where requirement is we need inject an object inside my spring bean and...