grails

How do I prevent exceptions from causing a transaction rollback under Grails?

孤人 提交于 2021-02-06 08:49:58
问题 My Grails service is having an issue where a swallowed exception unrelated to a transaction is causing the transaction to rollback even when it is unrelated to the persistance of the domain object. In my service I have something along the lines of updateSomething(domainObj) { def oldFilename = domainObj.filename def newFilename = getNewFilename() domainObj.filename = newFilename domainObj.save(flush: true) try { cleanUpOldFile(oldFilename) } catch (cleanupException) { // oh well, log and

How do I install Rundeck from source (i.e., the github repo)?

自古美人都是妖i 提交于 2021-01-29 20:12:26
问题 I am trying to install Rundeck from source. I have tried three different distributions of Linux (a Debian, Red Hat, and SUSE distribution). All have had failures. I install the make command, Java and Git before proceeding. The "make" command is what fails on every distribution of Linux that I have tried. The "./gradlew build" command was no more successful either. I then run these commands: cd /tmp git clone https://github.com/rundeck/rundeck.git mv rundeck /opt/ cd /opt/rundeck make I always

Configuring Content-Security-Policy header for grails 2.5 application

你离开我真会死。 提交于 2021-01-29 09:41:05
问题 I was going through different solutions available for preventing clickjacking in a grails application. One of the solutions was using X-Frame. So, I found a grails plugin, X-Frame-Options Plugin, by mrhaki . It is serving my purpose of adding a response header X-Frame:DENY to every response. Great! I read there was a modern solution - Content-Security-Policy header. I'm unable to configure this for my Grails application. Could someone help? 回答1: The X-Frame-Options plugin is simple and

Grails: How to override generated service method?

浪子不回头ぞ 提交于 2021-01-29 06:58:45
问题 Grails novice here. I would like to override the get() and list() methods of the generated service shown here. @Service(PlayerFile) interface PlayerFileService { PlayerFile get(Serializable id) List<PlayerFile> list(Map args) Long count() void delete(Serializable id) PlayerFile save(PlayerFile playerFile) } Why? The default service/scaffolding model shows all domain objects for the PlayerFile class. I want to filter this so that only the objects belonging to the logged in user (i.e. the owner

Custom type / converter in conjunction with Hibernate's Transformers.aliasToBean

邮差的信 提交于 2021-01-28 23:40:48
问题 I'm executing a native query in Hibernate and I want to transform the result set into a List of MyDto's. When using native queries, we typically follow this pattern: String query = "SELECT first_name as firstName, birth_date as birthDate ..." def results = session.createSQLQuery(query) .setResultTransformer(Transformers.aliasToBean(MyDto.class)) .list(); The problem is we're using Joda-time for our date classes (in this case birthDate is a LocalDate). With normal Hibernate queries this is

How to autowire a service in grails (2.5.5) with multiple capital letters at front

﹥>﹥吖頭↗ 提交于 2021-01-28 20:44:00
问题 I have a domain class named ABCDCode and created a service for the this ABCDCodeService. Now I want to use this service in controllers so I wrote it like below: class TestController{ ABCDCode abcdCode def index(int id){ abcdCode.getData(id) //Here I am getting NullPOinterException } } I am suspecting something wrong with the autowiring by name. 回答1: Grails looks first two characters for beans naming. If the second character of the controller/service is capital then Grails did not convert the

Update Gradle in Grails project

六月ゝ 毕业季﹏ 提交于 2021-01-28 14:20:15
问题 I am using Grails 3.0.5 After I create a project... at root project has folder .gradle with 2.3 version... How to update that Gradle version? I tried to download Grails 3.0.9 and create a new project..but it still use Gradle 2.3 version.. I tried to download Gradle 2.6 from this link , because I am using windows... I tried to run gradlew.bat ... and recreate-app with Grails 3.0.9 version...and i still get a new project with Gradle 2.3 回答1: That's defined in gradle.properties . If you change

Update Gradle in Grails project

喜你入骨 提交于 2021-01-28 14:20:01
问题 I am using Grails 3.0.5 After I create a project... at root project has folder .gradle with 2.3 version... How to update that Gradle version? I tried to download Grails 3.0.9 and create a new project..but it still use Gradle 2.3 version.. I tried to download Gradle 2.6 from this link , because I am using windows... I tried to run gradlew.bat ... and recreate-app with Grails 3.0.9 version...and i still get a new project with Gradle 2.3 回答1: That's defined in gradle.properties . If you change

How can I replace springloaded jar in Grails installation

点点圈 提交于 2021-01-28 14:09:09
问题 My Grails 2.1.5 app throws exception java.lang.ClassCastException: java.beans.WeakIdentityMap. This seems to be a known problem, and the resolution advised on some forums is to replace springloaded jar version 1.1.1 with 1.1.2 (or to downgrade the java version, which I would rather not do) How can I do that? I tried replacing the jar in Grails installation lib directory, and I got: Error opening zip file or JAR manifest missing : C:/grails-2.1.5/lib/org.springs ource.springloaded/springloaded

Grails 2.5.4: Get all logged in users with HttpSessionListener

主宰稳场 提交于 2021-01-28 13:16:31
问题 I'm trying to get all the current user sessions using the app-info plugin but it doesn't compile in Grails 2.5.4 . Is there another way to get this information? I'm new to Grails. This link has some information including a reference to the app-info plugin but it's old and I wasn't able to get anything to compile. UPDATE I've added this custom class in src\groovy\UserSessions : package usersessions import javax.servlet.http.HttpSessionEvent import javax.servlet.http.HttpSessionListener /