惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
月光博客
月光博客
Y
Y Combinator Blog
WordPress大学
WordPress大学
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
美团技术团队
T
Tailwind CSS Blog
小众软件
小众软件
量子位
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
有赞技术团队
有赞技术团队
P
Proofpoint News Feed
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements
The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
Vercel News
Vercel News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
爱范儿
爱范儿
V
Visual Studio Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - gcg0036

亚信仨月印象(国庆时再写) 博客搬家了! log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable. 模板引擎Crox用法大全(更新版) Apache Tomcat Maven Plugin 参数大全(Tomcat 6) Apache Tomcat Maven Plugin MyEclipse 2015 CI 12 无限试用 sshe源码分析——权限管理的后台部分 无聊的三月终于过去了 failed to initialize monitor thread 在Android项目中的测试类点击"run as JUnit test"出错 Interacting with Other Apps Saving Data Managing the Activity Lifecycle Adding the Action Bar Building Your First App The AndroidManifest.xml File handlebars简单用法 高性能跨语言模板引擎Crox
sshe源码分析——全局架构
gcg0036 · 2015-04-03 · via 博客园 - gcg0036

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才能访问

效果:

wpsCEE5.tmp 

wpsCEE6.tmp 

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

    <listener>

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

    </listener>

OnlineListener监听在线用户上线下线

效果:

wpsCEE7.tmp 

wpsCEE8.tmp 

在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后缀的

效果:

wpsCEE9.tmp 

wpsCEF9.tmp 

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

<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检测权限

效果:

wpsCEFA.tmp 

wpsCEFB.tmp 

wpsCEFC.tmp 

<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结构:

wpsCF0D.tmp 

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

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

Service结构:

wpsCF0E.tmp 

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

ServiceImpl结构:

wpsCF0F.tmp 

BaseServiceImpl中注入了BaseDao

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

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

SAX方式读取,并使用了XPath

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

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

上面为账户相关

wpsCF1F.tmp 

左边为导航菜单

wpsCF20.tmp 

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

wpsCF21.tmp 

还有model部分:

wpsCF22.tmp 

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

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