bloritsch 01/12/12 10:55:30
Modified: src/org/apache/cocoon Constants.java
src/org/apache/cocoon/selection
SessionAttributeSelector.java
Added: src/org/apache/cocoon/selection SessionStateSelector.java
Log:
fix backward compatibility
Revision Changes Path
1.14 +2 -2 xml-cocoon2/src/org/apache/cocoon/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Constants.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Constants.java 2001/12/12 18:42:58 1.13
+++ Constants.java 2001/12/12 18:55:30 1.14
@@ -10,7 +10,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.13 $ $Date: 2001/12/12 18:42:58 $
+ * @version CVS $Revision: 1.14 $ $Date: 2001/12/12 18:55:30 $
*/
public interface Constants {
@@ -72,7 +72,7 @@
String CONTEXT_CONFIG_URL = "config-url";
/** @deprecated this is no longer used */
- String SESSION_STATE_ATTRIBUTE = "attribute-name";
+ String SESSION_STATE_ATTRIBUTE = "org.apache.cocoon.SessionState";
boolean DESCRIPTOR_RELOADABLE_DEFAULT = true;
1.2 +5 -5
xml-cocoon2/src/org/apache/cocoon/selection/SessionAttributeSelector.java
Index: SessionAttributeSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/SessionAttributeSelector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SessionAttributeSelector.java 2001/10/22 10:17:46 1.1
+++ SessionAttributeSelector.java 2001/12/12 18:55:30 1.2
@@ -30,31 +30,31 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/10/22 10:17:46 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/12/12 18:55:30 $
*/
public class SessionAttributeSelector extends AbstractLoggable
implements Configurable, ThreadSafe, Selector {
protected String defaultName;
-
+
public void configure(Configuration config) throws ConfigurationException {
this.defaultName = config.getChild("attribute-name").getValue(null);
}
public boolean select(String expression, Map objectModel, Parameters
parameters) {
String name = parameters.getParameter("attribute-name", this.defaultName);
-
+
if (name == null) {
getLogger().warn("No attribute name given -- failing.");
return false;
}
-
+
String value =
(String)ObjectModelHelper.getRequest(objectModel).getSession().getAttribute(name);
if (value == null) {
getLogger().debug("Request parameter '" + name + "' not set --
failing.");
return false;
}
-
+
return value.equals(expression);
}
}
1.1
xml-cocoon2/src/org/apache/cocoon/selection/SessionStateSelector.java
Index: SessionStateSelector.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.cocoon.selection;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLoggable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.Constants;
import java.util.Map;
/**
* This class generates source code to implement a selector that
* matches a string against an arbitrary session attribute.
*
* <p><b>Global and local configuration</b></p>
* <table border="1">
* <tr><td><code>org.apache.cocoon.SessionState</code></td><td>String identifying
the session attribute.</td></tr>
* </table>
*
* @deprecated use SessionAttributeSelector instead
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
* @version CVS $Revision: 1.1 $ $Date: 2001/12/12 18:55:30 $
*/
public class SessionStateSelector extends SessionAttributeSelector {
public SessionStateSelector() {
this.defaultName = Constants.SESSION_STATE_ATTRIBUTE;
}
public configure(Configuration config)
{
// ignore
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]