首页 > 其他 > 详细

sshe源码分析——全局架构

时间:2015-04-03 17:08:08      阅读:138      评论:0      收藏:0      [点我收藏+]

 

Web.xml

 <!-- 需要拦截的JSP -->

    <filter>

        <filter-name>sessionFilter</filter-name>

        <filter-class>sy.util.base.SessionFilter</filter-class>

        <init-param>

            <param-name>include</param-name>

            <!-- 在securityJsp这个文件夹下面的所有JSP页面,都需要有session才能访问,可以配置多个,用英文半角逗号分割 -->

            <param-value>securityJsp</param-value>

        </init-param>

    </filter>

    <filter-mapping>

        <filter-name>sessionFilter</filter-name>

        <url-pattern>*.jsp</url-pattern>

    </filter-mapping>

sessionFilter监听的网址中如果包含Include里的部分,则需要session才能访问

效果:

技术分享 

 

技术分享 

 

 

  <!-- 用户上下线监听器 -->

    <listener>

        <listener-class>sy.util.base.OnlineListener</listener-class>

    </listener>

OnlineListener监听在线用户上线下线

效果:

技术分享 

 

技术分享 

 

在struts.xml中

<!-- session拦截器 -->

<interceptor name="sessionInterceptor" class="sy.interceptor.base.SessionInterceptor" />

<interceptor-stack name="sessionStack">

<interceptor-ref name="encodingStack"></interceptor-ref>

<interceptor-ref name="sessionInterceptor">

<!-- doNotNeedSessionAndSecurity_ 开头的和doNotNeedSession_ 开头的方法不拦截 -->

<param name="excludeMethods">doNotNeedSession_*,doNotNeedSessionAndSecurity_*</param>

</interceptor-ref>

</interceptor-stack>

sessionInterceptor拦截非jsp后缀的

效果:

技术分享 

 

技术分享 

 

<!-- 权限拦截器 -->

<interceptor name="securityInterceptor" class="sy.interceptor.base.SecurityInterceptor" />

<interceptor-stack name="securityStack">

<interceptor-ref name="sessionStack"></interceptor-ref>

<interceptor-ref name="securityInterceptor">

<!-- doNotNeedSessionAndSecurity_ 开头的和doNotNeedSecurity_ 开头的方法不拦截 -->

<param name="excludeMethods">doNotNeedSecurity_*,doNotNeedSessionAndSecurity_*</param>

</interceptor-ref>

</interceptor-stack>

</interceptors>

securityInterceptor检测权限

效果:

技术分享 

 

技术分享 

 

技术分享 

 

<global-results>

<!-- 没有session -->

<result name="noSession">/error/noSession.jsp</result>

<!-- 没有权限 -->

<result name="noSecurity">/error/noSecurity.jsp</result>

<!-- struts抛异常 -->

<result name="strutsException">/error/strutsException.jsp</result>

</global-results>

 

<global-exception-mappings>

<exception-mapping result="strutsException" exception="java.lang.Exception"></exception-mapping>

</global-exception-mappings>

 

Action结构:

技术分享 

其他Action通过继承BaseAction并传递相应Service来获得共有功能

包括统一命名的字段,以及基础的CUID,json处理等

 

Service结构:

技术分享 

其他Service通过继承BaseService来获得基础CUID

 

ServiceImpl结构:

技术分享 

BaseServiceImpl中注入了BaseDao

 

另外还有个InitServiceImpl,用来初始化

通过读取配置文件中的initDataBase.xml来写入数据库

SAX方式读取,并使用了XPath

 

页面部分,一个公共加载页,inc.jsp,包含公用功能及js库

 

登陆后的main页面是一个easyUI的layout

上面为账户相关

技术分享 

 

左边为导航菜单

技术分享 

中间为easyUI-tab,每个tab都是一个iframe

技术分享 

 

还有model部分:

技术分享 

easyui需要的格式进行了对象封装

 

http://www.cnblogs.com/gcg0036/p/4390381.html

sshe源码分析——全局架构

原文:http://www.cnblogs.com/gcg0036/p/4390381.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!