protected Pipeline getPipeline() { return getContainer().getPipeline(); }
_trackingHostValve = createRequestTrackingHostValve(sessionCookieName, _currentRequest); final Context context = _manager.getContext(); context.getParent().getPipeline().addValve(_trackingHostValve); _trackingContextValve = createRequestTrackingContextValve(sessionCookieName); context.getPipeline().addValve( _trackingContextValve );
public void shutdown() { _log.info( "Stopping services." ); _manager.getContext().getParent().getPipeline().removeValve(_trackingHostValve); _manager.getContext().getPipeline().removeValve(_trackingContextValve); _backupSessionService.shutdown(); if ( _lockingStrategy != null ) { _lockingStrategy.shutdown(); } if ( _storage != null ) { _storage.shutdown(); _storage = null; } _transcoderFactory = null; _invalidSessionsCache.clear(); }
private Valve findValve(Container container, int seq) { Pipeline pipeline = container.getPipeline(); if (pipeline == null) { return null; } Valve[] valves = pipeline.getValves(); if (valves == null || seq >= valves.length) { return null; } else { return valves[seq]; } }
protected Pipeline getPipeline() { return getContainer().getPipeline(); }
/** * Remove an existing Valve. * * @param name MBean Name of the component to remove * * @exception Exception if a component cannot be removed */ public void removeValve(String name) throws Exception { // Acquire a reference to the component to be removed ObjectName oname = new ObjectName(name); Container container = getParentContainerFromChild(oname); Valve[] valves = container.getPipeline().getValves(); for (int i = 0; i < valves.length; i++) { ObjectName voname = ((JmxEnabled) valves[i]).getObjectName(); if (voname.equals(oname)) { container.getPipeline().removeValve(valves[i]); } } }
/** * Remove an existing Valve. * * @param name MBean Name of the component to remove * * @exception Exception if a component cannot be removed */ public void removeValve(String name) throws Exception { // Acquire a reference to the component to be removed ObjectName oname = new ObjectName(name); Container container = getParentContainerFromChild(oname); Valve[] valves = container.getPipeline().getValves(); for (int i = 0; i < valves.length; i++) { ObjectName voname = ((JmxEnabled) valves[i]).getObjectName(); if (voname.equals(oname)) { container.getPipeline().removeValve(valves[i]); } } }
/** * Remove an existing Valve. * * @param name MBean Name of the component to remove * * @exception Exception if a component cannot be removed */ public void removeValve(String name) throws Exception { // Acquire a reference to the component to be removed ObjectName oname = new ObjectName(name); Container container = getParentContainerFromChild(oname); Valve[] valves = container.getPipeline().getValves(); for (int i = 0; i < valves.length; i++) { ObjectName voname = ((JmxEnabled) valves[i]).getObjectName(); if (voname.equals(oname)) { container.getPipeline().removeValve(valves[i]); } } }
private void searchAccessLogValves(Container container) { Pipeline pipeline = container.getPipeline(); if (pipeline == null) { return; } Valve[] valves = pipeline.getValves(); if (valves == null || valves.length == 0) { return; } for (Valve valve : valves) { if (valve instanceof AccessLogValve) { accessLogValves.add((AccessLogValve) valve); } } Container[] subContainers = container.findChildren(); if (subContainers != null && subContainers.length > 0) { for (Container subContainer : subContainers) { searchAccessLogValves(subContainer); } } }
/** * unregister all cluster valve to host or engine */ protected void unregisterClusterValve() { for (Valve v : valves) { ClusterValve valve = (ClusterValve) v; if (log.isDebugEnabled()) log.debug("Invoking removeValve on " + getContainer() + " with class=" + valve.getClass().getName()); if (valve != null) { container.getPipeline().removeValve(valve); valve.setCluster(null); } } }
/** * Adds a valve to this Container instance. * * @param valveType ClassName of the valve to be added * @return the MBean name of the new valve * @throws MBeanException if adding the valve failed */ public String addValve(String valveType) throws MBeanException{ Valve valve = (Valve) newInstance(valveType); Container container = doGetManagedResource(); container.getPipeline().addValve(valve); if (valve instanceof JmxEnabled) { return ((JmxEnabled)valve).getObjectName().toString(); } else { return null; } }
/** * register all cluster valve to host or engine */ protected void registerClusterValve() { if(container != null ) { for (Valve v : valves) { ClusterValve valve = (ClusterValve) v; if (log.isDebugEnabled()) log.debug("Invoking addValve on " + getContainer() + " with class=" + valve.getClass().getName()); if (valve != null) { container.getPipeline().addValve(valve); valve.setCluster(this); } } } }
/** * Adds a valve to this Container instance. * * @param valveType ClassName of the valve to be added * @return the MBean name of the new valve * @throws MBeanException if adding the valve failed */ public String addValve(String valveType) throws MBeanException{ Valve valve = (Valve) newInstance(valveType); Container container = doGetManagedResource(); container.getPipeline().addValve(valve); if (valve instanceof JmxEnabled) { return ((JmxEnabled)valve).getObjectName().toString(); } else { return null; } }
/** {@inheritDoc} */ @Override protected void startInternal() throws LifecycleException { // Initializes whether request attributes is enabled. if (requestAttributesEnabled == null) { requestAttributesEnabled = properties.getTomcat().getEnableRequestAttributes(); } if (requestAttributesEnabled == null) { // Deduce the value from the presence of the RemoteIpValve. requestAttributesEnabled = Stream.of(getContainer().getPipeline().getValves()) .map(Object::getClass) .anyMatch(RemoteIpValve.class::isAssignableFrom); } // Configures and starts the Logback-access context. configurator.configure(context); context.start(); super.startInternal(); }
private Set<String> getNonAsyncClassNames() { Set<String> result = new HashSet<>(); Wrapper wrapper = getWrapper(); if (!wrapper.isAsyncSupported()) { result.add(wrapper.getServletClass()); } FilterChain filterChain = getFilterChain(); if (filterChain instanceof ApplicationFilterChain) { ((ApplicationFilterChain) filterChain).findNonAsyncFilters(result); } else { result.add(sm.getString("coyoteRequest.filterAsyncSupportUnknown")); } Container c = wrapper; while (c != null) { c.getPipeline().findNonAsyncValves(result); c = c.getParent(); } return result; }
private Set<String> getNonAsyncClassNames() { Set<String> result = new HashSet<>(); Wrapper wrapper = getWrapper(); if (!wrapper.isAsyncSupported()) { result.add(wrapper.getServletClass()); } FilterChain filterChain = getFilterChain(); if (filterChain instanceof ApplicationFilterChain) { ((ApplicationFilterChain) filterChain).findNonAsyncFilters(result); } else { result.add(sm.getString("coyoteRequest.filterAsyncSupportUnknown")); } Container c = wrapper; while (c != null) { c.getPipeline().findNonAsyncValves(result); c = c.getParent(); } return result; }
public void start() throws LifecycleException { for (Valve valve : getContainer().getPipeline().getValves()) { if (valve instanceof MongoSessionTrackerValve) { trackerValve = (MongoSessionTrackerValve) valve; trackerValve.setMongoManager(this); log.info("Attached to Mongo Tracker Valve"); break; } } try { initSerializer(); } catch (ClassNotFoundException e) { log.log(Level.SEVERE, "Unable to load serializer", e); throw new LifecycleException(e); } catch (InstantiationException e) { log.log(Level.SEVERE, "Unable to load serializer", e); throw new LifecycleException(e); } catch (IllegalAccessException e) { log.log(Level.SEVERE, "Unable to load serializer", e); throw new LifecycleException(e); } log.info("Will expire sessions after " + getMaxInactiveInterval() + " seconds"); initDbConnection(); }
@Override protected synchronized void stopInternal() throws LifecycleException { setState(LifecycleState.STOPPING); log.info("Stopping"); getContext().getParent().getPipeline().removeValve(requestValve); getClient().shutdown(); super.stopInternal(); }
public void shutdown() { _log.info( "Stopping services." ); _manager.getContext().getParent().getPipeline().removeValve(_trackingHostValve); _manager.getContext().getPipeline().removeValve(_trackingContextValve); _backupSessionService.shutdown(); if ( _lockingStrategy != null ) { _lockingStrategy.shutdown(); } if ( _storage != null ) { _storage.shutdown(); _storage = null; } _transcoderFactory = null; _invalidSessionsCache.clear(); }
@Override protected synchronized void startInternal() throws LifecycleException { super.startInternal(); try { this._client = buildClient(); } catch (Throwable t) { log.fatal("Unable to load serializer", t); throw new LifecycleException(t); } this.requestValve = new RedisSessionRequestValve(this, ignorePattern); getContext().getParent().getPipeline().addValve(requestValve); this.sessionExpirationTime = getContext().getSessionTimeout(); if (this.sessionExpirationTime < 0) { log.warn("Ignoring negative session expiration time"); this.sessionExpirationTime = 0; } log.info("Will expire sessions after " + sessionExpirationTime + " minutes"); setState(LifecycleState.STARTING); }