grails

Grails + Google Maps API

Hello, guys. I`m trying to dynamically represent the changes of coordinates of a groovy domain object via Google Maps API. The object has fields: Double lat Double lng and a method: void flyTo(lat, lng){ Thread.start(){ while (locked){ changeCoords (this) this.save() } } and here is a JS to repopulate changes to ...

link directly to GSP

Hi, In a GSP, is it possible to create a direct link to another GSP? I know I can use: <g:createLink controller="user" action="foo"/> and in UserController define the foo action to just show the corresponding GSP class UserController { def foo = {} } But is there any way I can achieve the same result without having to create t...

share authentication between grails applications

Is it possible to share authentication between several grails application? We have an app that grown too big and it is a time to break it to several apps, but we can't figure out how to share authentication between apps. our app is grails with acegi plugin and it is deployed on tomcat server. question assumes that we do not introduce ...

Generate URL in Grails

I need to pass a correct URL to a javascript function in one of my GSPs. I don't want to just hard code it just in case the mappings for that URL ever change. I know in Rails I would use the url_for method such as: <%= url_for :controller => 'something', :action => 'edit', :id => 3 %> How would I do this in Grails? I can't seem to ...

Query the other way across a one-to-many with Criteria Builder

Lets say I have the following one-to-many relationship: Site has many Users User belongs to one Site I've setup the relationship like this class Site { static hasMany = [users:User] ... } and class User { static belongsTo = [site:Site] int number String username ... } Basically I want to update the userna...

Grails formRemote: specifying real url as parameter

I'm trying to use the Grail formRemote tag. I'm using it like so: <g:formRemote name="newRule" url="https://somesite/somescript"&gt; However, I keep getting the error: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib.deepClone() is applicable for argument typ...

How to extend/override controller actions of plugins ?

The plugin (Nimble 0.3) I am using in my grails application, includes some controllers and associated actions. I want to change (slightly) some actions behavior, and I was wondering how I can achieve that. Can I create a child controller that inherits from my plugin controller and override some of the action implementation? Or, can I c...

grails call 'refresh' error

Hi, When hot deployed grails war in tomcat and refresh page, i was getting below error : 1 Feb, 2010 7:00:51 PM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet view-servlet threw exception java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before a...

How to calculate elapsed time from now with Joda Time?

I need to calculate the time elapsed from one specific date till now and display it with the same format as StackOverflow questions, i.e.: 15s ago 2min ago 2hours ago 2days ago 25th Dec 08 Do you know how to achieve it with the Java Joda Time library? Is there a helper method out there that already implements it, or should I write the...

Can I call GORM "find" methods on an object instead of the class?

I'm trying to take advantage of the fact that groovy is more dynamic than java. I'd like to have a block of code that does TypeA type = //do something to build an object TypeA dbType = TypeA.findBySomethingAndSomething(something, somethingelse) if(dbType != null) type.id = dbType.id type.save() but that can work for multiple object...

LDAP-authentication and local roles don't work

Hi again, authentication via LDAP works like a charm, however, when I assign a role to a user and secure a page in the requestmap (like /books/show/** and ROLE_USER) this only works for local-only users, not for users authenticated via LDAP. (IS_AUTHENTICATED_FULLY works, though) How can I fix that? ...

[Grails] md5 and salt

Grails 1.1 onwards has 'encodeAsMD5' available on Strings -- is there a way to provide a salt for the function? Typical usage: ${myString.encodeAsMD5()} Another option would be to use the Apache DigestUtils class. I'm not using this to do password hashing -- instead, I'm using it for a verification mechanism to determine when a requ...

Using a grails/groovy class by reference

I'm trying to create my own CRUD controller in grails for the stuff that the scaffolding won't do. Instead of maintaining code for a controller for each domain, I'd like to have one controller that can look after any domain for the generic CRUD calls.. as the only difference is the domain class name. Using the example of domain class J...

[grails] setting cookies when render type is "contentType: text/json"

Is it possible to set cookies on response when the return render type is set as json? I can set cookies on the response object when returning with a standard render type and later on, I'm able to get it back on the subsequent request. However, if I were to set the cookies while rendering the return values as json, I can't seem to get ba...

Using Shiro to secure services in grails.

I'm using grails to build an application that functions primarily as a service framework. My question is: Can services be secured in the same fashion as controllers? uri-based example: class SecurityFilters { def filters = { all(uri: "/**") { before = { // Ignore direct views (e.g. the default main index page). ...

Using Camel 2.1 with Grails 1.2.1 - Classloading problem

I'm trying to define a Camel context in my Grails application. resource.groovy: xmlns camel: 'http://camel.apache.org/schema/spring' camel { camelContext(id:'camelContext') { } } Results in a stacktrace containing: 2010-02-03 13:24:42,209 [main] ERROR spring.GrailsRuntimeConfigurator - [RuntimeConfiguration] Unable to l...

How to print from web application to receipt printer ?

I was asked by my client to print the receipt into Epson TM U220 (http://pos.epson.com/products/TM-U220.htm) from my web application. I have no idea how to do that. is there any java applets or something else that I can use for printing ? or should i use jasper (is jasper has lib for helping to cope this problem?) (if there is flash apps...

How do I refer to an image resource from CSS in grails?

I want to refer to an image in my main stylesheet for a Grails app and I can't get it to work. My image lives in the standard location in my Grails app... project\web-app\images\outbound-blue.png In my stylesheet I want to use it as a background image for a class... .messageimg { height:17px; width:16px; background-image...

Grails g:select setting selectedIndex

How do you set the selectedIndex on a <g:select> tag with a value from the list? I have a page that allows you to add a record. the page then goes to a view containing a g:select and i want the g:select to default to that item i just inserted into the database. I tried passing the new object in the flash but i can't figure out how to ge...

[grails] Filter fired twice on ajax request

I have a filter setup to get executed for all actions and it is executed once per request unless ajax get request is sent to the server. When it's an ajax get request, the filter gets executed twice but I see the browser sending only one request to the server. Is there a way to get the filter to fire only once per request? Here's how m...