public DefaultSubjectValve(Subject defaultSubject) {
this.defaultSubject = defaultSubject;
}
public void invoke(Request request, Response response) throws IOException, ServletException {
Callers oldCallers = null;
boolean setSubject = false;
if (defaultSubject != null) {
oldCallers = ContextManager.getCallers();
setSubject = oldCallers == null || oldCallers.getCurrentCaller() == null;
}
if (setSubject) {
ContextManager.setCallers(defaultSubject, defaultSubject);
try {
getNext().invoke(request, response);