1 | > grails create-plugin ShiroWebXml |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | class ShiroWebXmlPlugin { // snipped plugin details... def doWithWebDescriptor = { xml -> def filterElement = xml.'filter' def lastFilter = filterElement[filterElement.size() - 1] lastFilter + { 'filter' { 'filter-name'("ShiroFilter") 'filter-class'("org.apache.shiro.web.servlet.IniShiroFilter") 'init-param' { 'param-name'("config") 'param-value'("\n#config") } } } def filterMappingElement = xml.'filter-mapping' def lastFilterMappingElement = filterMappingElement[filterMappingElement.size() - 1] lastFilterMappingElement + { 'filter-mapping' { 'filter-name'("ShiroFilter") 'url-pattern'("/*") } } } } |
1 | grails run-app |
1 | grails package-plugin |
1 2 | cd myapp grails install-plugin /path/to/shiro-web-xml-1.0.zip |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |