grails-2.0

Grails spring security fails to present the login page due to a redirect loop

拥有回忆 提交于 2019-11-29 16:40:44
I have upgraded my current spring security plugins to spring-security-core-2.0-RC2 spring-security-ui-1.0-RC1 PROBLEM and I noticed that my login screen no longer shows up. In Chrome it says This page has a redirect loop STEPS TO RECREATE THE PROBLEM So I have tried to create a brand new application called Test to try to isolate the problem. First, I installed the security and security-ui plugins by adding the following entries in the BuildConfig.groovy : compile ":spring-security-core:2.0-RC2" compile ":spring-security-ui:1.0-RC1" Second I ran the quick start command as follows: grails s2

Image byte [] to response.outputStream in Grails leads to “Cannot forward after response has been committed”

帅比萌擦擦* 提交于 2019-11-29 16:08:32
In my Grails controller I have an image as byte []. I want to write this byte [] directly to the response.outputStream I use the following code to do that: def getImage() { def attachment = Attachment.get(params.id) def imageByteArray = // some byte image from attachment (is a jpg image) withCacheHeaders { etag { if (imageByteArray) "${imageByteArray}".encodeAsSHA1() else "${new Date()}".encodeAsSHA1() } delegate.lastModified { if(imageByteArray) { attachment.lastUpdated ?: 0 } } generate { response.setContentType("image/jpeg") response.setHeader("Content-disposition", "filename=\"${imageName}

com.amazonaws.services.s3.model.AmazonS3Exception: Forbidden (Service: Amazon S3; Status Code: 403; Error Code: 403 Forbidden; Request ID: XXXXXXXX)

为君一笑 提交于 2019-11-29 11:07:24
From few days back i am receiving this exception when i try to push files to my S3Bucket. Ealier everything seems to work and i am sure there is no code changes from my side. com.amazonaws.services.s3.model.AmazonS3Exception: Forbidden (Service: Amazon S3; Status Code: 403; Error Code: 403 Forbidden; Request ID: XXXXXXXXXXXX), S3 Extended Request ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1077) at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:725) at com.amazonaws.http

Avoid cyclic reference inheritance in grails

不打扰是莪最后的温柔 提交于 2019-11-29 10:26:59
I have a big project written in Grails 2.3.8. Sometimes when I deploy it using my CI I got this message: Unable to complete the scan for annotations for web application [/ProjectName##1152] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1EncodableVector->org.bouncycastle.asn1.DEREncodableVector->org.bouncycastle.asn1.ASN1EncodableVector] I have already increased the Xss settings, but it's clear, but maybe I'm wrong, that there is a cyclic

Grails 2.x service injection in Groovy/src

和自甴很熟 提交于 2019-11-29 03:47:14
I'd like to inject my service in Groovy/src class. The normaln dependency injection doesn't work: ... def myService ... I'm able to use this (it works): def appCtx = ApplicationHolder.application.getMainContext() def myService = appCtx.getBean("myService"); but the ApplicationHolder is deprecated. Is there any better solution? Thanks for any suggestion Check following Grails FAQ to get access to the application context from sources in src/groovy - http://grails.org/FAQ#Q : How do I get access to the application context from sources in src/groovy? There is no ApplicationContextHolder class

How to unit or integration test use of injected messageSource for i18n in Grails 2.0 service

耗尽温柔 提交于 2019-11-29 01:35:26
I make use of a message bundle in one of my services in a Grails 2.0 project for internationalized text. The use case is an email subject that is sent via the mail plugin in an asynchronous way, so it really doesn't make sense to have this in a controller or TagLib (given the usual argument of not accessing your text or views in a service). This code works fine in my running Grails app, but I'm not sure how to test it. I tried a PluginAwareResourceBundleMessageSource in my defineBeans as that is what my running application injects, but it led to nullpointers as it appears it needs a bunch of

Grails saves datetime as UTC time, but reads it as local server time?

旧巷老猫 提交于 2019-11-28 20:35:07
问题 I have the following line in my Grails application to set the default timezone to UTC: TimeZone.setDefault(TimeZone.getTimeZone("UTC")) I have an Audit entity with a dateCreated field: class Audit { Date dateCreated String message } Then I create and save an instance of it: def audit = new Audit(message: "Testing audit message") This will save it to my database correctly as UTC time. However, when I try to read it back: audit = Audit.get(1) The timestamp is read back as local time instead. So

IntelliJ 12 Grails 2.1 Configuration - Grails SDK not configured

对着背影说爱祢 提交于 2019-11-28 20:04:23
问题 I feel like I'm missing something simple at this point. I upgraded to grails 2.1.1 from 1.3.7 while running IntelliJ 10, recently I upgraded to IntelliJ 12 and imported all settings. Somehow in the project in IntelliJ 12, I have no grails SDK. My Global Library has grails 2.1.1 defined with all the correct .jars included, however, the Tools menu is missing the "Grails" sub-menu, and attempting to run the app gives the error message that Grails SDK is not configured. If I create a new project

“Error loading plugin manager: TomcatGrailsPlugin” on Grails 2.3 Database Migration

我是研究僧i 提交于 2019-11-28 18:59:47
I use Grails 2.3 and the Grails database migration plugin (1.3.6). When I do grails dbm-update I get the following error. How can I solve this error? Error Error loading plugin manager: TomcatGrailsPlugin (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) java.lang.ClassNotFoundException: TomcatGrailsPlugin at _GrailsBootstrap_groovy$_run_closure2.doCall(_GrailsBootstrap_groovy:40) at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185) at

Implement a REST API in a Grails app

醉酒当歌 提交于 2019-11-28 14:10:06
问题 I was wondering what would be the best approach to make a Grails app offer a RESTful API (some CRUD actions mainly) that can be used by a web service, e.g. when you want to build a corresponding iOS app to your browser-based app or anything else. I thought of building a separate part in my Grails application that takes calls from www.mywebapp.com/api/someAction so that I can reuse the Service layer. How would I do the URL mapping then? Only having one big ApiController does not sound very