import org.apache.catalina.Authenticator;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
-import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Manager;
import org.apache.catalina.Pipeline;
import org.apache.catalina.Realm;
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.util.DateTool;
-import org.apache.catalina.util.LifecycleSupport;
+import org.apache.catalina.util.LifecycleBase;
import org.apache.tomcat.util.res.StringManager;
import org.apache.catalina.valves.ValveBase;
import org.apache.juli.logging.Log;
*/
-public abstract class AuthenticatorBase
- extends ValveBase
- implements Authenticator, Lifecycle {
+public abstract class AuthenticatorBase extends ValveBase
+ implements Authenticator {
+
private static final Log log = LogFactory.getLog(AuthenticatorBase.class);
protected boolean securePagesWithPragma = true;
/**
- * The lifecycle event support for this component.
- */
- protected LifecycleSupport lifecycle = new LifecycleSupport(this);
-
-
- /**
* A random number generator to use when generating session identifiers.
*/
protected Random random = null;
/**
- * Has this component been started?
- */
- protected boolean started = false;
-
-
- /**
* "Expires" header always set to Date(1), so generate once only
*/
private static final String DATE_ONE =
}
- // ------------------------------------------------------ Lifecycle Methods
-
-
/**
- * Add a lifecycle event listener to this component.
- *
- * @param listener The listener to add
- */
- public void addLifecycleListener(LifecycleListener listener) {
-
- lifecycle.addLifecycleListener(listener);
-
- }
-
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
-
- return lifecycle.findLifecycleListeners();
-
- }
-
-
- /**
- * Remove a lifecycle event listener from this component.
- *
- * @param listener The listener to remove
- */
- public void removeLifecycleListener(LifecycleListener listener) {
-
- lifecycle.removeLifecycleListener(listener);
-
- }
-
-
- /**
- * Prepare for the beginning of active use of the public methods of this
- * component. This method should be called after <code>configure()</code>,
- * and before any of the public methods of the component are utilized.
+ * Start this component and implement the requirements
+ * of {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
- public void start() throws LifecycleException {
-
- // Validate and update our current component state
- if (started)
- throw new LifecycleException
- (sm.getString("authenticator.alreadyStarted"));
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- started = true;
-
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
+
// Look up the SingleSignOn implementation in our request processing
// path, if there is one
Container parent = context.getParent();
log.debug("No SingleSignOn Valve is present");
}
+ super.startInternal();
}
/**
- * Gracefully terminate the active use of the public methods of this
- * component. This method should be the last one called on a given
- * instance of this component.
+ * Stop this component and implement the requirements
+ * of {@link LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
- * that needs to be reported
+ * that prevents this component from being used
*/
- public void stop() throws LifecycleException {
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
- // Validate and update our current component state
- if (!started)
- throw new LifecycleException
- (sm.getString("authenticator.notStarted"));
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- started = false;
+ super.stopInternal();
sso = null;
-
}
-
-
}
# See the License for the specific language governing permissions and
# limitations under the License.
-authenticator.alreadyStarted=Security Interceptor has already been started
authenticator.certificates=No client certificate chain in this request
authenticator.forbidden=Access to the requested resource has been denied
authenticator.formlogin=Invalid direct reference to form login page
authenticator.manager=Exception initializing trust managers
authenticator.notAuthenticated=Configuration error: Cannot perform access control without an authenticated principal
authenticator.notContext=Configuration error: Must be attached to a Context
-authenticator.notStarted=Security Interceptor has not yet been started
authenticator.requestBodyTooBig=The request body was too large to be cached during the authentication process
authenticator.sessionExpired=The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser
authenticator.unauthorized=Cannot authenticate with the provided credentials
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-authenticator.alreadyStarted = El interceptor de seguridad ya ha sido arrancado
+
authenticator.certificates = No hay cadena de certificados del cliente en esta petici\u00F3n
authenticator.forbidden = El acceso al recurso pedido ha sido denegado
authenticator.formlogin = Referencia directa al formulario de conexi\u00F3n (p\u00E1gina de formulario de login) inv\u00E1lida
authenticator.manager = Excepci\u00F3n inicializando administradores de confianza
authenticator.notAuthenticated = Error de Configuraci\u00F3n\: No se pueden realizar funciones de control de acceso sin un principal autenticado
authenticator.notContext = Error de Configuraci\u00F3n\: Debe de estar unido a un Contexto
-authenticator.notStarted = El Interceptor de seguridad no sido a\u00FAn iniciado
authenticator.requestBodyTooBig = El cuerpo del requerimiento era demasiado grande para realizar cach\u00E9 durante el proceso de autenticaci\u00F3n
authenticator.sessionExpired = El tiempo permitido para realizar login ha sido excedido. Si deseas continuar, debes hacer clik dos veces y volver a hacer clik otra vez o cerrar y reabrir tu navegador
authenticator.unauthorized = Imposible autenticar mediante las credenciales suministradas
# See the License for the specific language governing permissions and
# limitations under the License.
-authenticator.alreadyStarted=L''intercepteur de s\u00e9curit\u00e9 (security interceptor) a d\u00e9j\u00e0 \u00e9t\u00e9 d\u00e9marr\u00e9
authenticator.certificates=Aucune cha\u00eene de certificat client (client certificate chain) dans cette requ\u00eate
authenticator.forbidden=L''acc\u00e8s \u00e0 la ressource demand\u00e9e a \u00e9t\u00e9 interdit
authenticator.formlogin=R\u00e9f\u00e9rence directe \u00e0 la form de connexion (form login page) invalide
authenticator.manager=Exception lors de l''initialisation des gestionnaires d''authentification (trust managers)
authenticator.notAuthenticated=Erreur de configuration: Impossible de proc\u00e9der \u00e0 un contr\u00f4le d''acc\u00e8s sans un principal authentifi\u00e9 (authenticated principal)
authenticator.notContext=Erreur de configuration: Doit \u00eatre attach\u00e9 \u00e0 un contexte
-authenticator.notStarted=L''intercepteur de s\u00e9curit\u00e9 (security interceptor) n''a pas encore \u00e9t\u00e9 d\u00e9marr\u00e9
authenticator.unauthorized=Impossible d''authentifier avec les cr\u00e9dits fournis (provided credentials)
authenticator.userDataConstraint=Cette requ\u00eate viole une contrainte donn\u00e9e utilisateur (user data constraint) pour cette application
# See the License for the specific language governing permissions and
# limitations under the License.
-authenticator.alreadyStarted=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u306f\u65e2\u306b\u8d77\u52d5\u3055\u308c\u3066\u3044\u307e\u3059
authenticator.certificates=\u3053\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u306f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u8a8d\u8a3c\u30c1\u30a7\u30fc\u30f3\u304c\u3042\u308a\u307e\u305b\u3093
authenticator.forbidden=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u30ea\u30bd\u30fc\u30b9\u3078\u306e\u30a2\u30af\u30bb\u30b9\u304c\u62d2\u5426\u3055\u308c\u307e\u3057\u305f
authenticator.formlogin=\u30d5\u30a9\u30fc\u30e0\u30ed\u30b0\u30a4\u30f3\u30da\u30fc\u30b8\u3078\u306e\u7121\u52b9\u306a\u76f4\u63a5\u53c2\u7167\u3067\u3059
authenticator.manager=\u30c8\u30e9\u30b9\u30c8\u30de\u30cd\u30fc\u30b8\u30e3\u3092\u521d\u671f\u5316\u4e2d\u306e\u4f8b\u5916\u3067\u3059
authenticator.notAuthenticated=\u8a2d\u5b9a\u30a8\u30e9\u30fc: \u8a8d\u8a3c\u3055\u308c\u305f\u4e3b\u4f53\u306a\u3057\u306b\u30a2\u30af\u30bb\u30b9\u5236\u5fa1\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093
authenticator.notContext=\u8a2d\u5b9a\u30a8\u30e9\u30fc: \u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306b\u6307\u5b9a\u3057\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093
-authenticator.notStarted=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u306f\u307e\u3060\u8d77\u52d5\u3055\u308c\u3066\u3044\u307e\u305b\u3093
authenticator.sessionExpired=\u30ed\u30b0\u30a4\u30f3\u30d7\u30ed\u30bb\u30b9\u306b\u8a8d\u3081\u3089\u308c\u3066\u3044\u305f\u6642\u9593\u304c\u904e\u304e\u307e\u3057\u305f\u3002\u7d99\u7d9a\u3057\u305f\u3044\u306a\u3089\u3070\uff0c\u30d0\u30c3\u30af\u30dc\u30bf\u30f3\u30922\u5ea6\u62bc\u3057\u3066\u304b\u3089\u518d\u5ea6\u30ea\u30f3\u30af\u3092\u62bc\u3059\u304b\uff0c\u30d6\u30e9\u30a6\u30b6\u3092\u7acb\u3061\u4e0a\u3052\u76f4\u3057\u3066\u304f\u3060\u3055\u3044
authenticator.unauthorized=\u7528\u610f\u3055\u308c\u305f\u8a3c\u660e\u66f8\u3067\u8a8d\u8a3c\u3067\u304d\u307e\u305b\u3093
authenticator.userDataConstraint=\u3053\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306f\u3001\u3053\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30e6\u30fc\u30b6\u30c7\u30fc\u30bf\u306e\u5236\u9650\u306b\u9055\u53cd\u3057\u3066\u3044\u307e\u3059
import org.apache.coyote.ActionCode;
import org.apache.catalina.Globals;
-import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Request;
import org.apache.catalina.deploy.LoginConfig;
return (true);
}
-
-
- // ------------------------------------------------------ Lifecycle Methods
-
-
- /**
- * Initialize the database we will be using for client verification
- * and certificate validation (if any).
- *
- * @exception LifecycleException if this component detects a fatal error
- * that prevents this component from being used
- */
- @Override
- public void start() throws LifecycleException {
-
- super.start();
-
- }
-
-
- /**
- * Finalize the database we used for client verification and
- * certificate validation (if any).
- *
- * @exception LifecycleException if this component detects a fatal error
- * that prevents this component from being used
- */
- @Override
- public void stop() throws LifecycleException {
-
- super.stop();
-
- }
-
-
}
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
-import org.apache.catalina.Lifecycle;
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Realm;
import org.apache.catalina.Session;
import org.apache.catalina.SessionEvent;
import org.apache.catalina.SessionListener;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
-import org.apache.catalina.util.LifecycleSupport;
import org.apache.tomcat.util.res.StringManager;
import org.apache.catalina.valves.ValveBase;
* @version $Revision$ $Date$
*/
-public class SingleSignOn
- extends ValveBase
- implements Lifecycle, SessionListener {
+public class SingleSignOn extends ValveBase implements SessionListener {
//------------------------------------------------------ Constructor
public SingleSignOn() {
/**
- * The lifecycle event support for this component.
- */
- protected LifecycleSupport lifecycle = new LifecycleSupport(this);
-
- /**
* Indicates whether this valve should require a downstream Authenticator to
* reauthenticate each request, or if it itself can bind a UserPrincipal
* and AuthType object to the request.
/**
- * Component started flag.
- */
- protected boolean started = false;
-
- /**
* Optional SSO cookie domain.
*/
private String cookieDomain;
}
- // ------------------------------------------------------ Lifecycle Methods
-
-
- /**
- * Add a lifecycle event listener to this component.
- *
- * @param listener The listener to add
- */
- public void addLifecycleListener(LifecycleListener listener) {
-
- lifecycle.addLifecycleListener(listener);
-
- }
-
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
-
- return lifecycle.findLifecycleListeners();
-
- }
-
-
- /**
- * Remove a lifecycle event listener from this component.
- *
- * @param listener The listener to remove
- */
- public void removeLifecycleListener(LifecycleListener listener) {
-
- lifecycle.removeLifecycleListener(listener);
-
- }
-
-
- /**
- * Prepare for the beginning of active use of the public methods of this
- * component. This method should be called after <code>configure()</code>,
- * and before any of the public methods of the component are utilized.
- *
- * @exception LifecycleException if this component detects a fatal error
- * that prevents this component from being used
- */
- public void start() throws LifecycleException {
-
- // Validate and update our current component state
- if (started)
- throw new LifecycleException
- (sm.getString("authenticator.alreadyStarted"));
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- started = true;
-
- }
-
-
- /**
- * Gracefully terminate the active use of the public methods of this
- * component. This method should be the last one called on a given
- * instance of this component.
- *
- * @exception LifecycleException if this component detects a fatal error
- * that needs to be reported
- */
- public void stop() throws LifecycleException {
-
- // Validate and update our current component state
- if (!started)
- throw new LifecycleException
- (sm.getString("authenticator.notStarted"));
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- started = false;
-
- }
-
-
// ------------------------------------------------ SessionListener Methods
}
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Return a String rendering of this object.
- */
- @Override
- public String toString() {
-
- StringBuilder sb = new StringBuilder("SingleSignOn[");
- if (container == null )
- sb.append("Container is null");
- else
- sb.append(container.getName());
- sb.append("]");
- return (sb.toString());
-
- }
-
-
// ------------------------------------------------------ Protected Methods
import org.apache.catalina.authenticator.SingleSignOn;
import org.apache.catalina.ha.CatalinaCluster;
import org.apache.catalina.ha.ClusterManager;
+import org.apache.catalina.util.LifecycleBase;
/**
- * Prepare for the beginning of active use of the public methods of this
- * component. This method should be called after <code>configure()</code>,
- * and before any of the public methods of the component are utilized.
+ * Start this component and implement the requirements
+ * of {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
- public void start() throws LifecycleException {
-
- super.start();
-
- clusterSSOListener = new ClusterSingleSignOnListener();
- clusterSSOListener.setClusterSSO(this);
+ protected synchronized void startInternal() throws LifecycleException {
+
+ clusterSSOListener = new ClusterSingleSignOnListener();
+ clusterSSOListener.setClusterSSO(this);
// Load the cluster component, if any
try {
}
}
if (cluster == null) {
- throw new LifecycleException
- ("There is no Cluster for ClusterSingleSignOn");
+ throw new LifecycleException(
+ "There is no Cluster for ClusterSingleSignOn");
}
-
} catch (Throwable t) {
- throw new LifecycleException
- ("ClusterSingleSignOn exception during clusterLoad " + t);
+ throw new LifecycleException(
+ "ClusterSingleSignOn exception during clusterLoad " + t);
}
+ super.startInternal();
}
/**
- * Gracefully terminate the active use of the public methods of this
- * component. This method should be the last one called on a given
- * instance of this component.
+ * Stop this component and implement the requirements
+ * of {@link LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
- * that needs to be reported
- */
- @Override
- public void stop() throws LifecycleException {
-
- super.stop();
-
- if (getCluster() != null) {
- getCluster().removeClusterListener(clusterSSOListener);
- }
-
- }
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Return a String rendering of this object.
+ * that prevents this component from being used
*/
@Override
- public String toString() {
+ protected synchronized void stopInternal() throws LifecycleException {
- StringBuilder sb = new StringBuilder("ClusterSingleSignOn[");
- if (container == null )
- sb.append("Container is null");
- else
- sb.append(container.getName());
- sb.append("]");
- return (sb.toString());
+ super.stopInternal();
+ if (getCluster() != null) {
+ getCluster().removeClusterListener(clusterSSOListener);
+ }
}
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
-import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Manager;
import org.apache.catalina.Session;
import org.apache.catalina.ha.CatalinaCluster;
import org.apache.catalina.connector.Response;
import org.apache.catalina.session.ManagerBase;
import org.apache.catalina.session.PersistentManager;
-import org.apache.catalina.util.LifecycleSupport;
+import org.apache.catalina.util.LifecycleBase;
import org.apache.tomcat.util.res.StringManager;
import org.apache.catalina.valves.ValveBase;
* @author Peter Rossbach
* @version $Revision$ $Date$
*/
-public class JvmRouteBinderValve extends ValveBase implements ClusterValve, Lifecycle {
+public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
/*--Static Variables----------------------------------------*/
public static final org.apache.juli.logging.Log log = org.apache.juli.logging.LogFactory
protected static final StringManager sm = StringManager.getManager(Constants.Package);
/**
- * Has this component been started yet?
- */
- protected boolean started = false;
-
- /**
* enabled this component
*/
protected boolean enabled = true;
protected String sessionIdAttribute = "org.apache.catalina.ha.session.JvmRouteOrignalSessionID";
- /**
- * The lifecycle event support for this component.
- */
- protected LifecycleSupport lifecycle = new LifecycleSupport(this);
/*--Logic---------------------------------------------------*/
*/
protected void changeSessionID(Request request, String sessionId,
String newSessionID, Session catalinaSession) {
- lifecycle.fireLifecycleEvent("Before session migration",
- catalinaSession);
+ fireLifecycleEvent("Before session migration", catalinaSession);
// FIXME: setId trigger session Listener, but only chance to register manager with correct id!
catalinaSession.setId(newSessionID);
// FIXME: Why we remove change data from other running request?
sendSessionIDClusterBackup(manager,request,sessionId, newSessionID);
}
- lifecycle.fireLifecycleEvent("After session migration", catalinaSession);
+ fireLifecycleEvent("After session migration", catalinaSession);
if (log.isDebugEnabled()) {
log.debug(sm.getString("jvmRoute.changeSession", sessionId,
newSessionID));
cluster.send(msg);
}
- // ------------------------------------------------------ Lifecycle Methods
-
- /**
- * Add a lifecycle event listener to this component.
- *
- * @param listener
- * The listener to add
- */
- public void addLifecycleListener(LifecycleListener listener) {
-
- lifecycle.addLifecycleListener(listener);
-
- }
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
-
- return lifecycle.findLifecycleListeners();
-
- }
-
/**
- * Remove a lifecycle event listener from this component.
- *
- * @param listener
- * The listener to add
+ * Start this component and implement the requirements
+ * of {@link LifecycleBase#startInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
*/
- public void removeLifecycleListener(LifecycleListener listener) {
-
- lifecycle.removeLifecycleListener(listener);
-
- }
-
- /**
- * Prepare for the beginning of active use of the public methods of this
- * component. This method should be called after <code>configure()</code>,
- * and before any of the public methods of the component are utilized.
- *
- * @exception LifecycleException
- * if this component detects a fatal error that prevents this
- * component from being used
- */
- public void start() throws LifecycleException {
-
- // Validate and update our current component state
- if (started)
- throw new LifecycleException(sm
- .getString("jvmRoute.valve.alreadyStarted"));
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- started = true;
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
+
if (cluster == null) {
Container hostContainer = getContainer();
// compatibility with JvmRouteBinderValve version 1.1
log.info(sm.getString("jvmRoute.noCluster"));
}
+ super.startInternal();
}
+
/**
- * Gracefully terminate the active use of the public methods of this
- * component. This method should be the last one called on a given instance
- * of this component.
- *
- * @exception LifecycleException
- * if this component detects a fatal error that needs to be
- * reported
+ * Stop this component and implement the requirements
+ * of {@link LifecycleBase#stopInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
*/
- public void stop() throws LifecycleException {
-
- // Validate and update our current component state
- if (!started)
- throw new LifecycleException(sm
- .getString("jvmRoute.valve.notStarted"));
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- started = false;
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
+
+ super.stopInternal();
+
cluster = null;
numberOfSessions = 0;
if (log.isInfoEnabled())
jvmRoute.run.already=jvmRoute SessionID receiver run already
jvmRoute.skipURLSessionIDs=Skip reassign jvm route check, sessionid comes from URL!
jvmRoute.turnoverInfo=Turnover Check time {0} msec
-jvmRoute.valve.alreadyStarted=jvmRoute backup sessionID correction is started
-jvmRoute.valve.notStarted=jvmRoute backup sessionID correction run already
jvmRoute.valve.started=JvmRouteBinderValve started
jvmRoute.valve.stopped=JvmRouteBinderValve stopped
jvmRoute.set.orignalsessionid=Set Orginal Session id at request attriute {0} value: {1}
jvmRoute.run.already = receptor jvmRoute SessionID ya ejecutado
jvmRoute.skipURLSessionIDs = \u00A1Saltado chequeo de reasignaci\u00F3n de ruta jvm, la sessionid viene desde URL\!
jvmRoute.turnoverInfo = Ajustado tiempo de Chequeo a {0} mseg
-jvmRoute.valve.alreadyStarted = se ha iniciado la correcci\u00F3n de respaldo de sessionID de jvmRoute
-jvmRoute.valve.notStarted = ya se ha iniciado la correcci\u00F3n de respaldo de sessionID de jvmRoute
jvmRoute.valve.started = JvmRouteBinderValve arrancada
jvmRoute.valve.stopped = JvmRouteBinderValve parada
jvmRoute.set.orignalsessionid = Puesta id Orginal de Sesi\u00F3n en atributo de requerimiento {0} valor\: {1}
nrOfCrossContextSendRequests = 0;
}
- /**
- * Return a String rendering of this object.
- */
- @Override
- public String toString() {
-
- StringBuilder sb = new StringBuilder("ReplicationValve[");
- if (container != null)
- sb.append(container.getName());
- sb.append("]");
- return (sb.toString());
-
- }
// --------------------------------------------------------- Protected Methods
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpSession;
-import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
-import org.apache.catalina.util.LifecycleSupport;
+import org.apache.catalina.util.LifecycleBase;
import org.apache.tomcat.util.res.StringManager;
import org.apache.coyote.RequestInfo;
import org.apache.juli.logging.Log;
* @version $Revision$ $Date$
*/
-public class AccessLogValve
- extends ValveBase
- implements Lifecycle {
+public class AccessLogValve extends ValveBase {
private static final Log log = LogFactory.getLog(AccessLogValve.class);
/**
- * The lifecycle event support for this component.
- */
- protected LifecycleSupport lifecycle = new LifecycleSupport(this);
-
-
- /**
* The set of month abbreviations for log messages.
*/
protected static final String months[] =
/**
- * Has this component been started yet?
- */
- protected boolean started = false;
-
-
- /**
* The suffix that is added to log file filenames.
*/
protected String suffix = "";
*/
@Override
public void backgroundProcess() {
- if (started && getEnabled() && writer != null && buffered) {
+ if (getState().isAvailable() && getEnabled() && writer != null &&
+ buffered) {
writer.flush();
}
}
public void invoke(Request request, Response response) throws IOException,
ServletException {
- if (started && getEnabled()) {
+ if (getState().isAvailable() && getEnabled()) {
// Pass this request on to the next valve in our pipeline
long t1 = System.currentTimeMillis();
}
- // ------------------------------------------------------ Lifecycle Methods
-
-
/**
- * Add a lifecycle event listener to this component.
- *
- * @param listener The listener to add
- */
- public void addLifecycleListener(LifecycleListener listener) {
- lifecycle.addLifecycleListener(listener);
- }
-
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
- return lifecycle.findLifecycleListeners();
- }
-
-
- /**
- * Remove a lifecycle event listener from this component.
- *
- * @param listener The listener to add
- */
- public void removeLifecycleListener(LifecycleListener listener) {
- lifecycle.removeLifecycleListener(listener);
- }
-
-
- /**
- * Prepare for the beginning of active use of the public methods of this
- * component. This method should be called after <code>configure()</code>,
- * and before any of the public methods of the component are utilized.
+ * Start this component and implement the requirements
+ * of {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
- public void start() throws LifecycleException {
-
- // Validate and update our current component state
- if (started)
- throw new LifecycleException(sm
- .getString("accessLogValve.alreadyStarted"));
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- started = true;
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
// Initialize the timeZone, Date formatters, and currentDate
timezone = TimeZone.getDefault();
fileDateFormatter.setTimeZone(timezone);
dateStamp = fileDateFormatter.format(currentDateStruct.get().currentDate);
open();
+
+ setState(LifecycleState.STARTING);
}
/**
- * Gracefully terminate the active use of the public methods of this
- * component. This method should be the last one called on a given
- * instance of this component.
+ * Stop this component and implement the requirements
+ * of {@link LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
- * that needs to be reported
+ * that prevents this component from being used
*/
- public void stop() throws LifecycleException {
-
- // Validate and update our current component state
- if (!started)
- throw new LifecycleException(sm
- .getString("accessLogValve.notStarted"));
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- started = false;
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
+ setState(LifecycleState.STOPPING);
close();
}
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleState;
import org.apache.catalina.comet.CometEvent;
import org.apache.catalina.comet.CometProcessor;
import org.apache.catalina.connector.CometEventImpl;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
-import org.apache.catalina.util.LifecycleSupport;
+import org.apache.catalina.util.LifecycleBase;
import org.apache.tomcat.util.res.StringManager;
* @version $Revision$ $Date$
*/
-public class CometConnectionManagerValve
- extends ValveBase
- implements Lifecycle, HttpSessionListener, LifecycleListener {
+public class CometConnectionManagerValve extends ValveBase
+ implements HttpSessionListener, LifecycleListener {
//------------------------------------------------------ Constructor
public CometConnectionManagerValve() {
/**
- * The lifecycle event support for this component.
- */
- protected LifecycleSupport lifecycle = new LifecycleSupport(this);
-
-
- /**
- * Has this component been started yet?
- */
- protected boolean started = false;
-
-
- /**
* List of current Comet connections.
*/
protected List<Request> cometRequests =
"org.apache.tomcat.comet.connectionList";
- // ------------------------------------------------------------- Properties
-
-
- // ------------------------------------------------------ Lifecycle Methods
-
-
- /**
- * Add a lifecycle event listener to this component.
- *
- * @param listener The listener to add
- */
- public void addLifecycleListener(LifecycleListener listener) {
-
- lifecycle.addLifecycleListener(listener);
-
- }
-
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
-
- return lifecycle.findLifecycleListeners();
-
- }
-
-
/**
- * Remove a lifecycle event listener from this component.
- *
- * @param listener The listener to add
- */
- public void removeLifecycleListener(LifecycleListener listener) {
-
- lifecycle.removeLifecycleListener(listener);
-
- }
-
-
- /**
- * Prepare for the beginning of active use of the public methods of this
- * component. This method should be called after <code>configure()</code>,
- * and before any of the public methods of the component are utilized.
+ * Start this component and implement the requirements
+ * of {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
- public void start() throws LifecycleException {
-
- // Validate and update our current component state
- if (started)
- throw new LifecycleException
- (sm.getString("semaphoreValve.alreadyStarted"));
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- started = true;
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
if (container instanceof Context) {
container.addLifecycleListener(this);
}
-
+
+ setState(LifecycleState.STARTING);
}
/**
- * Gracefully terminate the active use of the public methods of this
- * component. This method should be the last one called on a given
- * instance of this component.
+ * Stop this component and implement the requirements
+ * of {@link LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
- * that needs to be reported
+ * that prevents this component from being used
*/
- public void stop() throws LifecycleException {
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
- // Validate and update our current component state
- if (!started)
- throw new LifecycleException
- (sm.getString("semaphoreValve.notStarted"));
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- started = false;
+ setState(LifecycleState.STOPPING);
if (container instanceof Context) {
container.removeLifecycleListener(this);
}
-
}
* @version $Revision$ $Date$
*/
-public class ErrorReportValve
- extends ValveBase {
+public class ErrorReportValve extends ValveBase {
//------------------------------------------------------ Constructor
public ErrorReportValve() {
}
return trace.toString();
}
-
}
import javax.servlet.ServletException;
-import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
-import org.apache.catalina.util.LifecycleSupport;
+import org.apache.catalina.util.LifecycleBase;
import org.apache.tomcat.util.res.StringManager;
/**
* @author Peter Rossbach
*/
-public final class JDBCAccessLogValve
- extends ValveBase
- implements Lifecycle {
+public final class JDBCAccessLogValve extends ValveBase {
// ----------------------------------------------------------- Constructors
/**
- * The lifecycle event support for this component.
- */
- protected LifecycleSupport lifecycle = new LifecycleSupport(this);
-
-
- /**
* The string manager for this package.
*/
private static final StringManager sm = StringManager.getManager(Constants.Package);
- /**
- * Has this component been started yet?
- */
- private boolean started = false;
-
-
// ------------------------------------------------------------- Properties
/**
/**
- * Adds a Lifecycle listener.
- *
- * @param listener The listener to add.
- */
- public void addLifecycleListener(LifecycleListener listener) {
-
- lifecycle.addLifecycleListener(listener);
-
- }
-
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
-
- return lifecycle.findLifecycleListeners();
-
- }
-
-
- /**
- * Removes a Lifecycle listener.
- *
- * @param listener The listener to remove.
- */
- public void removeLifecycleListener(LifecycleListener listener) {
-
- lifecycle.removeLifecycleListener(listener);
-
- }
-
- /**
* Open (if necessary) and return a database connection for use by
* this AccessLogValve.
*
}
}
+
+
/**
- * Invoked by Tomcat on startup. The database connection is set here.
- *
- * @exception LifecycleException Can be thrown on lifecycle
- * inconsistencies or on database errors (as a wrapped SQLException).
+ * Start this component and implement the requirements
+ * of {@link LifecycleBase#startInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
*/
- public void start() throws LifecycleException {
-
- if (started)
- throw new LifecycleException
- (sm.getString("accessLogValve.alreadyStarted"));
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- started = true;
-
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
+
try {
open() ;
} catch (SQLException e) {
throw new LifecycleException(e);
}
+ setState(LifecycleState.STARTING);
}
/**
- * Invoked by tomcat on shutdown. The database connection is closed here.
- *
- * @exception LifecycleException Can be thrown on lifecycle
- * inconsistencies or on database errors (as a wrapped SQLException).
+ * Stop this component and implement the requirements
+ * of {@link LifecycleBase#stopInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
*/
- public void stop() throws LifecycleException {
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
- if (!started)
- throw new LifecycleException
- (sm.getString("accessLogValve.notStarted"));
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- started = false;
+ setState(LifecycleState.STOPPING);
close() ;
-
}
# See the License for the specific language governing permissions and
# limitations under the License.
-accessLogValve.alreadyStarted=Access Logger has already been started
-accessLogValve.notStarted=Access Logger has not yet been started
-semaphoreValve.alreadyStarted=Semaphore valve has already been started
-semaphoreValve.notStarted=Semaphore valve has not yet been started
-certificatesValve.alreadyStarted=Certificates Valve has already been started
-certificatesValve.notStarted=Certificates Valve has not yet been started
-interceptorValve.alreadyStarted=Interceptor Valve has already been started
-interceptorValve.notStarted=Interceptor Valve has not yet been started
requestFilterValve.next=No ''next'' valve has been configured
requestFilterValve.syntax=Syntax error in request filter pattern {0}
valveBase.noNext=Configuration error: No ''next'' valve configured
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-accessLogValve.alreadyStarted = El Registrador de accesos ya se hab\u00EDa iniciado
-accessLogValve.notStarted = El Registrador de accesos no se ha iniciado
-semaphoreValve.alreadyStarted = La v\u00E1lvula del sem\u00E1foro ya ha sido arrancada
-semaphoreValve.notStarted = La v\u00E1lvula del sem\u00E1foro a\u00FAn no ha sido arrancada
-certificatesValve.alreadyStarted = La v\u00E1lvula de certificados ya se hab\u00EDa iniciado
-certificatesValve.notStarted = La v\u00E1lvula de certificados no se ha iniciado
-interceptorValve.alreadyStarted = La v\u00E1lvula interceptora ya se hab\u00EDa iniciado
-interceptorValve.notStarted = La v\u00E1lvula interceptora no se ha iniciado
requestFilterValve.next = No hay ''siguiente'' v\u00E1lvula configurada
requestFilterValve.syntax = Error de sint\u00E1xis en petici\u00F3n de filtro patr\u00F3n {0}
valveBase.noNext = Error de configuraci\u00F3n\: No hay ''siguiente'' v\u00E1lvula configurada
# See the License for the specific language governing permissions and
# limitations under the License.
-accessLogValve.alreadyStarted=Le traceur d''acc\u00e8s a d\u00e9j\u00e0 \u00e9t\u00e9 d\u00e9marr\u00e9
-accessLogValve.notStarted=Le traceur d''acc\u00e8s n''a pas encore \u00e9t\u00e9 d\u00e9marr\u00e9
-certificatesValve.alreadyStarted=La Valve de Certificats a d\u00e9j\u00e0 \u00e9t\u00e9 d\u00e9marr\u00e9e
-certificatesValve.notStarted=La Valve de Certificats n''a pas encore \u00e9t\u00e9 d\u00e9marr\u00e9e
-interceptorValve.alreadyStarted=La Valve d''Interception a d\u00e9j\u00e0 \u00e9t\u00e9 d\u00e9marr\u00e9e
-interceptorValve.notStarted=La Valve d''Interception n''a pas encore \u00e9t\u00e9 d\u00e9marr\u00e9e
requestFilterValve.next=Aucune Valve ''suivante'' n''a \u00e9t\u00e9 configur\u00e9e
requestFilterValve.syntax=Erreur de syntaxe dans le pattern de filtre de requ\u00eate {0}
valveBase.noNext=Erreur de configuration: aucune Valve ''suivante'' n''a \u00e9t\u00e9 configur\u00e9e
# See the License for the specific language governing permissions and
# limitations under the License.
-accessLogValve.alreadyStarted=\u30a2\u30af\u30bb\u30b9\u30ed\u30ac\u30fc\u306f\u65e2\u306b\u8d77\u52d5\u3055\u308c\u3066\u3044\u307e\u3059
-accessLogValve.notStarted=\u30a2\u30af\u30bb\u30b9\u30ed\u30ac\u30fc\u306f\u307e\u3060\u8d77\u52d5\u3055\u308c\u3066\u3044\u307e\u305b\u3093
-certificatesValve.alreadyStarted=\u8a8d\u8a3c\u30d0\u30eb\u30d6\u306f\u65e2\u306b\u8d77\u52d5\u3055\u308c\u3066\u3044\u307e\u3059
-certificatesValve.notStarted=\u8a8d\u8a3c\u30d0\u30eb\u30d6\u306f\u307e\u3060\u8d77\u52d5\u3055\u308c\u3066\u3044\u307e\u305b\u3093
-interceptorValve.alreadyStarted=\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u30d0\u30eb\u30d6\u306f\u65e2\u306b\u8d77\u52d5\u3055\u308c\u3066\u3044\u307e\u3059
-interceptorValve.notStarted=\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u30d0\u30eb\u30d6\u306f\u307e\u3060\u8d77\u52d5\u3055\u308c\u3066\u3044\u307e\u305b\u3093
requestFilterValve.next=\u6b21\u306e\u30d0\u30eb\u30d6\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093
requestFilterValve.syntax=\u30ea\u30af\u30a8\u30b9\u30c8\u30d5\u30a3\u30eb\u30bf\u30d1\u30bf\u30fc\u30f3 {0} \u306b\u69cb\u6587\u30a8\u30e9\u30fc\u304c\u3042\u308a\u307e\u3059
jdbcAccessLogValve.exception=\u30a2\u30af\u30bb\u30b9\u30a8\u30f3\u30c8\u30ea\u306e\u633f\u5165\u3092\u5b9f\u884c\u4e2d\u306e\u4f8b\u5916\u3067\u3059
* @version $Revision$ $Date$
*/
-public class PersistentValve
- extends ValveBase {
+public class PersistentValve extends ValveBase {
//------------------------------------------------------ Constructor
public PersistentValve() {
import javax.servlet.ServletException;
-import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
-import org.apache.catalina.util.LifecycleSupport;
-import org.apache.tomcat.util.res.StringManager;
+import org.apache.catalina.util.LifecycleBase;
/**
* @version $Revision$ $Date$
*/
-public class SemaphoreValve
- extends ValveBase
- implements Lifecycle {
+public class SemaphoreValve extends ValveBase {
//------------------------------------------------------ Constructor
public SemaphoreValve() {
/**
- * The string manager for this package.
- */
- private static final StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
- /**
* Semaphore.
*/
protected Semaphore semaphore = null;
- /**
- * The lifecycle event support for this component.
- */
- protected LifecycleSupport lifecycle = new LifecycleSupport(this);
-
-
- /**
- * Has this component been started yet?
- */
- private boolean started = false;
-
-
// ------------------------------------------------------------- Properties
public void setInterruptible(boolean interruptible) { this.interruptible = interruptible; }
- // ------------------------------------------------------ Lifecycle Methods
-
-
/**
- * Add a lifecycle event listener to this component.
- *
- * @param listener The listener to add
- */
- public void addLifecycleListener(LifecycleListener listener) {
-
- lifecycle.addLifecycleListener(listener);
-
- }
-
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
-
- return lifecycle.findLifecycleListeners();
-
- }
-
-
- /**
- * Remove a lifecycle event listener from this component.
- *
- * @param listener The listener to add
- */
- public void removeLifecycleListener(LifecycleListener listener) {
-
- lifecycle.removeLifecycleListener(listener);
-
- }
-
-
- /**
- * Prepare for the beginning of active use of the public methods of this
- * component. This method should be called after <code>configure()</code>,
- * and before any of the public methods of the component are utilized.
+ * Start this component and implement the requirements
+ * of {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
- public void start() throws LifecycleException {
-
- // Validate and update our current component state
- if (started)
- throw new LifecycleException
- (sm.getString("semaphoreValve.alreadyStarted"));
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- started = true;
-
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
+
semaphore = new Semaphore(concurrency, fairness);
+ setState(LifecycleState.STARTING);
}
/**
- * Gracefully terminate the active use of the public methods of this
- * component. This method should be the last one called on a given
- * instance of this component.
+ * Stop this component and implement the requirements
+ * of {@link LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
- * that needs to be reported
+ * that prevents this component from being used
*/
- public void stop() throws LifecycleException {
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
- // Validate and update our current component state
- if (!started)
- throw new LifecycleException
- (sm.getString("semaphoreValve.notStarted"));
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- started = false;
+ setState(LifecycleState.STOPPING);
semaphore = null;
-
}
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleState;
import org.apache.catalina.Pipeline;
import org.apache.catalina.Valve;
import org.apache.catalina.Wrapper;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.core.ContainerBase;
+import org.apache.catalina.util.LifecycleBase;
import org.apache.tomcat.util.res.StringManager;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
* @version $Revision$ $Date$
*/
-public abstract class ValveBase
+public abstract class ValveBase extends LifecycleBase
implements Contained, Valve, MBeanRegistration {
private static final Log log = LogFactory.getLog(ValveBase.class);
/**
+ * Start this component and implement the requirements
+ * of {@link LifecycleBase#startInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
+
+ setState(LifecycleState.STARTING);
+ }
+
+
+ /**
+ * Stop this component and implement the requirements
+ * of {@link LifecycleBase#stopInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
+
+ setState(LifecycleState.STOPPING);
+ }
+
+
+ /**
* Return a String rendering of this object.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder(this.getClass().getName());
- sb.append("[");
- if (container != null)
+ sb.append('[');
+ if (container == null) {
+ sb.append("Container is null");
+ } else {
sb.append(container.getName());
- sb.append("]");
- return (sb.toString());
+ }
+ sb.append(']');
+ return sb.toString();
}