grails

What are the pros & cons of functional testing frameworks for a new grails application?

I've got analysis paralysis looking at all the different functional testing options for a new grails (v1.3.4) application. I've looked at WebDriver/Selenium (which I've used before) WebTest/Canoo Geb Tellurium Grails Functional Test and there must be others. I think some of the criteria that I would use to make a decision include (in...

Grails: Is there a debug flag I can check?

I have a few log.debugs() that I don't want to process (since they are heavy) unless the app is currently in debug mode (not production). Is there a way to check if the grails app is currently in debug mode/development mode? ...

Is it possible to retrieve information stored in an arbitrary grails session?

Given a sessionid, is it possible to retrieve that information from wherever the session data is stored, or do I have to store the information I want in a database, and retrieve based on the sessionid? ...

sharing authentication across multiple plugins in Grails

I have modularized a large Grails project into several plugins and want to share access to the spring security plugin to manage authentication across my project - is there an easy way to do this? I'm not sure how to share access to core project plugins from sub plugins ...

Grails hasMany: when child is updated, parent's version changes

I am using Grails and am quite surprised by the way hasMany relationships work. I have a typical hasMany relationship where the parent id is in the child table. When I insert a child and try to save it through the parent object, the parent object's version id gets incremented. My question is: Why should the parent's version id change whe...

Grails: findAllBy dynamic method - advanced sort property

I have a User class and a Item class and a user can have multiple items. I want to select some users based on other property using finndAllByProperty and adding the pagination parameters (see http://www.grails.org/doc/1.2.2/ref/Domain%20Classes/findAllBy.html .) The problem is that I want to sort the result based on how many items ea...

log4j with grails: How to get appender file name at run time?

I am working on a grails app where in development mode, I log some calculations to a log file through log4j. I want to provide a service which will read the log file and make its contents available to a developer so they can see what is being logged in the log file. Is there a way I can get the log4j appender file name at run time? ...

Mapping controller names to urls (with packages)

Is it possible to configure grails to resolve controllers and actions using the package they are in as sub-folders? For example, say I have the following directory structure: /grails-app/controllers/HomeController.groovy (with action index) /grails-app/controllers/security/UserController.groovy (with actions index, edit) /grails-app/c...

Removing commas from Grails' Scaffolds for Longs

Hello, I'm completely new to grails and I'm trying to deploy some simple applications using grails' scaffolding. I have a field in a domain class that stores barcodes as Longs. The default display in Grails' scaffolding is to display these Longs with commas separating every third numeral (e.g. 1,234,567). My searching of the documentat...

How do I use the Java ServiceLoader class in Grails?

I've used the JDK's SPI mechanism in numerous other applications without any problem; however, I can't seem to get it to work within Grails. I've tried the usual code (shown below) both from within a static initializer, and from within a class constructor, but neither worked. ServiceLoader loader = ServiceLoader.load(QueryEngine.class)...

include views vs render templates in grails

Hi What is the technical differences bewteen render a template and include a view in grails? thanks in advance ...

Using java code in a grails application causes compilation never ending loop

I have an application that I am working on modifying and I am having a problem and not sure where to look. When I first started trying to compile the problem, some of the groovy files had imports that were not resolving correctly. After some tracking down, I see that the package was not defined the way the groovy files were expecting. S...

Grails scaffolding inheritance

I have some Domain classes inheriting from a base class. However when I generate the scaffolding, the view does not contain any elements of the base class. The behaviour is the same regardless of table per hierarchy (default), or table per subclass. Is this a bug or am I doing something wrong? ...

How do I implement a request timeout in grails?

I'd like to be able to set a configurable (by controller/action) request timeout in grails. The objective is to handle a rare high-load failure mode in a deterministic way. For example, I know that if a given controller/action doesn't return in 30 seconds, then something is horribly wrong and I don't want to keep the user hanging. I'd ...

How can I send a multi-part email with text/plain and text/html parts with Grails?

I've looked through the code and documentation for the Grails Mail plugin (version 0.9) and it doesn't have the support I'm looking for. You can only set a single body and then provide a mime attachment that points to a static file. I need to actual pass a model into a GSP and have it render both the HTML and plain text versions and the...

Grails Block-level transaction with beforeUpdate interceptor gives StackOverFlowException

My domain class is like this: Class Account { String accountNo ... def beforeUpdate = { new AuditTrial(eventName:"update").save() } } In my application there is a block-level transaction as follows: def updateAccount = { Account.withTransaction { status -> def source = Account.get(params.from) ...

grails + get the next value in g:each

Hi everyone, I have a list of checkboxes like this: <g:each in="${mylist}" var = "item" > <tr> <td colspan="2"><g:checkBox value="${dimension.id}" name="${item.id}"/> - ${item.name}</td> </tr> </g:each> I have to alter it so I get 2 columns in each row (2 checkboxes per row) <g:each in="${mylist}" var = "item" > <...

How can I change column name convention in Grails?

For now I have field "String firstName" it converted to "first_name" and i want "firstname" as default in Hibernate. Is it posible? ...

How to iterate over uploaded files in Grails

Hi, I have this GSP: <g:uploadForm name="myForm" action='save'> <input type='file' name='documentFile' value=''/> <input type='file' name='documentFile' value=''/> <input type='file' name='documentFile' value=''/> <input type='file' name='documentFile' value=''/> <input type='submit' value='Submit'/> </g:uploadF...

How to debug grails runtime exception?

I have a grails project and a java project. The java project was a standalone set of POJO classes, and I just dumped them into src/java under my grails project. In the controller, I added an import statement for this package. Now when I do a grails run-app and try to run the program, I get a grails runtime exception. It is saying NoCla...