Grails

Request Mocking to use groovyPagesTemplateEngine in backend threads

We have a setup where a backend thread, fired by the Spring Events, does some processing, generates a PDF and emails the result to the user. The code we were using to generate the HTML from a GSP to be converted to a PDF using iText was as follows : [java] def webRequest = RequestContextHolder.getRequestAttributes() […]

Vivek Krishna
Vivek Krishna
Read

Grails

Using Custom Tag for embedding the Video in Grails

I had to make a video available on my GSP page. So I looked at the grails flash-player plugin.  After going through the documentation I found that it could not be used with videos on YouTube. This code given below will generate the script for the flash player on your GSP for playing youtube videos. [html] […]

Anuj Aneja
Anuj Aneja
Read

Grails

Creating custom codec in Grails

Grails applications can define their own codecs and Grails will load them along with the standard codecs. A custom codec class must be defined in the grails-app/utils/ directory and the class name must end with ‘Codec’. For more information see Dynamic Encoding Methods. [java] import java.security.MessageDigest import sun.misc.BASE64Encoder class PasswordCodec { static encode = { […]

Ankur Tripathi
Ankur Tripathi
Read

Grails

Encode Content to MD5 Using GROOVY or GRAILS – with Webhook example

Recently I was working on webhooks (which are getting quite popular for sending notifications to other applications using HTTP POST methods). MD5 encoded content is heavily used in webhooks for security concern. My purpose of writing this blog is neither to explain MD5 nor webhooks. But just to show you – 1. a quicker way […]

Salil
Salil
Read

Grails

Datamatrix for unique identification of Documents on Server Side with libdmtx

I had earlier written a post on how to use QR Code to take care of identification of printed documents and updating the DB based on the QR Code detection. However, we had to abandon the use of QR Codes in the document because the library wasn’t performing reliable, even with QR Codes from image […]

Vivek Krishna
Vivek Krishna
Read

Grails

SpringOne2GX : Peter Ledbrook’s session on Performance Tuning

Peter Ledbrook took an amazing session on tuning your grails Application here at SpringOne2GX in Chicago. In this session Peter talked about tuning the various aspects about in your application starting from server side optimizations to the caching and zipping of static resources. One of the most important thing that Peter pointed out was to […]

Himanshu Seth
Himanshu Seth
Read

Grails

Regex to match exact word in a string

Hi, In my recent grails project, i needed to check the occurrence of a word in a string. I could have used contains() method of groovy , but the problem with contains() is that it also matches the word if the word is contained as a substring in any word. I searched a lot, but […]

Vishal Sahu
Vishal Sahu
Read

Grails

Grails Liquibase plugin: dbDiff tool workaround

The current project I am working on, is going through QA. At the same time development of the new features and bug fixing is on and we couldn’t afford to loose the test data. So synchronizing the state of the QA database with the development was becoming a pain. So we decided to use grails […]

Amit Jain
Amit Jain
Read

Grails

Grails way for rendering the GSP templates: The tmpl namespace.

Today while working on a project, I paired up with my colleague (Uday)  and we found that we can render a gsp template in a different manner also. Grails provide us a “tmpl” namespace for rendering the GSP templates. The old way that we use to render a gsp template The other way for  rendering […]

Services