grails

Where to place resources in Grails project?

柔情痞子 提交于 2020-01-29 13:12:39
问题 I am wondering if there is a designated place for resource files in a Grails application? I have a csv file that gets loaded into a map (nothing major) but didn't quite know where to put it in the project. So my question is, is there a dedicated place in the project to place this file? (If so, where?) Or is it better to place it outside of the project? 回答1: If the csv is going to need updating from time to time, I'd put it external to your grails folder, and point to it from config.groovy. If

Where to place resources in Grails project?

廉价感情. 提交于 2020-01-29 13:10:18
问题 I am wondering if there is a designated place for resource files in a Grails application? I have a csv file that gets loaded into a map (nothing major) but didn't quite know where to put it in the project. So my question is, is there a dedicated place in the project to place this file? (If so, where?) Or is it better to place it outside of the project? 回答1: If the csv is going to need updating from time to time, I'd put it external to your grails folder, and point to it from config.groovy. If

Grails 3 CSRF protection

感情迁移 提交于 2020-01-28 05:25:25
问题 Is it possible to configure CSRF protection in grails3 app using spring-security plugin, I can't find anything except useToken attribute for grails form and then call withForm inside controller. But this is actually not a very flexible solution. I like approach with filter like here 回答1: For csrf protection I reused org.springframework.security.web.csrf.CsrfFilter . You need to define new bean in grails resouces.groovy (See snipet below - csrfFilter bean). You can define your own

Grails plugin for DocumentDB

偶尔善良 提交于 2020-01-26 00:45:28
问题 We are kind of POC phase where we are trying out Azure. We are using Grails, which has nice support for MongoDb as backend (using GORM), but couldn't find similar support for DocumentDd. If we choose to go with DocumentDb, our choice would be to have a layer (may be kind of DAO layer) which uses documentDb client library and interacts with DocumentDb. Or we fall back to MongoDb, as its provided Azure. Any other choices we have with Grails-DocumentDb? 回答1: You should be able to use DocumentDB

What is up to date method to set database in Grails 3?

↘锁芯ラ 提交于 2020-01-25 20:55:30
问题 How to set database in Grails 3? Manual looks obsolete here: http://grails.github.io/grails-doc/3.0.x/guide/single.html#dataSource since it gives an example of setting with grove code like follows: dataSource { pooled = true dbCreate = "update" url = "jdbc:mysql://localhost:3306/my_database" driverClassName = "com.mysql.jdbc.Driver" dialect = org.hibernate.dialect.MySQL5InnoDBDialect username = "username" password = "password" ... while I have application.yml with dataSource: pooled: true

Grails common exception handling in grails 1.1

老子叫甜甜 提交于 2020-01-25 20:38:38
问题 Some one please tell me how to handle RunTimeExceptions in grails version1.1 .I have followed the following tutorial.I could not get it working. http://blog.bruary.net/2008/03/grails-custom-exception-handling.html I have MyException which extends RunTimeException .If this particular exception comes I want show different error page.Is it possible to achieve in grails 1.1 version? 回答1: Can you provide some sample code, where some RuntimeException is thrown? It is difficult to answer your

Grails 3 error when packaging aplication- Could not resolve all dependencies for configuration ':gspCompile'

对着背影说爱祢 提交于 2020-01-25 16:20:44
问题 App Info: Grails Version: 3.1.8 Groovy Version: 2.4.6 JVM Version: 1.8.0_60 I'm running grails package to get runnable archives however I come across the following error: Could not resolve all dependencies for configuration ':gspCompile'. Could not resolve javax.servlet:javax.servlet-api:3.1.0. Required by: app:app:0.1 Could not resolve javax.servlet:javax.servlet-api:3.1.0. Could not get resource 'https://repo.grails.org/grails/core/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1

Groovy Grails Tool Suite with Subversion

青春壹個敷衍的年華 提交于 2020-01-25 11:53:10
问题 I see two options for using Groovy Grails Tool Suite (GGTS) with Subversion. A) Use the GGTS Subversion plugin....http://grails.org/plugin/svn B) Use the Eclipse Subversive plugin......http://www.eclipse.org/subversive/ I'm on a Windows 7 box and I have an existing Groovy Grails project that I need to load into a newly created and currently empty subversion repository on my CentOS 6x linux server. I've set up svn+ssh with putty/pageant and that's working. Would option A or B work better and

Grails difficultly in using Hibernate OneToMany model

假装没事ソ 提交于 2020-01-25 11:47:25
问题 In my new project I am trying to use Hibernate model class, here one user domain class having OneToMany relation userProfile like class User { //Some fields and getter setter //Problematic thing @javax.persistence.OneToMany(mappedBy = "User") private Set<UserProfile> userProfiles; //getter is like public Set<userProfile> getProfile() { // the logic } public void setProfile() { // the logic } } So when I try to access this field in grails criteria like def criteria = User.createCriteria() List

How do I implement a request timeout in grails?

南笙酒味 提交于 2020-01-25 08:03:31
问题 I'd like to be able to set a configurable (by controller/action) request timeout in grails. The objective is to handle a rare high-load failure mode in a deterministic way. For example, I know that if a given controller/action doesn't return in 30 seconds, then something is horribly wrong and I don't want to keep the user hanging. I'd like to handle this within the application logic if possible, as there might be reasonable recoveries or messaging depending upon the conditions of the event.