grails

What is the simplest solution to integrate 2 apps within a Tomcat server?

I'm new to this and is looking at Apache Camel, Spring Integration and even Terracotta. I'm looking at sharing of common data like user/groups/account/permission and common business data like inventory/product details/etc. Any example will be really appreciated. ...

Editing my own user page in Grails

I'm building a web application with Grails, using the Acegi/Spring Security plugin. I want to only show the 'Edit' link if the page is showing the details of the currently logged in user. For example, the logged in user with id = 44 is viewing the page 'localhost:8080/app/user/show/44' I've tried the following but it's not working. A...

How does Grails know to apply a "layout" to pages it renders?

I've been going through the book "The Definitive Guide to Rails" (Rocher/Brown) and in Chapter 04, this mysterious thing called a "layout" just appeared with no explanation. (And there's no "layout" in the index. As far as I know, it's never explained.) How does the system know to "inherit" the pages from layout/main.gsp? There's nothin...

Does Grails have a mechanism to provide an automatic, default rendering of a form based on a corresponding Domain class?

I've look around and see a few plugins that do this, but I'm surprised it's not built into the language, outside of the scaffolding. In Django, for example, you can say <form action="/contact/" method="POST"> {{ form.as_p }} <input type="submit" value="Submit" /> </form> and get a reasonable form for a model, based on the model defin...

jsecurity : how to setup permission from database ?

Hi, I'm using Jsecurity plugins on Grails and I would like to know how to setup permission for each page from the database if possible. it's like to store the following rules: /home/edit/* for Admin /home/* for Users /administrator/* for Admin /menu/* for Admin, Staff Admin etc ... at the moment, we did it in the c...

What function is meant to format/substitute {0} {1} parameters in an string in Grails/Groovy?

I'm just getting started with Groovy/Grails I noticed the error messages you get when you validate a form look like this: Property [{0}] of class [{1}] cannot be blank For example this code to dump the errors to the console s.errors.allErrors.each { println it.defaultMessage } Now, it.arguments ...

Does Google App-Engine supports flash message ?

Hi, I am using grails 1.1.1 in my application.Flash messages ,like student id created, of my application working fine in local,but when i am updating to app-engine in server flash messages are not working. I think GAE doesnt support flashmessage from er action. If there is any solution please reposnse. Thnks billion ...

How can I fix Grails error: "No domain class found for name PrivacyOptions. Please try again and enter a valid domain class name"

I'm just getting started with Groovy/Grails. I added a new domain controller to my project, and generate-controller doesn't like it. There are other indications something's wrong: If I run the app no table is actually created in the database for this. I've reduced the DomainController to one String field and no constraints, just to m...

Where is grails function called "field(n)" documented?

In some grails code I've been reading, I see a function called "field()" that seems to do the following; given an object of the form def a = [a:b, c:d, e:123] field(a) will produce the string a="b" c="d" e="123" i.e., it translates these name value pairs into a form sutiable for an html/xhtml/xml element. I've searched the grails...

Types of dynamic types in Groovy

Main question: What operators, properties, etc. can be used to determine the type of variables in Groovy? Background: I have an arbitrarily deeply-nested dictionary data structure. It is the result of calling request.JSON in a Grails controller. I would first like to verify certain keys are in the dictionary, with the appropriate types...

Should I be using the xfire plugin with Gralis or is there a better way?

I have a web service in Grails, published using the xfire plugin. It's all fine and can be connected to no problem at all. But I'd like to modify the format of the request and response. Is that possible? The example structure is: Domain class Person, has many Siblings. Each Sibling has a Child. My web serice method currently looks som...

GORM refresh() method not getting latest data from database

After saving a changed user name (using flush:true), the following expression evaluates to false: User.get(u.getId()).name == u.refresh().name The left hand side picks up the changed user name while the right hand side return the "old" value. Ideas? Refreshing the "u" reference in the next HTTP request appears to work. ...

How do I insert a record with a many-to-one foreign key with grails?

I've been stuck on this for a day now! I'm just getting started with Grails/Groovy. I have two Domain classes with a simple Many-to-one foreign key. Simplified a bit, they are "Company" class Company { String name String city String state String ticker static constraints = { name(unique:true, maxSize:40) ...

Grails filter syntax, or, How to call a Grails Filter outside Grails

Grails provides filters that run before your controllers. They're defined in classes that look like this: class SecurityFilters { def filters = { myFilter(controller:'*', action:'*') { // What are those weird colons?? print "I'm filtering!" // Code that does the filtering goes here } } } These...

Increase Xmx and Xms for grails run-app

All, We currently are having performance issues with grails. It is taking about 10 seconds to load one of our main pages. I checked and saw that our grails app was starting up with 512 memory. We currently can use up to 3.5 gigs worth of ram. I tried exporting the following: export JAVA_OPTS="-XX:MaxPermSize=1024m -Xmx1024M -server"...

Liferay portlets on Grails, strengths + weaknesses?

I'm interested in the possibility of developing Liferay portlets on Grails, using the Grails Portlets plugin. I reckon introducing a portlet framework (such as the Spring Portlet API) will make development faster and more comfortable, so being able to further add Groovy and Grails conventions to the mix sounds almost too good to be true....

grails n00b question

I just started with grails in action book. made the new app by grails create-app then the book says to have the following code in the QuoteController.groovy class QuoteController { def index = {} def home = { render= "<h1>Real programmers do not each Quiche</h1>" } } Now when I browse to page http://localhost:808...

How do I get access to domain objects from a Quartz job?

What would be the best way to go about doing this? ...

Searching for strings commonly found in code using Google

Questions: How do you search for non-alphanumeric characters when using Google? Why doesn't Google always interpret strings enclosed within double-quotes literally? What is Google's escape character e.g. how would I search for something that contains a double-quote? Backgound: I am currently learning Grails. I was reading Masterin...

Sorting a referenced list in grails

Lets say I have some simple classes for a twitter-like app: User Post A user hasMany posts, and a post belongsTo a user. Now, I'm trying to get a list of posts for a specific user in order of date. I know I can get a list of all posts (for all users) by: def posts = Post.list([sort: 'dateCreated', order: 'asc', max:10]) But to l...