publicstaticclassBuilder {/**
* Hold all contextual data via the Builder instance's method invocations to be sent to the
* {@code SecurityManager} during the {@link #buildSubject} call.
数据保持器,在最后调用buildSubject的时候被使用。
*/privatefinal SubjectContext subjectContext;
privatefinal SecurityManager securityManager;
/**
* Constructs a new {@link Subject.Builder} instance,
using the {@code SecurityManager} instance available
*///这里使用了管家 SubjectContext 保存数据?被// sent to the {@code SecurityManager} to create a new {@code Subject} instance.publicBuilder() {
this(SecurityUtils.getSecurityManager());
}
publicBuilder(SecurityManager securityManager) {
if (securityManager == null) {
thrownew NullPointerException("null.");
}
this.securityManager = securityManager;
this.subjectContext = newSubjectContextInstance();
if (this.subjectContext == null) {
thrownew IllegalStateException("newSubjectContextInstance' " +
"cannot be null.");
}
//这个有点意思了,保存当前管家的一个引用。this.subjectContext.setSecurityManager(securityManager);
}
/**
* Creates a new {@code SubjectContext} instance to
be used to populate with subject contextual data that
* will then be sent to the {@code SecurityManager}
to create a new {@code Subject} instance.
* @return a new {@code SubjectContext} instance
*///这个有点意思,放置在管家中去创建一个Subjectprotected SubjectContext newSubjectContextInstance() {
returnnew DefaultSubjectContext();
}
//让后代使用protected SubjectContext getSubjectContext() {
returnthis.subjectContext;
}
public Builder sessionId(Serializable sessionId) {
if (sessionId != null) {
this.subjectContext.setSessionId(sessionId);
}
returnthis;
}
public Builder host(String host) {
if (StringUtils.hasText(host)) {
this.subjectContext.setHost(host);
}
returnthis;
}
......
//这里才是真正的返回实例,这里调用了管家创建的方法//SubjectContext 创建的信息,反应到当前的信息当中去处理public Subject buildSubject() {
returnthis.securityManager.createSubject(this.subjectContext);
}
}
DefaultSubjectContext的结构又是如何的? public class DefaultSubjectContext extends MapContext implements SubjectContext DefaultSubjectContext 中的信息字段是由MapContext这个类型安全的来维护的,DefaultSubjectContext 中的所有的字段的信息都是放置在Map中的去维护的,且可以指定返回类型的安全性,如果非法,触发异常。MapContext中主要是维护DefaultSubjectContext 中定义的字段的信息。 简单介绍 DefaultSubjectContext 中的信息维护都是这样的类型
public Subject createSubject(SubjectContext subjectContext) {
//create a copy so we don't modify the argument's backing map:
SubjectContext context = copy(subjectContext);
//ensure that the context has a SecurityManager instance, and if not, add one:
context = ensureSecurityManager(context);
//Resolve an associated Session (usually based on a referenced session ID),//place it in the context before//sending to the SubjectFactory. The SubjectFactory should not need to//know how to acquire sessions as the//process is often environment specific - better to shield the SF from these details:
context = resolveSession(context);
//Similarly, the SubjectFactory should not require any concept of RememberMe - //translate that here first//if possible before handing off to the SubjectFactory:
context = resolvePrincipals(context);
//都是一些业务的逻辑,这里才是真正的创建
Subject subject = doCreateSubject(context);
//save this subject for future reference if necessary://(this is needed here in case rememberMe principals were //resolved and they need to be stored in the//session, so we don't constantly rehydrate the rememberMe //PrincipalCollection on every operation).//Added in 1.2://保存备份信息把,不用每次都这么麻烦
save(subject);
return subject;
}
Traits are a fundamental unit of code reuse in Scala. A trait encapsulates method and field definitions, which can then be reused by mixing them into classes. Unlike class inheritance, in which each c
版本:WebLogic Server 10.3
说明:%DOMAIN_HOME%:指WebLogic Server 域(Domain)目录
例如我的做测试的域的根目录 DOMAIN_HOME=D:/Weblogic/Middleware/user_projects/domains/base_domain
1.为了保证操作安全,备份%DOMAIN_HOME%/security/Defa
http://crazyjvm.iteye.com/blog/1693757 文中提到相关超时问题,但是又出现了一个问题,我把min和max都设置成了180000,但是仍然出现了以下的异常信息:
Client session timed out, have not heard from server in 154339ms for sessionid 0x13a3f7732340003
在Mysql 众多表中查找一个表名或者字段名的 SQL 语句:
方法一:SELECT table_name, column_name from information_schema.columns WHERE column_name LIKE 'Name';
方法二:SELECT column_name from information_schema.colum