Thursday, June 25, 2009

Sunday, June 7, 2009

redirect http to https with grails

use a grails filter:
class SecurityFilters {
def filters = {
https(controller: '*', action: '*') {
before = {
if (!request.secure) {
String url = request.requestURL.toString()
String prefix = "http://"
String suffix = ".dispatch"

int startIndex = prefix.size()
def endIndex = url.indexOf(suffix) - 1
def grails = url.indexOf("/grails/")

String body = url[startIndex..grails - 1] + url[grails + 7..endIndex]
String secureHttp = "https://$body"
redirect(url: secureHttp)
return false
}
}
}

Tuesday, June 2, 2009

empty subject (no subject) in email with grails mail plugin

When sending email using the grails mail plugin, the email subject always ends up empty with (no subject)

this is a known problem. see the link
http://www.nabble.com/Grails-mail-plugin-0.5-:-subject-and-body-always-empty-td20008519.html

The problem happens if you have groovyws-all-0.4.jar in your lib directory. groovyws-all.jar also has javax.mail.* classes packed in there. The fix is as simple unjaring, remove the javax.mail package and rejar it.

hope someone finds this helpful... spent a good half day researching this