grails

Groovy metaprogramming

In a Service of a Grails project, I like to find, at run time, the arguments of Dynamic Methods in order to inform callers. Also, I like to call the method and if doesn't exist to return an error, I will appeciate any help. ...

How to get the IP address when a session is created ?

In my grails application, I have implemented the interface HttpSessionListener to listen for session creation as given below: class MyHttpSessionListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent event) { log.info "***************** Session created: id= ${event.getSession()?.id}" } } ...

How to execute BACKUP DATABASE query from grails ?

I want to backup HSQLDB from grails, Here's the command BACKUP DATABASE TO 'C:/BACKUP/' BLOCKING But how to do this in GORM where all seems Entity related even executeQuery ? Thank you for sharing your experience :) ...

How to make directory public on Grails?

Hi all, my Grails app generates files in a folder (e.g. "output"). How can I make that folder public, in order to expose the output files through URLs like: http://localhost:8080/MyGrailsApp/output/myOutputFile1.xml http://localhost:8080/MyGrailsApp/output/myOutputFile2.xml Cheers! ...

Groovy - Type testing?

Hello all, I'm really brand new to Groovy and I'm trying to get something done. I've written some Groovy code (which works just fine) which receives some text. This text should be an integer (between 0 and 10). It may just happen a user enters something different. In that case I want to do some specific error handling. Now I'm wonderin...

Grails Content Negotiation - handling unsupported type

Hi, We are using content negotiation in our service using the Accept header and the withFormat method....the issue we are facing is that we want to return a 406 http status if the Accept header has a type which is not supported by our service....can anybody give us some ideas on how would we go about doing this ? Thanks, VK ...

Grails integration testsuite suite

Hello All, We have a set of integration test which depend upon same set of static data. Since the amount of data is huge we dont want to set it up per test level. Is it possible to setup data at the start, run group of test and rollback the data at the end of test. What we effectively want is the rollback at test suite level rather tha...

pagenation problem

how can i use pagenation with a controller in side show page of another controller this is my code: plan controller: def show = { if (!params.max) params.max = 4 if (!params.offset) params.offset = 0 def planInstance = Plan.get(params.id) def planVoiceServiceListCount = PlanVoiceService.countByPlan(planInstance) def planVo...

How to get sources for Grails dependencies

How can I get Ivy to download the sources for dependencies from within Grails? I tried editing all the ivy.xml files I could find as per [1], but no luck. ~/.grails/1.3.4/projects/workspace-sts/integration-files/ivy.xml /c/grails-1.3.4/src/grails/ant/ivy.xml I've been reading the grails source, and can't find any way to do this. Does...

Grails filters: can't make it work !

Hi, Im trying to write a Filter for my web-app. I read [the documentation][1], and wrote this dummy filter in my grails-app/conf directory class SecurityFilters { def filters = { someFilter(controller:'*',action:'*') { write('Filtering') } } } Next thing I do is set a breakpoint on the write statem...

grails ant task, set different envrionment

Trying to create a grails ant task that has other environments besides prod for the war task. i've tried <target name="war" depends="-init-grails" description="--> Creates a WAR of a Grails application"> <grails script="War" args="grails.env=${env} ${war.filename}"/> </target> and <target name="war" depends="-init-grails" de...

Domain class iteration in grails

Hi, I have the following relationship between two domain classes: class Emp { String name hasMany = [itemsell:Item, itembuy:Item] } class Item { String name } And I need to know what items are common to both collections for a given Emp (itemsell and itembuy); how can I do such iteration? Thanks ...

Grails: Unable to get model data from controller to view

Hi, I have been using Grails for last 3 weeks (learning and working). I have been working on porting a JSP/Servlet application to Grails and it has been absolute "fun" porting the application. I have facing an issue and have been searching, reading but could not solve it yet. In the GSP page I have a textfield and search button where ...

Grails + Securing Application

Hi, Im working on a legacy grails application. I have a couple of tables like this User ( id, name,enterprise_id) Enterprise (id, name) Asset (id,description, enterprise_id) I want to validate that when a certain user wants to access an asset, it has the right enterprise_id (i.e That the user belongs to the same enterprise as the a...

Grails error executing create-app

Hi, I am using jdk1.6 and grails 1.3.4. I have set the JAVA_HOME,GRAILS_HOME and PATH variables following the instructions in the grails.org site. When I execute the create-app command I get the following error: C:\grails\grails-1.3.4>grails create-app C:\Users\Documents\Grails\helloworld Welcome to Grails 1.3.4 - http://grails.or...

required field validation in grails

Hi I am a newbie to grails and would like to know how I can set a required field validation on grails gsp or controller.for Eaxmple , if the user doest enter the user name then I should promt a message saying user name is required. Thanks sam ...

In Grails, setting tablePerHierarchy false doesn't create a foreign key relationship

We have our base class as something like package com.ids.emr.diag class Base { String foo static mapping = { tablePerHierarchy false } } and the subclass as class Sub extends Base { String bar } This does not create a foreign key relationship between the base class and the subclass. Is there anything wrong that we're do...

Grails filters: Any way of chaining filters?

Hi, is there a way to chain several filters in a grails application (as in Java filters)? Maybe something with spring? I've written a couple of filters, and would like to get them to execute serially (order is not particularly important), and I need some help on achieving this. The reason behind? I need to write about 20, 30 filters, a...

Grails- brandable application

Here's the challenge: depending on the incoming URL I want to display a specific landing page and, upon login, a specific user experience based on the identity of the user. For example, both www.abc.com and www.xyz.com point to a single Grails instance providing a common portal experience. If the user arrived via www.abc.com, I want to...

Issues going from grails 1.0.x to 1.1.2

I have a code taht I am working on that was last worked on some time ago. It was an earlier version of grails (but I am not sure which) and I had to run the grails-upgrade command for it. Now when I do grails run-app, i get the following: [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, General e...