使用Grails + BlazeDS + Flex開發過程
- grails 1.2.2 安裝blazeds插件
grails install-plugin blazeds
這個插件因為依賴于acegi,所以也會同時安裝acegi
- 執行安裝acegi后的命令 grails create-auth-domains,否則測試的echoservice無法使用
- 然后就可以構建自己的service
具體可以參照
http://sebastien-arbogast.com/2010/05/14/grailsblazedsflexiphone-full-stack-part-23/
1)關于權限部分:
可以直接在service的方法上使用 @Secured("ROLE_PROJECT_ADMIN") 類似,如果有service的方法加了標記,只有等用戶登錄之后,并且屬于這個role,才可以執行
2)關于用戶登錄
可以直接使用channelset的login來執行
protected function loginButton_clickHandler(event:MouseEvent):void
{
channelSet.login(username.text, password.text);
}
protected function logoutButton_clickHandler(event:MouseEvent):void
{
channelSet.logout();
}