grails

How to inherit GORM mapping from non domain class?

假如想象 提交于 2020-01-05 10:32:09
问题 Permanently I have some tables and some hibernate classes with mapping annotations. And this classes have abstract superclass with mapping annotations also. But in this superclass there is no table association mapping. All tables are identified in the subclasses. I'm trying to migrate this mapping to GORM model. But all strategies: TablePerHierarchy and TablePerSubclass not approach for my case because all tables is created and can't be changed. I created superclass in the 'src/groovy

How to deploy Grails app without context path?

笑着哭i 提交于 2020-01-05 10:26:11
问题 Not sure if I'm using the term "context path" correctly here, but currently when I run my Grails (2.3.6) app locally, it comes up at http://localhost:8080/myapp . Ultimately, I'd like it to be deployed to an actual app server at http://myapp.com . Is this possible? If not, why? If so, how? 回答1: In config.groovy, just set: grails.app.context = "/" Also, you should probably update your environments in config.groovy as well: environments { development { grails.serverURL = "http://localhost:8080"

Print username and password used in spring security authentication

不问归期 提交于 2020-01-05 10:02:33
问题 I have been having some trouble logging in when typing the credentials in the login page. For some reason, I am typing a wrong password even though I have checked the correct one in the database. So I thought of printing in the console the password that I type. How can I do that? 回答1: I wrote up an approach at http://burtbeckwith.com/blog/?p=2029 - this is a followup to this earlier post: http://burtbeckwith.com/blog/?p=2003 As I mention in the post, since this will print cleartext passwords

Grails bindData doesn't match nested objects after upgrade to 2.4.4

冷暖自知 提交于 2020-01-05 09:30:53
问题 I recently upgraded a project from 2.1.0 to Grails 2.4.4 In a variety of places we use bindData to map incoming JSON to domain objects including nested objects. This doesn't appear to work after the upgrade or the notation has changed. For example Class Book { Author author ... } Passing in JSON { "author.id" : 7 } And calling def book = new Book() bindData(book, request.JSON, [include: ['author']]) Would previously find author 7 and attach him to the example book. Now it doesn't bind

Grails XML converters - write CDATA

ぃ、小莉子 提交于 2020-01-05 09:28:12
问题 Is writing CDATA from GRAILS converters possible? I have a requirement of writing CDATA for some XML elements in a GRAILS app. After running through the grails code in debugger, it looks like the XMLStreamWriter is not accessible. Any recommendations? 回答1: there's no possibility to add cdata via xml converters. you can use StreamingMarkupBuilder: Generate CDATA inside of tag using StreamingMarkupBuilder or, have a nice uglyhack, copying '.chars' method from groovy converter definition right

Remotefunction not working

谁说我不能喝 提交于 2020-01-05 09:22:43
问题 Below is my Pgtyp.groovy (domain class): package marchmock2 class Pgtyp { Date date_hour String mv String pagetype Integer visits Integer visits_ly Integer visits_lw String time_period String platform String device String browser static mapping = { table "pgtyp" version false date_hour column: "date_hour" mv column: "mv" pagetype column: "pagetype" visits column: "visits" visits_ly column:"visits_ly" visits_lw column:"visits_lw" time_period column:"time_period" platform column:"platform"

grails config get data from context.xml

左心房为你撑大大i 提交于 2020-01-05 09:09:30
问题 im new to grails and im looking for a way to retrieve data from context.xml for the build version. my development environment config looks like this. grails { mail { host = "smtp.gmail.com" port = 25 username = "username@mail.com" password = 'password' props = ["mail.smtp.auth":"true", "mail.smtp.socketFactory.port":"25", "mail.debug":"false", "mail.smtp.from":"username@mail.com", "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory", "mail.smtp.socketFactory.fallback":"false"] }

grails config get data from context.xml

流过昼夜 提交于 2020-01-05 09:07:25
问题 im new to grails and im looking for a way to retrieve data from context.xml for the build version. my development environment config looks like this. grails { mail { host = "smtp.gmail.com" port = 25 username = "username@mail.com" password = 'password' props = ["mail.smtp.auth":"true", "mail.smtp.socketFactory.port":"25", "mail.debug":"false", "mail.smtp.from":"username@mail.com", "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory", "mail.smtp.socketFactory.fallback":"false"] }

Grails 3.1.0_M2 - Spring-Security-Core 3.0.0.M1 Error

烈酒焚心 提交于 2020-01-05 08:55:08
问题 I have created a test application with command grails create-app helloworld . Then I have added Spring-Security-Core plugin. After that, I have executed the s2-quickstart to create User and Role classes. After that, I launch the application with grails run-app and got these errors: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChainRegistrationBean': Cannot resolve reference to bean 'springSecurityFilterChain' while

Grails - functional test with Geb doesnt work with HtmlUnitDriver

别说谁变了你拦得住时间么 提交于 2020-01-05 08:36:08
问题 I have created a functional test, which works fine when driver is FireFox or Chrome. The same fails when i try to use HtmlUnit driver. The application gets started, but gets stuck while running the first test. Then i have kill the java process to stop it. Pasting the code snippet that i use to initialize the htmlunit driver driver = { def driver = new HtmlUnitDriver() driver.javascriptEnabled = true baseUrl = 'http://localhost:8585' driver } 回答1: Which version of grails are you using?