《Spring实战》摘录 - 16
151
Q: #8.2.1-2 | Spring中,行为状态,指的什么?
A: 视图状态会涉及到流程应用程序的用户,而行为状态则是应用程序自身在执行任务。行为状态一般会触发Spring所管理bean的一些方法并根据方法调用的执行结果转移到另一个状态
152
Q: #8.2.1-3 | 当到达<end-state>状态,流程会结束。接下来会发生什么取决于几个因素
A:
- 如果结束的流程是一个子流程,那调用它的流程将会从
<subflow-state>
处继续执行。<end-state>
的ID将会用作事件触发从<subflow-state>
开始的转移。 - 如果
<end-state>
设置了view属性,指定的视图将会被渲染。视图可以是相对于流程路径的视图模板,如果添加externalRedirect:
前缀的话,将会重定向到流程外部的页面,如果添加flowRedirect:
将重定向到另一个流程中。 - 如果结束的流程不是子流程,也没有指定view属性,那这个流程只是会结束而已。浏览器最后将会加载流程的基本URL地址,当前已没有活动的流程,所以会开始一个新的流程实例。
153
Q: #8.2.2-1 | spring中,用on属性来指定触发转移的事件,xml如何配置
A:
视图状态,事件通常会是用户采取的动作。在行为状态,事件是评估表达式得到的结果。而在子流程状态,事件取决于子流程结束状态的ID。在任意的事件中(这里没有任何歧义),你可以使用on属性来指定触发转移的事件
<transition on="phoneEntered" to="lookupCustomer"/>
154
Q: #8.2.3-1 | Spring Web Flow的作用域
A:
- Conversation --- 最高层级的流程开始时创建,在最高层级的流程结束时销毁。被最高层级的流程和其所有的子流程所共享
- Flow --- 当流程开始时创建,在流程结束时销毁。只有在创建它的流程中是可见的
- Request --- 当一个请求进入流程时创建,在流程返回时销毁
- Flash --- 当流程开始时创建,在流程结束时销毁。在视图状态渲染后,它也会被清除
- View --- 当进入视图状态时创建,当这个状态退出时销毁。只在视图状态内是可见的
155
Q: #9.1-1 | Spring Security是什么
A:Spring Security是为基于Spring的应用程序提供声明式安全保护的安全性框架
156
Q: #9.1-1 | Spring Security从两个角度来解决安全性问题,分别是
A:
- 它使用Servlet规范中的Filter保护Web请求并限制URL级别的访问。
- Spring Security还能够使用Spring AOP保护方法调用——借助于对象代理和使用通知,能够确保只有具备适当权限的用户才能访问安全保护的方法。
157
Q: #9.1.1-1 | Spring Security被分成了11个模块
A:
- ACL --- 支持通过访问控制列表(access control list,ACL)为域对象提供安全性
- 切面(Aspects) --- 一个很小的模块,当使用Spring Security注解时,会使用基于AspectJ的切面,而不是使用标准的Spring AOP
- CAS客户端(CAS Client) --- 提供与Jasig的中心认证服务(Central Authentication Service,CAS)进行集成的功能
- 配置(Configuration) --- 包含通过XML和Java配置Spring Security的功能支持
- 核心(Core) --- 提供Spring Security基本库
- 加密(Cryptography) --- 提供了加密和密码编码的功能
- LDAP --- 支持基于LDAP进行认证
- OpenID --- 支持使用OpenID进行集中式认证
- Remoting --- 提供了对Spring Remoting的支持
- 标签库(Tag Library) --- Spring Security的JSP标签库
- Web --- 提供了Spring Security基于Filter的Web安全性支持
158
Q: #9.1.2-1 | DelegatingFilterProxy
是一个特殊的Servlet Filter
,作用是什么?
A:它本身所做的工作并不多。只是将工作委托给一个javax.servlet.Filter
实现类,这个实现类作为一个<bean>
注册在Spring应用的上下文中,如下图所示。
DelegatingFilterProxy
把Filter的处理逻辑委托给Spring应用
上下文中所定义的一个代理Filter bean
159
Q: #9.1.2-2 | AbstractSecurityWebApplicationInitializer
工作原理?
A: AbstractSecurityWebApplicationInitializer
实现了WebApplication-Initializer
,因此Spring会发现它,并用它在Web容器中注册
DelegatingFilterProxy。尽管我们可以重载它的
appendFilters()或
insertFilters()方法来注册自己选择的Filter,但是要注册
DelegatingFilterProxy`的话,我们并不需要重载任何方法。
160
Q: #9.1.3-1 | 启用Web安全性功能的最简单配置
A:
Source
Plagiarism is the copying & pasting of others work without giving credit to the original author or artist. Plagiarized posts are considered spam.
Spam is discouraged by the community, and may result in action from the cheetah bot.
More information and tips on sharing content.
If you believe this comment is in error, please contact us in #disputes on Discord
这是摘录,标题上有写呀
Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://www.cnblogs.com/forerver-elf/p/6430393.html
thanks