Grails BootStrapのHttpSessionにservletContext(またはgrailsApplication)を介してアクセスできますか?ユーザーがアプリケーションにログインすると、セッションに関する情報が保存され、動的メソッドbeforeInsertで使用されました。しかし、私はセッションでそれらの情報を取得する方法を知らない。ここ
は私のブートストラップコードです:Grails BootStrapのservletContextからHttpSessionにアクセス
class BootStrap {
def grailsApplication
def init = { servletContext ->
grailsApplication.getArtefacts("Domain").each { org.codehaus.groovy.grails.commons.GrailsDomainClass gc ->
gc.metaClass.beforeInsert = {
// Do something here with information stored in session
}
gc.metaClass.beforeUpdate = {
// Do something here with information stored in session
}
}
}
def destroy = {
}
}
サーブレットコンテキストは、複数のセッションを持っているため、ノーそんなに