grails

how to define logout on session expired with grails and acegi security

Hi, I'm using the Acegi security Grails plugin in my application and sometime it's look like the session expired, the session variables not available anymore like session.user , but the user is not redirect to the login page. if you know how to deal with this problem i'll be happy to get your help. Meni ...

Generating stub classes for 3rd party WS

I need to incorporate a pretty complex 3rd party web service into my Grails app. My plan was to use WSDL2Java to generate the stub classes from the wsdl, and this was the method recommended in the 3rd party's documentation (complete with examples). First i tried to use the Axis2 codegen plugin for Eclipse but eventually came up against ...

Why is Grails (in Tomcat) logging to both catalina.out and my custom file appender?

I have the following for my log4j DSL configuration in Grails 1.2: log4j = { appenders { console name: 'stdout', layout: pattern(conversionPattern: conversionPattern) environments { production { // ... some code to determine file path ... rollingFile name: 'file', file: "...

hibernate mapping file for a grails domain class conundrum

I have a legacy database table to map to with a grails app I have to use a hibernate mapping file for a grails domain class in order to get some decimal precision values correct. I tried all sorts of tricky ways to do it with straight grails constraints and it is like herding cats. And so column size and precision value do not map qui...

Grails: write BufferedImage into response

Hi. I have ImageController with resize method: def resize = { def pht = Photos.findByTypeAndPhotourl(params.type, params.photourl) if (pht != null) { BufferedImage source = ImageIO.read(new File(pht.photo)) ImageResizer imageResizer = new ImageResizer() BufferedImage result = imageResizer.resize(source, Intege...

Grails - Many-to-Many search

I have two domains declared in my app. class Posts { String title String content static hasMany = [tags:Tag] static constraints = { } } class Tag { String Name static belongsTo = Post static hasMany = [posts:Post] static constraints = { } String toString() { "Tag:${Name}" } } ...

Grails 1.2.1 with Spring 3.0.0 dependency problem under Jetty

Just moved to Grails 1.2.1 (used 1.1.1 before). Changed application.properties, ran grails upgrade, fixed BuildConfig and Bootstrap - everything works just fine from grails console. However, getting a problem when deploy packaged war under jetty 6.1.22: 1581 [main] ERROR org.springframework.web.context.ContextLoader - Context initiali...

Grails Acegi: update username

Hi, I'm using the Acegi (AKA Sprign Security) plugin in my Grails app. InSecurityConfig.groovy I have added the line userName = 'email' such that the email field is used as the username. I find that if I change the email field and save the object, e.g. user.email = '[email protected]' user.save(failOnError: true) The save com...

Displaying desired properties from search results with grails compass

Hi, I've been stumped with the problem of displaying a selected set of properties returned as a result via a Compass query in grails. I have 300 columns in my domain class and what I'd like to do is to return ONLY THOSE values I specify (around 10 - 15 properties/fields/columns). All the 300 columns have been indexed, btw. I know I ca...

Result set mapping in Grails / GORM

I want to map the result of a native SQL query to a simple bean in grails, similar to what the @SqlResultSetMapping annotation does. For example, given a query select x.foo, y.bar, z.baz from //etc... map the result to class FooBarBaz { String foo String bar String baz } Can anyone provide an example of how to do this in grai...

How to set model attribute for every action

Hi gurus earlier I use Spring MVC and annotation @ModelAttribute. @Controller public class ArticleController { @ModelAttribute("articles") public List<Testset> getArticles(){ return articleDao.all(); } @RequestMapping("/first.htm") public void first(){ } } How can made this b...

Using Google and Yahoo OpenID service in Grails ACEGI

I am using acegi-0.5.2 and was able to make myOpenID account work (had to add http://.myopenid.com/ in the database). Now, I'm wondering how to make the Google and Yahoo openid URL work. I'm using these URLs: https://www.google.com/accounts/o8/id http://yahoo.com/ Any help on how to make them work? Do i need to install this plugin? T...

security roles in grails portlets

Hi, How to include security roles in grails portlets for liferay ? After deploying war in tomcat i added manually these lines for roles liferay-portlet.xml : <role-mapper> <role-name>administrator</role-name> <role-link>Administrator</role-link> </role-mapper> portlet.xml : <security-role-ref> ...

Querying and ordering results of a database in grails using transient fields

I'm trying to display paged data out of a grails domain object. For example: I have a domain object Employee with the properties firstName and lastName which are transient, and when invoking their setter/getter methods they encrypt/decrypt the data. The data is saved in the database in encrypted binary format, thus not sortable by those ...

Where should I store a sample xml file used by a grails unit test?

I've written an xml parser, and I've written a unit test to go with it. Where should I store the actual xml file to be used by the test? Should I just store it under test/unit/whatever package the test is in? ...

Grails: How can I search through children in a hasMany relationship?

If I have a Client domain class, and that Client hasMany Courses. How do I find the course I'm looking for? For instance: class Client { String name static hasMany = [courses:Course] } class Course { String name static belongsTo = [client:Client] } def client = Client.get(1) I want to "find" or "search" within that...

Tomcat 6 configuration example for Ubuntu Linux?

I'm very new to Tomcat and I'm having some issues figuring out how to set it up. I set it up on Ubuntu Linux and started reading and trying to follow the information given on the apache website here: http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html Apparently I'm missing something. I have a WAR named MyWebapp.war and it's i...

Grails URL's with Tomcat/Apache ProxyPass

Grails tends to write out the URL for everything that uses its tags as /appName/whatever. For instance, if I use the tag: <g:javascript library="jquery"/> the resulting tag is <script src="/appName/jquery/jquery.js"></script> This causes an issue with using ProxyPass with Apache/Tomcat. All of my CSS, JS, Images and links have th...

Binding multiple objects in Grails

I have there domain classes: :: Person. (Person.ID, Name,Address) :: Designation.(Designation.ID, Title, Band) :: SalarySlip (Person.ID, Designation.ID, totalIncome, Tax etc etc.) In the update method the person controller when I assign a person a designation from a list of designation values I want to insert a new record inside Salary...

Getting the OpenID URL from a Grails Controller/Service

I'm using acegi 0.5.2 and enabled OpenID support. I would like to know how to accesss the URL (or username) returned by a provider (i.e. Google, Yahoo!). I can't find any docs about that so I traced the code of acegi and found this in GrailsOpenIdAuthenticationProvider: OpenIDAuthenticationToken response = (OpenIDAuthenticationToken) au...