/** * Return the ServletContext to which this session belongs. */ @Override public ServletContext getServletContext() { if (manager == null) { return null; } Context context = manager.getContext(); return context.getServletContext(); }
/** * Return the ServletContext to which this session belongs. */ @Override public ServletContext getServletContext() { if (manager == null) { return null; } Context context = manager.getContext(); return context.getServletContext(); }
/** * Return the ServletContext to which this session belongs. */ @Override public ServletContext getServletContext() { if (manager == null) return (null); Context context = manager.getContext(); if (context == null) return (null); else return (context.getServletContext()); }
private String getContext() { String name = this.manager.getContext().getName(); return name.startsWith("/") ? name : String.format("/%s", name); }
private String getObjectName() { String contextPath = getContext(); String hostName = this.manager.getContext().getParent().getName(); return String.format("Catalina:type=Store,context=%s,host=%s,name=%s", contextPath, hostName, getClass().getSimpleName()); }
@Override public String getManagerName(String name, Manager manager) { String clusterName = name ; if (clusterName == null) clusterName = manager.getContext().getName(); if (getContainer() instanceof Engine) { Context context = manager.getContext(); Container host = context.getParent(); if (host instanceof Host && clusterName != null && !(clusterName.startsWith(host.getName() +"#"))) { clusterName = host.getName() +"#" + clusterName ; } } return clusterName; }
/** * Set the JNDI name of a DataSource-factory to use for db access * * @param dataSourceName The JNDI name of the DataSource-factory */ public void setDataSourceName(String dataSourceName) { if (dataSourceName == null || "".equals(dataSourceName.trim())) { manager.getContext().getLogger().warn( sm.getString(getStoreName() + ".missingDataSourceName")); return; } this.dataSourceName = dataSourceName; }
/** * Set the JNDI name of a DataSource-factory to use for db access * * @param dataSourceName The JNDI name of the DataSource-factory */ public void setDataSourceName(String dataSourceName) { if (dataSourceName == null || "".equals(dataSourceName.trim())) { manager.getContext().getLogger().warn( sm.getString(getStoreName() + ".missingDataSourceName")); return; } this.dataSourceName = dataSourceName; }
/** * Set the JNDI name of a DataSource-factory to use for db access * * @param dataSourceName The JNDI name of the DataSource-factory */ public void setDataSourceName(String dataSourceName) { if (dataSourceName == null || "".equals(dataSourceName.trim())) { manager.getContext().getLogger().warn( sm.getString(getStoreName() + ".missingDataSourceName")); return; } this.dataSourceName = dataSourceName; }
@Override public void setManager(Manager manager) { log.trace(String.format("EXEC setId(%s);", manager)); this.manager = (RedisManager) manager; this.pool = this.manager.getPool(); this.servletContext = manager.getContext().getServletContext(); this.disableListeners = this.manager.isDisableListeners(); }
/** * 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.getContext().getLogger().isDebugEnabled()) { manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".removing", id, file.getAbsolutePath())); } if (file.exists() && !file.delete()) { throw new IOException(sm.getString("fileStore.deleteSessionFailed", file)); } }
/** * Send all changed cross context sessions to backups */ protected void sendCrossContextSession() { List<DeltaSession> sessions = crossContextSessions.get(); if(sessions != null && sessions.size() >0) { for(Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext() ;) { Session session = iter.next(); if(log.isDebugEnabled()) { log.debug(sm.getString("ReplicationValve.crossContext.sendDelta", session.getManager().getContext().getName() )); } sendMessage(session,(ClusterManager)session.getManager()); if(doStatistics()) { nrOfCrossContextSendRequests++; } } } }
/** * Register all cross context sessions inside endAccess. * Use a list with contains check, that the Portlet API can include a lot of fragments from same or * different applications with session changes. * * @param session cross context session */ public void registerReplicationSession(DeltaSession session) { List<DeltaSession> sessions = crossContextSessions.get(); if(sessions != null) { if(!sessions.contains(session)) { if(log.isDebugEnabled()) { log.debug(sm.getString("ReplicationValve.crossContext.registerSession", session.getIdInternal(), session.getManager().getContext().getName())); } sessions.add(session); } } }
public SingleSignOnSessionKey(Session session) { this.sessionId = session.getId(); Context context = session.getManager().getContext(); this.contextName = context.getName(); this.hostName = context.getParent().getName(); }
@Override public void sessionEvent(SessionEvent event) { if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType())) { return; } Session session = event.getSession(); Manager manager = session.getManager(); if (manager == null) { return; } Context context = manager.getContext(); Authenticator authenticator = context.getAuthenticator(); if (!(authenticator instanceof AuthenticatorBase)) { return; } SingleSignOn sso = ((AuthenticatorBase) authenticator).sso; if (sso == null) { return; } sso.sessionDestroyed(ssoId, session); } }
public SingleSignOnSessionKey(Session session) { this.sessionId = session.getId(); Context context = session.getManager().getContext(); this.contextName = context.getName(); this.hostName = context.getParent().getName(); }
/** * Send all changed cross context sessions to backups */ protected void sendCrossContextSession() { List<DeltaSession> sessions = crossContextSessions.get(); if(sessions != null && sessions.size() >0) { for (DeltaSession session : sessions) { if(log.isDebugEnabled()) { log.debug(sm.getString("ReplicationValve.crossContext.sendDelta", session.getManager().getContext().getName() )); } sendMessage(session,(ClusterManager)session.getManager()); if(doStatistics()) { nrOfCrossContextSendRequests++; } } } }
/** * 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().getContext().getName() )); } ((DeltaSession)session).resetDeltaRequest(); }
/** * 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().getContext().getName() )); } ((DeltaSession)session).resetDeltaRequest(); }
@Test public void initInternal() { SessionFlushValve valve = new SessionFlushValve(); StandardContext context = (StandardContext) this.manager.getContext(); context.addValve(new RemoteIpValve()); context.addValve(valve); this.store.setManager(this.manager); this.store.initInternal(); assertSame(this.store, valve.getStore()); }