grails

RestClient Grails Import fails

ⅰ亾dé卋堺 提交于 2020-01-21 10:33:19
问题 I can't import the RESTClient in my grails project. The message is: Groovy:unable to resolve class groovyx.net.http.RESTClient In the BuildConfig.groovy I uncommented: mavenRepo "http://repository.codehaus.org" and added: compile ":rest-client-builder:2.0.0" I'm using grails 2.3.8 and Windows 7. Any ideas? The grails install-plugin does not work in this grails version. 回答1: The rest-client-builder plugin doesn't provide a class called groovyx.net.http.RESTClient . I think you are getting

How to write between clause for from & to dates for createCriteria in grails?

孤街醉人 提交于 2020-01-21 10:10:13
问题 I want to fetch results between 2 dates using following code. def c = TestCase.createCriteria() resultss = c.list { like("testStatus", "Dummy") and { between("testTime", date1, date2) } order('testified','desc') } Here I want to select From Date and To Date like below FROM DATE : '2014-11-07 12:14:03'(date1) TO DATE : '2015-01-09 08:14:12'(date2) I tried a lot but no luck to get it run. Can anybody please tell me how to do that? 回答1: the and there is odd; first of all and is the default

“Could not find ApplicationContext, configure Grails correctly first”

不打扰是莪最后的温柔 提交于 2020-01-21 07:43:07
问题 We have a plugin project with some domain classes and services etc. We have an application project which uses the plugin project. This is a common pattern. Integration test (which hit the DB) cant run in the plugin project, as it has no application context, so we run the integration tests in the main application project. We have a very simple integration test: /*@TestFor(Site)*/ class SiteIntegrationSpec extends IntegrationSpec { static transactional=false; def setup() { } def cleanup() { }

Grails 2.0 integration test pollution?

假如想象 提交于 2020-01-21 07:36:26
问题 So i have a small integration test that houses 5 tests in total. Running that test exclusively results in all tests passed. However running my entire test suite results in 4 test failures of the 5. I've just recently upgraded to grails-2.0 from 1.3.7 and i switched from hsqldb to h2. Has anyone any pointers in which direction i should be looking in order to fix this (test-pollution) problem? Domain model Integration test: class SeriesIntegrationTests extends GrailsUnitTestCase { Series series

How to integrate angular js into grails 2.3.4?

时光毁灭记忆、已成空白 提交于 2020-01-21 01:47:28
问题 I am running on grails 2.3.4 and though about integrating angularjs in my next application. I think the best way from the server side is to use grails REST integration in the domain and controller classes. However here I am stuck. How to get grails to communicate with angularjs?(over the index.gsp ?, If so how to integrate it?) What would be a good architecture? I really appreciate your answers!!! PS.: I know that there is a grails angular js plugin. However I do see any reason for using that

How to find a user's home directory on linux or unix?

六眼飞鱼酱① 提交于 2020-01-20 13:32:14
问题 How do I find the home directory of an arbitrary user from within Grails? On Linux it's often /home/user. However, on some OS's, like OpenSolaris for example, the path is /export/home/user. 回答1: For UNIX-Like systems you might want to execute " echo ~username " using the shell (so use Runtime.exec() to run {"/bin/sh", "-c", "echo ~username"} ). 回答2: Normally you use the statement String userHome = System.getProperty( "user.home" ); to get the home directory of the user on any platform. See

How to find a user's home directory on linux or unix?

有些话、适合烂在心里 提交于 2020-01-20 13:31:46
问题 How do I find the home directory of an arbitrary user from within Grails? On Linux it's often /home/user. However, on some OS's, like OpenSolaris for example, the path is /export/home/user. 回答1: For UNIX-Like systems you might want to execute " echo ~username " using the shell (so use Runtime.exec() to run {"/bin/sh", "-c", "echo ~username"} ). 回答2: Normally you use the statement String userHome = System.getProperty( "user.home" ); to get the home directory of the user on any platform. See

Grails logging - Is there any existing solution to be able to log the File + Line where the call actually occured?

元气小坏坏 提交于 2020-01-20 02:25:08
问题 I'm new to Grails and I'm trying to configure Log4j so it logs the exact file and line where the log call occured. No pattern works as the conversionPattern ! It seems Grails wraps the logger in a way that Log4j doesn't see the real source of the call. I'm aware of this thread, but I'm not sure how to create a custom appender. I just can't believe nobody already developed something to fix this issue! I'm open to any suggestions : Does using something else than Log4j work in Grails to get the

URLMapping to direct all request to a single controller/action

泄露秘密 提交于 2020-01-17 11:15:50
问题 I like to develop an API manager. I want, one single controller to accept all requests. How can I direct all web requests to the same controller/action, where I should decide for farther processing. I do not know how to configure the URLMappings.groovy. Possibly I could do that with filter but again I do not know. I will appreciate your support. Thanks 回答1: In URLMappings.groovy , static mappings = { "/**"(controller: "foo", action: "bar") } will direct all URLs to FooController 's bar action

Grails Indexed Properties with No Real Index

时光怂恿深爱的人放手 提交于 2020-01-17 08:02:32
问题 Grails 1.3.1 I am using a jQuery library that sends a serialized parameter map to the server and it is formatted like so.... item[]=1&item[]=2&item[]=3 In my controller, when I do println params, it comes out... [item[]: [1, 2, 3]] I can't seem to get this data out of params in my controller, however. What am I missing? 回答1: An HTTP Post sends name/value pairs up to the web server. These names are based on the names within the given HTML form controls. When duplicates exist, they're combined