Hi, Recently, in my project while downloading some files(not on all files) i am getting exception on chrome, that say : Duplicate headers received from server Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple Content-Disposition headers received. This is disallowed to protect against HTTP response-splitting attacks. But when i download the same files on IE, Firefox […]
Groovy 2.0 comes with some amazing new features, which prompted a numbering scheme jump from 1.9.x to 2.0. One of the key features that I took note while going through Guillaume Laforge’s presentation at 33rd Degree was the support for plain language sentences made possible by optional parentheses, and dots. We love the language and […]
Here is an example of how to design Grails domain class with Intellij Idea.For this we need to have blank domain classes. So lets say we created three Domain Classes Company,Book,Author To see relationship diagram, Selected Domain Class, and selected tab Domain Class Dependencies.It should look like this Lets assume the relation that publication has many […]
Groovier way of finding index of element from Map. It can be obtained with findIndexOf Method, which accepts closure as argument. [groovy] Map map=["groovy":1,"grails":2,"index":3,"element":4] assert 3 == map.findIndexOf{it.key=="element"} assert 0 == map.findIndexOf{it.value==1} [/groovy]
Recently, I saw some code of grails Hibernate Plugin and noticed an interesting usage of ‘as’ operator. The ‘as’ operator of groovy is typically used to change the types of objects. For example: [groovy] int a = "20" as int assert a==20 [/groovy] The ‘as’ operator can be used to provide implementation to interface as […]
Hi guys, Recently on a project, I was creating a number of command objects to accept incoming parameters from a POST call from an iPhone with which I needed to sync data. I created a parent class for all command object classes to accept the common properties and created individual command object classes to accept […]
Many at times, we have a string which needs to be converted into Enum. I will be sharing few options as stated by Mr.Haki, Isa Goksu and in the last the one I discovered during the process. Lets say we have a Enum AccountType as given below : [groovy] enum AccountType { CHECKING, SAVING } assert […]
In my current project, we were required to implement Instance Based Security. The idea was to find a clean solution separate from the main business logic of the application. We took a clue from the Spring Security Plugin to use the Annotations to do our job. All we wanted to do was to develop annotations […]
Hi Friends, Recently I had to execute bash script using groovy on a windows server. Though I could easily make the similar script run on linux, but on windows it just didn’t work as it was unable to recognize the internal DOS commands like cp, rm etc. On linux the following code worked but not […]