grails-2.0

Is it possible to get a List of all active Sessions?

时光怂恿深爱的人放手 提交于 2020-01-04 04:07:13
问题 When being in a Grails action I can access a HTTPSession with session . Is it also possible to get a list of all active sessions? 回答1: You can use getSessionsInfo() method of ScopesInfoService service of Application Info plugin. First install plugin(in BuildConfig) compile ":app-info:1.0.2"{ excludes 'jquery' } then make an entry in Config grails.plugins.appinfo.useContextListener = true finally inject service and use its getSessionsInfo() method def scopesInfoService ... scopesInfoService

Grails send request as JSON and parse it in controller

痴心易碎 提交于 2020-01-03 10:17:22
问题 I want to send a request as JSON and in my controller I want to parse this JSON and get the parameters I want. for example this is the request: {"param1":"val1"} I want to parse this request and get "param1" value. I used request.JSON but still I got null. Is there any other way to solve this? Thanks, 回答1: Set it in your UrlMappings like this: static mappings = { "/rest/myAction" (controller: "myController", action: "myAction", parseRequest: true) } Search for parseRequest in latest Grails

How to implement application-only authentication for twitter in Grails using scribe?

北战南征 提交于 2020-01-03 05:37:06
问题 Earlier i was using GET search/tweets of Twitter API 1.0 To get tweets according to #tags in Grails Map jsonMap = grails.converters.JSON.parse(new URL('http://search.twitter.com/search.json?q=%23' + URLEncoder.encode(tag) + '&offset=' + offset + 'result_type=mixed&lang=en&page=' + page).text) But due to change in Twitter API version 1.1 now the above call requires Authentication. I want to fetch tweets on behalf of Application(Authentication) not by user Authentication. Is this possible? I

Intelligent folder structure for grails 2.3.4 in combination with angular js

时光总嘲笑我的痴心妄想 提交于 2020-01-01 05:18:10
问题 What would be an intelligent folder structure for grails 2.3.4 in combination with angularjs without using the grails angularjs plugin? Currently I have packed everything into the webapp folder. 回答1: There are many ways to organize your directories, however, the way we are using, which I'm gonna call it Grailsy way and to some extent is consistent with Grails directory structure is as follow: web-app css js | lib | ng-app | controllers - abcController.js | directives - directives.js | filters

grails 2.0 - correct use of serverURL for production?

怎甘沉沦 提交于 2019-12-31 10:36:10
问题 Grails 2.0 changed with the way it uses grails.serverURL for development and test environments (as described in the manual). However, I've had several problems with serverURL in regard to production deployment on Tomcat. There seem to be several options for serverURL (production mode): (Added) this setting is just "smoke and mirrors", because Tomcat and Jetty have methods to control how the URL is handled for the App, down to the "App" level. Use it to specify the server (as is pointed out as

grails 2.0 - correct use of serverURL for production?

余生长醉 提交于 2019-12-31 10:36:04
问题 Grails 2.0 changed with the way it uses grails.serverURL for development and test environments (as described in the manual). However, I've had several problems with serverURL in regard to production deployment on Tomcat. There seem to be several options for serverURL (production mode): (Added) this setting is just "smoke and mirrors", because Tomcat and Jetty have methods to control how the URL is handled for the App, down to the "App" level. Use it to specify the server (as is pointed out as

grails 2.0 - correct use of serverURL for production?

余生颓废 提交于 2019-12-31 10:35:29
问题 Grails 2.0 changed with the way it uses grails.serverURL for development and test environments (as described in the manual). However, I've had several problems with serverURL in regard to production deployment on Tomcat. There seem to be several options for serverURL (production mode): (Added) this setting is just "smoke and mirrors", because Tomcat and Jetty have methods to control how the URL is handled for the App, down to the "App" level. Use it to specify the server (as is pointed out as

How can I duplicate a domain object in Grails?

自作多情 提交于 2019-12-30 18:24:20
问题 I want to make a copy of a domain object. What is the simplest way to accomplish this? I realize I could create a new record, and then iterate over each of the fields copying the data field-by-field - but I figured there must be an easier way to do this... In Rails there is a simple way to do this: #rails < 3.1 new_record = old_record.clone #rails >= 3.1 new_record = old_record.dup Is there any equivalent in Grails? 回答1: There is not. It has been requested http://jira.grails.org/browse/GRAILS

How can I duplicate a domain object in Grails?

自作多情 提交于 2019-12-30 18:22:31
问题 I want to make a copy of a domain object. What is the simplest way to accomplish this? I realize I could create a new record, and then iterate over each of the fields copying the data field-by-field - but I figured there must be an easier way to do this... In Rails there is a simple way to do this: #rails < 3.1 new_record = old_record.clone #rails >= 3.1 new_record = old_record.dup Is there any equivalent in Grails? 回答1: There is not. It has been requested http://jira.grails.org/browse/GRAILS

Grails 2.2.0 Support in Eclipse

亡梦爱人 提交于 2019-12-30 06:51:09
问题 I am trying to create a grails 2.2.0 project using eclipse-jee-juno. It gives me an error Groovy compiler level expected by the project does not match workspace compiler level. Project compiler level is: 1.8.X Workspace compiler level is 1.7.X Go to Project properties -> Groovy compiler to set the Groovy compiler level for this project. Background : I have installed grails 2.2.0 and I am able to create and run a sample project/controller by using the command line (not eclipse) 回答1: Grails 2.x