grails

Security in Grails-app: Acegi or Shiro

Hi, i'm developing a Grails based web-application and i need to choose one of these two frameworks for authentication. In your opinion, what criterions favor the choice for Acegi and what criterions favor the choice for Apache Shiro? ...

Sql query for insert in grails

Hi, How to execute plain sql in grails . I need to use sql query for inserting new record in database . How can we achieve this with out using HQL and gorm relations . thanks ...

Property interception of Grails domain classes

Hello, I would like to intercept calls to properties of domain classes to implement access control. My first try was to override setProperty and getProperty. By doing this, I disabled all nice functionality of Grails domain classes, such as domainClass.properties = params and the automatic conversion of data types. The next try was...

Intercept service method calls using metaprogramming in groovy/grails

Hi, I have a several Grails services that are invoked from Flex code using Spring BlazeDS integration. I wanted to add some general debug logging using the groovy metaClass. I have the following in a bootstrap class: class MyBootStrap { def grailsApplication def init = { servletContext -> initServiceCallLogging() } def destr...

How to add grails taglib xmlns in gsp file to get autocompletion?

When i edit xml files (jsp etc) and i put xmlns at the root pointing to some tag library i get IDE autocompletion for these tags. I would like to have the same function for my custom made taglibs. I create taglibs in separate project (plugin) and i would like to import them into a separate project and hook up somehow. I dont know how ca...

Rewriting php in Grails - Totally stuck!!!

Hi, I have to re-write a few php pages in in Grails (don't ask why!). I have never done any php, so it's proving a little tricky. Basically I have a html page which has a function in it that is executed every 60 seconds, and that .js creates a new XMLHttpRequest which then does xmlHttp.open("GET", "myphpfile.php", true); I can get...

How to monitor and maintain my grails application in live/production environment?

It is the first time I have ever launched live a website (with Grails web framework under Amazon EC2 platform and Cloud Foundry) and I realized quickly that I am not ready for monitoring and maintening correctly my application in production mode (fortunately the website is accessible to a very limited number of users) . The issues I hav...

Grails and timed services

I have used a groovy service on a timer in a grails app before by setting a timertask in the resources.groovy. I need to do something similar now, but can't get my head around how to do it. Basically I need a timer task again which will go off in the background and get some data and populate my database. but I also need a countdown ...

RuntimeError handling in Grails using View-Controller-Service architecture

I have following situation (simplified, of course): MyDomain.groovy: class MyDomain { MyAnotherDomain anotherDomain // lazy loaded } MyService.groovy: class MyService { boolean transactional = true def doSomething(id) { // ... some code... } } MYController.groovy: class MyController { def myService def doAction = { ...

Adding Grails to an exsisting project

I have an existing system built in Java we currently expand that by adding JSPs and Classes but we are given a deployed project. I would like to consider adding new features with Grails but I'm wondering how I can get both parts into the same context path in Tomcat. Is there any way to make this happen? ...

Grails Log4j Issue

log4j = { appenders { appender new org.apache.log4j.DailyRollingFileAppender(name: "friendsJob", datePattern: "'.'yyyy-MM-dd", file: "C:/temp/log/friends/friendsJob.log", layout: pattern(conversionPattern: '[%d{yyyy-MM-dd hh:mm:ss.SSS}] %p %c{5} %m%n') ) appender new org.apache.log4j.DailyRollingFileAppender( name: "followerJob"...

Grails Liferay portlet not invoking action

I am trying to create a simple portlet for Liferay 5.2.2 using Grails 1.2.1 with the grails-portlets 0.7 and grails-portlets-liferay 0.2 plugins. I created and deployed a stock portlet (just updated title, description, etc...). It deploys correctly and the view renders correctly. However, when I submit the default form that is in view.g...

Hudson CI: cannot test grails-app

Hi, I've tried in each and every way to test a grails-app using hudson. I've tried testing with maven, I've tried testing with the grails plugin and I've tried testing with a shell builder it seems that building via shell is the only thing that works.. Every time I get the same error: org.hibernate.HibernateException: contains i...

"version" lock value for populating tables

Hi, I need to populate a couple of tables from a db that was created when the grails app was run. I kept the "version" column for hibernate's locking strategy, so I need to know what value is safe to put in that field when importing the data to those tables. ...

Grails Domain Class Dynamic List As A property

Let's say I have a domain class called ShopCategoryPageTab. And I have a domain class called Product. I want ShopCategoryPageTab to have a list of Products. However, this list is not static, but determined by a formula. For example, I might want to have a "products" property which would list all products with criteria X, Y Z. So this...

Inject an AntBuilder using Spring?

I have code scattered through a Service in a plugin, using AntBuilder like this: def ant = new AntBuilder() This results in code that is really hard to test I'd like to inject a prototype-scoped AntBuilder that I can replace with a mock. But, I'm pretty much a Spring newbie ... how would I do that? I tried simply putting this in /gra...

Poor debugging support for Grails web app in Eclipse

Hi, I'm an everyday C#/ASP.NET MVC/Visual Studio user and i've just started a project in JAVA/GRails/Eclipse but i'm finding it quite difficult to use Eclipse's debugging features and find them somewhat limited compared to Visual Studio's. In particular, i'm finding the following rather disappointing but i don't know if they're limitati...

How to render complex JSON with Grails 1.2 dynamically?

I would like to render a complex type, using the JSON render method in Grails, similar to the JSON output below: {"authors":[{"id":1,"name":"Author 1","books":[{"id":1,"name":"Book 1"},{"id":2,"name":"Book 2"}]},{"id":2,"name":"Author 2","books":[{"id":1,"name":"Book 1"},{"id":2,"name":"Book 2"}]}]} And I've tried doing this with the ...

Role based domain class field access in grails

Hi I am developing a grails application.In that some cases I want to control the domain class fields based on the role.So that in each call to getter setter method of domain class I want to apply some filter based on role(Logged in user's role).I am assuming that grails will create getter setter method at runtime for the domin classes.S...

Grails WAR on Tomcat "Log4J" not working at all.

I have log4j DSL correctly configured in my Config.groovy in a grails applicaiton. Running the application with grails run-app dumps perfect logging as I specified in the DSL. However after doing a grails war to generate a war file and deploying it to tomcat, logging just disappears. I can't see it working anywhere, except tomcat console...