Grails controller rendering method render vs respond

The respond method uses content negotiation to respond with the most appropriate content type based on the requests ‘ACCEPT’ header. Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8, application/json This way the consumer of your site can choose how they wish to be returned data. This may not be the best option if you want to force a … Read more

Inject grails application configuration into service

The grailsApplication object is available within services, allowing this: package example import com.example.ExampleApiClient; class ExampleService { def grailsApplication def relevantMethod() { def client = new ExampleApiClient( grailsApplication.config.apiCredentials.baseUrl grailsApplication.config.apiCredentials.username, grailsApplication.config.apiCredentials.password ) return client.action(); } }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)