Home » Tag Archives: Grails (page 4)

Tag Archives: Grails

Using database views in Grails

grails-logo

This post is a quick explanation on how to use database views in Grails. For an introduction I tried to summarize what database views are. However, I noticed I cannot describe it better than it is already done on Wikipedia. Therefore I will just quote the Wikipedia summary of View (SQL) here:           In database theory, ...

Read More »

Grails: Using Hibernate Filters

grails-logo

The Grails Hibernate Filters plugin makes it possible to use Hibernate Filters with GORM. Hibernate Filters provide additional restriction rules that can be applied to classes and collections. The Hibernate Filters plugin makes it possible to use this functionality with GORM inside Grails applications. Let’s look at an example to see how filters can help us. Assume we have the ...

Read More »

Automatically converting password hashes in Grails spring-security-core

grails-logo

I was looking at this Stack Overflow question about converting password hashes and realized that it’s possible and rather convenient when using the spring-security-core plugin to automate the process. To start, we’ll need a PasswordEncoder that can work with both algorithms. Here I’m assuming that you’ll be converting from SHA-256 (optionally with a salt) to bcrypt, but the general approach ...

Read More »

Grails Goodness: Generating Raw Output with Raw Codec

grails-logo

Since Grails 2.3 all ${} expression output is automatically escaped on GSPs. This is very useful, because user input is now escaped and any HTML or JavaScript in the input value is escaped and not interpreted by the browser as HTML or JavaScript. This is done so our Grails application is protected from Cross Site Scripting (XSS) attacks. But sometimes ...

Read More »

Grails Goodness: Namespace Support for Controllers

grails-logo

In a Grails application we can organize our controllers into packages, but if we use the same name for multiple controllers, placed in different packages, then Grails cannot resolve the correct controller name. Grails ignores the package name when finding a controller by name. But with namespace support since Grails 2.3 we can have controllers with the same name, but ...

Read More »

Getting Started with method security in Grails using Spring Security

grails-logo

This blog post will be about implementing method level security with security expressions in Grails using the Spring Security plugins. I assume you have some basic understanding of the Grails Spring Security Core plugin. Roles aren’t enough. When using the Spring Security Core plugin you typically start to configure which roles are required for accessing certain URLs. This configuration can ...

Read More »

Grails: Calling bean methods in Spring Security expressions

grails-logo

Some days ago while working on a Grails application I was in a situation where a wanted to call a bean method from a Spring security SPEL expression. I was using the @PreAuthorize annotation from the Spring Security ACL plugin and wanted to do something like this:               @PreAuthorize("myService.canAccessUserProfile(#profileId)") public Profile getUserProfile(long profileId) {   ... } @PreAuthorize takes ...

Read More »

Grails: Applying build information to your builds

grails-logo

Occasionally, when I buy some food I check the label to see how unhealthy it is in an effort to remind myself to eat better. I probably should do this more often but that’s another story. With software, I take a more strict approach. I like to know exactly what version of what I am using and if it pertains ...

Read More »

Grails Goodness: Accessing Resources with Resource and ResourceLocator

grails-logo

Grails uses Spring and we can piggyback on the Spring support for resource loading to find for examples files in the classpath of our application. We can use the Spring org.springframework.core.io.Resource or org.springframework.core.io.ResourceLoader interface to find resources in our application. And since Grails 2.0 we can also use the org.codehaus.groovy.grails.core.io.ResourceLocator interface. In our code we can use the grailsResourceLocator service ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close