本文整理了Java中org.apache.catalina.Manager
类的一些代码示例,展示了Manager
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Manager
类的具体详情如下:
包路径:org.apache.catalina.Manager
类名称:Manager
[英]A Manager manages the pool of Sessions that are associated with a particular Container. Different Manager implementations may support value-added features such as the persistent storage of session data, as well as migrating sessions for distributable web applications.
In order for a Manager
implementation to successfully operate with a Context
implementation that implements reloading, it must obey the following constraints:
Lifecycle
so that the Context can indicate that a restart is required.stop()
to be followed by a call to start()
on the same Manager
instance.Manager
实现与实现重新加载的Context
实现成功运行,它必须遵守以下约束:Lifecycle
,以便上下文可以指示需要重新启动。Manager
实例上先调用stop()
,然后再调用start()
。代码示例来源:origin: redisson/redisson
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
String sessionId = request.getRequestedSessionId();
Session session = request.getContext().getManager().findSession(sessionId);
if (session != null) {
if (!session.isValid()) {
session.expire();
request.getContext().getManager().remove(session);
} else {
manager.add(session);
session.access();
session.endAccess();
}
}
try {
getNext().invoke(request, response);
} finally {
manager.store(request.getSession(false));
}
}
代码示例来源:origin: apache/geode
@Override
public void setPrincipal(Principal principal) {
super.setPrincipal(principal);
// Put the session into the region to serialize the principal
if (getManager() != null) {
// TODO convert this to a delta
getManager().add(this);
DeltaSessionManager mgr = (DeltaSessionManager) getManager();
if (mgr.getLogger().isDebugEnabled()) {
mgr.getLogger().debug(this + ": Cached principal: " + principal);
// mgr.logCurrentStack();
}
}
}
代码示例来源:origin: magro/memcached-session-manager
/**
* Set a new id for this session.<br/>
* Before setting the new id, it removes itself from the associated
* manager. After the new id is set, this session adds itself to the
* session manager.
*
* @param id
* the new session id
*/
protected void setIdForRelocate( final String id ) {
if ( this.id == null ) {
throw new IllegalStateException( "There's no session id set." );
}
if ( this.manager == null ) {
throw new IllegalStateException( "There's no manager set." );
}
/*
* and mark it as a node-failure-session, so that remove(session) does
* not try to remove it from memcached... (the session is removed and
* added when the session id is changed)
*/
setNote( MemcachedSessionService.NODE_FAILURE, Boolean.TRUE );
manager.remove( this );
removeNote( MemcachedSessionService.NODE_FAILURE );
this.id = id;
manager.add( this );
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
Context context = getManager().getContext();
Log contextLog = context.getLogger();
if (contextLog.isDebugEnabled()) {
contextLog.debug(sm.getString(getStoreName()+".loading", id, file.getAbsolutePath()));
ClassLoader oldThreadContextCL = context.bind(Globals.IS_SECURITY_ENABLED, null);
StandardSession session = (StandardSession) manager.createEmptySession();
session.readObjectData(ois);
session.setManager(manager);
return session;
} catch (FileNotFoundException e) {
if (contextLog.isDebugEnabled()) {
contextLog.debug("No persisted data file found");
context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
throws IOException {
if (log.isDebugEnabled()) {
log.debug(sm.getString("formAuthenticator.forwardLogin",
request.getRequestURI(), request.getMethod(),
config.getLoginPage(), context.getName()));
String msg = sm.getString("formAuthenticator.noLoginPage",
context.getName());
log.warn(msg);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
msg);
Session session = request.getSessionInternal(false);
if (session != null) {
Manager manager = request.getContext().getManager();
manager.changeSessionId(session);
request.changeSessionId(session.getId());
String msg = sm.getString("formAuthenticator.forwardLoginFail");
log.warn(msg, t);
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
if (session != null && session.isValid()) {
return session.getSession();
try {
localSession =
context.getManager().findSession(other.getId());
if (localSession != null && !localSession.isValid()) {
localSession = null;
context.getManager().createSession(other.getId());
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/**
* Perform the internal processing required to passivate
* this session.
*/
public void passivate() {
// Notify interested session event listeners
fireSessionEvent(Session.SESSION_PASSIVATED_EVENT, null);
// Notify ActivationListeners
HttpSessionEvent event = null;
String keys[] = keys();
for (int i = 0; i < keys.length; i++) {
Object attribute = attributes.get(keys[i]);
if (attribute instanceof HttpSessionActivationListener) {
if (event == null)
event = new HttpSessionEvent(getSession());
try {
((HttpSessionActivationListener)attribute)
.sessionWillPassivate(event);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
manager.getContainer().getLogger().error
(sm.getString("standardSession.attributeEvent"), t);
}
}
}
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina-ha
/**
* Reset DeltaRequest from session
* @param session HttpSession from current request or cross context session
*/
protected void resetDeltaRequest(Session session) {
if(log.isDebugEnabled()) {
log.debug(sm.getString("ReplicationValve.resetDeltaRequest" ,
session.getManager().getContainer().getName() ));
}
((DeltaSession)session).resetDeltaRequest();
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
Context currentContext = (Context) host.findChild(current.getName());
if (previousContext != null && currentContext != null &&
currentContext.getState().isAvailable() &&
!isServiced(previous.getName())) {
Manager manager = previousContext.getManager();
if (manager != null) {
int sessionCount;
sessionCount = ((DistributedManager) manager).getActiveSessionsFull();
} else {
sessionCount = manager.getActiveSessions();
if (log.isInfoEnabled()) {
log.info(sm.getString(
"hostConfig.undeployVersion", previous.getName()));
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
/**
* Remove the Session with the specified session identifier from
* this Store, if present. If no such Session is present, this method
* takes no action.
*
* @param id Session identifier of the Session to be removed
*
* @exception IOException if an input/output error occurs
*/
@Override
public void remove(String id) throws IOException {
File file = file(id);
if (file == null) {
return;
}
if (manager.getContainer().getLogger().isDebugEnabled()) {
manager.getContainer().getLogger().debug(sm.getString(getStoreName()+".removing",
id, file.getAbsolutePath()));
}
file.delete();
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
fireSessionEvent(Session.SESSION_CREATED_EVENT, null);
Context context = (Context) manager.getContainer();
Object listeners[] = context.getApplicationLifecycleListeners();
if (listeners != null) {
HttpSessionEvent event =
new HttpSessionEvent(getSession());
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof HttpSessionListener))
(HttpSessionListener) listeners[i];
try {
fireContainerEvent(context,
"beforeSessionCreated",
listener);
manager.getContainer().getLogger().error
(sm.getString("standardSession.sessionEvent"), t);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
private void expire(SingleSignOnSessionKey key) {
if (engine == null) {
containerLog.warn(sm.getString("singleSignOn.sessionExpire.engineNull", key));
return;
containerLog.warn(sm.getString("singleSignOn.sessionExpire.hostNotFound", key));
return;
Context context = (Context) host.findChild(key.getContextName());
if (context == null) {
containerLog.warn(sm.getString("singleSignOn.sessionExpire.contextNotFound", key));
return;
Manager manager = context.getManager();
if (manager == null) {
containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerNotFound", key));
session = manager.findSession(key.getSessionId());
} catch (IOException e) {
containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerError", key), e);
return;
session.expire();
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
cluster.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.cluster", cluster), e);
loader.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.loader", loader), e);
manager.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.manager", manager), e);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
args[1] = smClient.getString("htmlManagerServlet.title");
writer.print(MessageFormat.format
(Constants.BODY_HEADER_SECTION, args));
args[0] = smClient.getString("htmlManagerServlet.messageLabel");
if (message == null || message.length() == 0) {
args[1] = "OK";
args[0] = smClient.getString("htmlManagerServlet.manager");
args[1] = response.encodeURL(request.getContextPath() + "/html/list");
args[2] = smClient.getString("htmlManagerServlet.list");
String contextNames[] = new String[children.length];
for (int i = 0; i < children.length; i++)
contextNames[i] = children[i].getName();
String contextPath = ctxt.getPath();
String displayPath = contextPath;
if (displayPath.equals("")) {
((DistributedManager)manager).getActiveSessionsFull());
} else if (manager != null){
args[5] = Integer.valueOf(manager.getActiveSessions());
} else {
args[5] = Integer.valueOf(0);
代码示例来源:origin: codefollower/Tomcat-Research
return (null);
if (manager.getContext().getLogger().isDebugEnabled()) {
manager.getContext().getLogger().debug(sm.getString(getStoreName()+".loading",
id, file.getAbsolutePath()));
fis = new FileInputStream(file.getAbsolutePath());
bis = new BufferedInputStream(fis);
Context context = manager.getContext();
if (context != null)
loader = context.getLoader();
if (loader != null)
classLoader = loader.getClassLoader();
(StandardSession) manager.createEmptySession();
session.readObjectData(ois);
session.setManager(manager);
return (session);
} catch (FileNotFoundException e) {
if (manager.getContext().getLogger().isDebugEnabled())
manager.getContext().getLogger().debug("No persisted data file found");
return (null);
} catch (IOException e) {
代码示例来源:origin: psi-probe/psi-probe
logger.debug("Querying webapp: {}", context.getName());
app.setName(context.getName().length() > 0 ? context.getName() : "/");
app.setDocBase(context.getDocBase());
app.setDisplayName(context.getDisplayName());
logger.debug("collecting session information");
app.setSessionCount(context.getManager().findSessions().length);
long size = 0;
for (Session session : context.getManager().findSessions()) {
ApplicationSession appSession = getApplicationSession(session, calcSize, false);
if (appSession != null) {
代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha
/**
* change session id and send to all cluster nodes
*
* @param request current request
* @param sessionId
* original session id
* @param newSessionID
* new session id for node migration
* @param catalinaSession
* current session with original session id
*/
protected void changeSessionID(Request request, String sessionId,
String newSessionID, Session catalinaSession) {
fireLifecycleEvent("Before session migration", catalinaSession);
catalinaSession.getManager().changeSessionId(catalinaSession, newSessionID);
changeRequestSessionID(request, sessionId, newSessionID);
fireLifecycleEvent("After session migration", catalinaSession);
if (log.isDebugEnabled()) {
log.debug(sm.getString("jvmRoute.changeSession", sessionId,
newSessionID));
}
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
fireSessionEvent(Session.SESSION_CREATED_EVENT, null);
Context context = (Context) manager.getContainer();
Object listeners[] = context.getApplicationLifecycleListeners();
if (listeners != null) {
HttpSessionEvent event =
new HttpSessionEvent(getSession());
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof HttpSessionListener))
(HttpSessionListener) listeners[i];
try {
context.fireContainerEvent("beforeSessionCreated",
listener);
listener.sessionCreated(event);
context.fireContainerEvent("afterSessionCreated", listener);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
manager.getContainer().getLogger().error
(sm.getString("standardSession.sessionEvent"), t);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Changes the session ID of the session associated with this request.
*
* @return the old session ID before it was changed
* @see javax.servlet.http.HttpSessionIdListener
* @since Servlet 3.1
*/
@Override
public String changeSessionId() {
Session session = this.getSessionInternal(false);
if (session == null) {
throw new IllegalStateException(
sm.getString("coyoteRequest.changeSessionId"));
}
Manager manager = this.getContext().getManager();
manager.changeSessionId(session);
String newSessionId = session.getId();
this.changeSessionId(newSessionId);
return newSessionId;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
path = cn.getPath();
throw new IllegalArgumentException(smClient.getString(
"managerServlet.invalidPath",
Escape.htmlElementContent(path)));
throw new IllegalArgumentException(smClient.getString(
"managerServlet.noContext",
Escape.htmlElementContent(cn.getDisplayName())));
Manager manager = ctxt.getManager();
List<Session> sessions = new ArrayList<>();
sessions.addAll(Arrays.asList(manager.findSessions()));
if (manager instanceof DistributedManager && showProxySessions) {
sessionIds.remove(session.getId());
内容来源于网络,如有侵权,请联系作者删除!