You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by di...@apache.org on 2001/07/13 15:41:12 UTC
cvs commit: xml-cocoon2/webapp/docs/samples/session-state start.xsp state01.xsp state11.xsp state12.xsp state21.xsp state22.xsp
dims 01/07/13 06:41:11
Modified: src/org/apache/cocoon Tag: cocoon_20_branch Constants.java
src/org/apache/cocoon/acting Tag: cocoon_20_branch
AbstractAction.java
AbstractComplementaryConfigurableAction.java
AbstractDatabaseAction.java
AbstractValidatorAction.java
ConfigurationHelper.java DatabaseAddAction.java
DatabaseAuthenticatorAction.java
DatabaseDeleteAction.java DatabaseUpdateAction.java
FormValidatorAction.java RequestParamAction.java
SessionValidatorAction.java
ValidatorActionHelper.java
ValidatorActionResult.java
src/org/apache/cocoon/environment Tag: cocoon_20_branch
Request.java
src/org/apache/cocoon/environment/commandline Tag:
cocoon_20_branch CommandLineRequest.java
src/org/apache/cocoon/environment/http Tag: cocoon_20_branch
HttpRequest.java
src/org/apache/cocoon/environment/wrapper Tag:
cocoon_20_branch RequestWrapper.java
src/org/apache/cocoon/matching Tag: cocoon_20_branch
RequestParamMatcher.java
src/org/apache/cocoon/selection Tag: cocoon_20_branch
ParameterSelectorFactory.java
src/org/apache/cocoon/transformation Tag: cocoon_20_branch
TraxTransformer.java
webapp Tag: cocoon_20_branch sitemap.xmap
webapp/docs/samples Tag: cocoon_20_branch samples.xml
Added: src/org/apache/cocoon/acting Tag: cocoon_20_branch
SessionIsValidAction.java SessionStateAction.java
src/org/apache/cocoon/matching Tag: cocoon_20_branch
WildcardHeaderMatcherFactory.java
WildcardParameterValueMatcherFactory.java
WildcardSessionStateMatcherFactory.java
src/org/apache/cocoon/selection Tag: cocoon_20_branch
HeaderSelectorFactory.java
RequestSelectorFactory.java
SessionStateSelectorFactory.java
webapp/docs/samples/referer/a Tag: cocoon_20_branch a.xml
b.xml
webapp/docs/samples/referer/b Tag: cocoon_20_branch a.xml
b.xml
webapp/docs/samples/session-state Tag: cocoon_20_branch
start.xsp state01.xsp state11.xsp state12.xsp
state21.xsp state22.xsp
Log:
Sync with 2.1.
Only components which (should be?) only in 2.1 are:
- CachingCIncludeTransformer (+ related file IncludeCacheValidity)
- Profiler related files
- RoleFilterTransformer.
Revision Changes Path
No revision
No revision
1.4.2.4 +6 -1 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.4.2.3
retrieving revision 1.4.2.4
diff -u -r1.4.2.3 -r1.4.2.4
--- Constants.java 2001/07/12 12:23:40 1.4.2.3
+++ Constants.java 2001/07/13 13:36:56 1.4.2.4
@@ -10,7 +10,7 @@
/**
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.4.2.3 $ $Date: 2001/07/12 12:23:40 $
+ * @version CVS $Revision: 1.4.2.4 $ $Date: 2001/07/13 13:36:56 $
*/
public interface Constants {
@@ -71,4 +71,9 @@
String CONTEXT_CONFIG_URL = "config-url";
String CONTEXT_LOG_DIR = "log-directory";
String CONTEXT_LOG_FILE = "log-file";
+
+ boolean DESCRIPTOR_RELOADABLE_DEFAULT = true;
+
+ String SESSION_STATE_ATTRIBUTE = "org.apache.cocoon.SessionState";
+
}
No revision
No revision
1.2.2.1 +31 -4 xml-cocoon2/src/org/apache/cocoon/acting/AbstractAction.java
Index: AbstractAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractAction.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- AbstractAction.java 2001/05/31 15:38:53 1.2
+++ AbstractAction.java 2001/07/13 13:37:08 1.2.2.1
@@ -13,22 +13,49 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLoggable;
+import java.util.HashMap;
+
/**
* AbstractAction gives you the infrastructure for easily deploying more
* Actions. In order to get at the Logger, use getLogger().
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 15:38:53 $
+ * @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
+ * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/07/13 13:37:08 $
*/
public abstract class AbstractAction extends AbstractLoggable
implements Action, Configurable, Disposable {
+ /**
+ * Stores (global) configuration parameters as <code>key</code> /
+ * <code>value</code> pairs.
+ */
+ protected HashMap settings = null;
+
/**
- * Configures the Action. This implementation currently does nothing.
+ * Configures the Action.
+ *
+ * Takes <code><map:parameter/></code> from action declaration and stores
+ * them as key (<code>name</code>) and value (<code>value</code>)
+ * in <code>settings</code>. This way global configuration options
+ * can be used with actions.
+ *
+ * For nested configurations override this function in your
+ * action.
*/
public void configure(Configuration conf) throws ConfigurationException {
- // Purposely empty so that we don't need to implement it in every
- // class.
+ if (conf != null) {
+ String key = null;
+ String val = null;
+ Configuration[] parameters = conf.getChildren("map:parameter");
+ this.settings = new HashMap(parameters.length);
+ for ( int i = 0; i < parameters.length; i++) {
+ key = parameters[i].getAttribute("name");
+ val = parameters[i].getAttribute("value");
+ if ( key != null )
+ this.settings.put(key, val);
+ }
+ }
}
/**
1.3.2.3 +50 -17 xml-cocoon2/src/org/apache/cocoon/acting/AbstractComplementaryConfigurableAction.java
Index: AbstractComplementaryConfigurableAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractComplementaryConfigurableAction.java,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -r1.3.2.2 -r1.3.2.3
--- AbstractComplementaryConfigurableAction.java 2001/07/07 19:07:39 1.3.2.2
+++ AbstractComplementaryConfigurableAction.java 2001/07/13 13:37:12 1.3.2.3
@@ -15,7 +15,14 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
import org.apache.cocoon.components.source.SourceHandler;
+import org.apache.cocoon.Roles;
+import org.apache.cocoon.Constants;
+import org.apache.cocoon.acting.ConfigurationHelper;
+import org.apache.cocoon.components.parser.Parser;
+import org.apache.cocoon.components.url.URLFactory;
import org.apache.cocoon.environment.Source;
+import org.apache.cocoon.components.source.URLSource;
+import org.xml.sax.InputSource;
/**
* Set up environment for configurable form handling data. This group
@@ -25,7 +32,7 @@
* effective. The name of the root configuration element is irrelevant.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.3.2.2 $ $Date: 2001/07/07 19:07:39 $
+ * @version CVS $Revision: 1.3.2.3 $ $Date: 2001/07/13 13:37:12 $
*/
public abstract class AbstractComplementaryConfigurableAction extends ComposerAction {
private static Map configurations = new HashMap();
@@ -35,47 +42,73 @@
* multiple Actions can share the same configurations. By using
* this approach, we can limit the number of config files.
* Also note that the configuration file does not have to be a file.
+ *
+ * Defaults to reload configuration file it has changed.
*/
protected Configuration getConfiguration(String descriptor) throws ConfigurationException {
- Configuration conf = null;
+ boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
+ if (this.settings.containsKey("reloadable"))
+ reloadable = Boolean.getBoolean((String) this.settings.get("reloadable"));
+ return this.getConfiguration(descriptor, reloadable);
+ }
+ /**
+ * Set up the complementary configuration file. Please note that
+ * multiple Actions can share the same configurations. By using
+ * this approach, we can limit the number of config files.
+ * Also note that the configuration file does not have to be a file.
+ */
+ protected Configuration getConfiguration(String descriptor, boolean reloadable) throws ConfigurationException {
+ ConfigurationHelper conf = null;
+
if (descriptor == null) {
throw new ConfigurationException("The form descriptor is not set!");
}
synchronized (AbstractComplementaryConfigurableAction.configurations) {
- conf = (Configuration) AbstractComplementaryConfigurableAction.configurations.get(descriptor);
+ conf = (ConfigurationHelper) AbstractComplementaryConfigurableAction.configurations.get(descriptor);
- if (conf == null) {
+ if (reloadable || conf == null) {
SourceHandler sourceHandler = null;
Source resource = null;
try {
sourceHandler = (SourceHandler) this.manager.lookup(SourceHandler.ROLE);
resource = sourceHandler.getSource(null, descriptor);
-
- SAXConfigurationHandler builder = new SAXConfigurationHandler();
- resource.stream(builder);
- conf = builder.getConfiguration();
- } catch (Exception e) {
- getLogger().error("Could not configure Database mapping environment", e);
+ if (conf == null || conf.lastModified < resource.getLastModified()) {
+ getLogger().debug("(Re)Loading " + descriptor);
+ if (conf == null)
+ conf = new ConfigurationHelper();
+
+ SAXConfigurationHandler builder = new SAXConfigurationHandler();
+ resource.stream(builder);
+
+ conf.lastModified = resource.getLastModified();
+ conf.configuration = builder.getConfiguration();
+
+ this.cacheConfiguration(descriptor, conf);
+ } else {
+ getLogger().debug("Using cached configuration for " + descriptor);
+ }
+ } catch (Exception e) {
+ getLogger().error("Could not configure Database mapping environment", e);
throw new ConfigurationException("Error trying to load configurations for resource: " + (resource == null ? "null" : resource.getSystemId()));
} finally {
if (sourceHandler != null) this.manager.release((Component) sourceHandler);
- }
-
- this.cacheConfiguration(descriptor, conf);
- }
+ }
+ } else {
+ getLogger().debug("Using fixed cached configuration for " + descriptor);
+ }
}
-
- return conf;
+
+ return conf.configuration;
}
/**
* Cache the configuration so that we can use it later.
*/
- private void cacheConfiguration(String descriptor, Configuration conf) {
+ private void cacheConfiguration(String descriptor, ConfigurationHelper conf) {
synchronized (AbstractComplementaryConfigurableAction.configurations) {
AbstractComplementaryConfigurableAction.configurations.put(descriptor, conf);
}
1.7.2.3 +4 -4 xml-cocoon2/src/org/apache/cocoon/acting/AbstractDatabaseAction.java
Index: AbstractDatabaseAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractDatabaseAction.java,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -u -r1.7.2.2 -r1.7.2.3
--- AbstractDatabaseAction.java 2001/07/10 19:49:56 1.7.2.2
+++ AbstractDatabaseAction.java 2001/07/13 13:37:14 1.7.2.3
@@ -51,7 +51,7 @@
* <pre>
* <root>
* <connection>personnel<connection>
- * <table name="employee">
+ * <table>
* <keys>
* <key param="id" dbcol="id" type="int"/>
* </keys>
@@ -158,7 +158,7 @@
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:balld@apache.org">Donald Ball</a>
- * @version CVS $Revision: 1.7.2.2 $ $Date: 2001/07/10 19:49:56 $
+ * @version CVS $Revision: 1.7.2.3 $ $Date: 2001/07/13 13:37:14 $
*/
public abstract class AbstractDatabaseAction extends AbstractComplementaryConfigurableAction implements Configurable, Disposable {
protected Map files = new HashMap();
@@ -167,7 +167,7 @@
static {
/** Initialize the map of type names to jdbc column types.
- Note that INTEGER, BLOB, and VARCHAR column types map to more than
+ Note that INTEGER, BLOB, and VARCHAR column types map to more than
one type name. **/
Map constants = new HashMap();
constants.put("ascii", new Integer(Types.CLOB));
@@ -317,7 +317,7 @@
/**
* Set the Statement column so that the results are mapped correctly. The
* value of the column is retrieved from the request object. If the
- * named parameter exists in the request object's parameters, that value
+ * named parameter exists in the request object's parameters, that value
* is used. Otherwise if the named parameter exists in the request object's
* attributes, that value is used. Otherwise the request object is
* retrieved using Request.get(attribute), which is documented to be the
1.4.2.3 +0 -0 xml-cocoon2/src/org/apache/cocoon/acting/AbstractValidatorAction.java
Index: AbstractValidatorAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractValidatorAction.java,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- AbstractValidatorAction.java 2001/07/10 14:04:13 1.4.2.2
+++ AbstractValidatorAction.java 2001/07/13 13:37:19 1.4.2.3
@@ -1,4 +1,4 @@
-// $Id: AbstractValidatorAction.java,v 1.4.2.2 2001/07/10 14:04:13 dims Exp $
+// $Id: AbstractValidatorAction.java,v 1.4.2.3 2001/07/13 13:37:19 dims Exp $
package org.apache.cocoon.acting;
import org.apache.avalon.framework.configuration.Configurable;
@@ -103,7 +103,7 @@
* </table>
* @author Martin Man <Martin.Man@seznam.cz>
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.4.2.2 $ $Date: 2001/07/10 14:04:13 $
+ * @version CVS $Revision: 1.4.2.3 $ $Date: 2001/07/13 13:37:19 $
*/
public abstract class AbstractValidatorAction
extends AbstractComplementaryConfigurableAction
@@ -624,5 +624,5 @@
}
-// $Id: AbstractValidatorAction.java,v 1.4.2.2 2001/07/10 14:04:13 dims Exp $
+// $Id: AbstractValidatorAction.java,v 1.4.2.3 2001/07/13 13:37:19 dims Exp $
// vim: set et ts=4 sw=4:
1.1.2.2 +1 -1 xml-cocoon2/src/org/apache/cocoon/acting/ConfigurationHelper.java
Index: ConfigurationHelper.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/ConfigurationHelper.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ConfigurationHelper.java 2001/06/15 11:29:22 1.1.2.1
+++ ConfigurationHelper.java 2001/07/13 13:37:22 1.1.2.2
@@ -9,7 +9,7 @@
* Keep book on configurations together with their modification times
*
* @author Christian Haul <haul@informatik.tu-darmstadt.de>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/15 11:29:22 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/13 13:37:22 $
*/
package org.apache.cocoon.acting;
import org.apache.avalon.framework.configuration.Configuration;
1.6.2.3 +9 -2 xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAddAction.java
Index: DatabaseAddAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAddAction.java,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -u -r1.6.2.2 -r1.6.2.3
--- DatabaseAddAction.java 2001/07/13 13:22:05 1.6.2.2
+++ DatabaseAddAction.java 2001/07/13 13:37:26 1.6.2.3
@@ -43,7 +43,7 @@
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:balld@apache.org">Donald Ball</a>
- * @version CVS $Revision: 1.6.2.2 $ $Date: 2001/07/13 13:22:05 $
+ * @version CVS $Revision: 1.6.2.3 $ $Date: 2001/07/13 13:37:26 $
*/
public class DatabaseAddAction extends AbstractDatabaseAction {
protected static final Map addStatements = new HashMap();
@@ -59,8 +59,15 @@
Connection conn = null;
Map results = new HashMap();
+ // read global parameter settings
+ boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
+ if (this.settings.containsKey("reloadable"))
+ reloadable = Boolean.getBoolean((String) this.settings.get("reloadable"));
+ // read local parameter settings
try {
- Configuration conf = this.getConfiguration(param.getParameter("descriptor", null));
+ Configuration conf =
+ this.getConfiguration(param.getParameter("form-descriptor", (String) this.settings.get("descriptor")),
+ param.getParameterAsBoolean("reloadable",reloadable));
datasource = this.getDataSource(conf);
conn = datasource.getConnection();
1.3.2.1 +12 -5 xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAuthenticatorAction.java
Index: DatabaseAuthenticatorAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseAuthenticatorAction.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- DatabaseAuthenticatorAction.java 2001/06/05 21:36:20 1.3
+++ DatabaseAuthenticatorAction.java 2001/07/13 13:37:28 1.3.2.1
@@ -1,4 +1,4 @@
-// $Id: DatabaseAuthenticatorAction.java,v 1.3 2001/06/05 21:36:20 dims Exp $
+// $Id: DatabaseAuthenticatorAction.java,v 1.3.2.1 2001/07/13 13:37:28 dims Exp $
package org.apache.cocoon.acting;
import java.sql.Connection;
@@ -51,7 +51,7 @@
* not verified.
*
* @author Martin Man <Martin.Man@seznam.cz>
- * @version CVS $Revision: 1.3 $ $Date: 2001/06/05 21:36:20 $
+ * @version CVS $Revision: 1.3.2.1 $ $Date: 2001/07/13 13:37:28 $
*/
public class DatabaseAuthenticatorAction extends AbstractDatabaseAction
{
@@ -63,11 +63,18 @@
DataSourceComponent datasource = null;
Connection conn = null;
+ // read global parameter settings
+ boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
+ if (this.settings.containsKey("reloadable"))
+ reloadable = Boolean.getBoolean((String) this.settings.get("reloadable"));
+ // read local settings
try {
Configuration conf = this.getConfiguration (
- parameters.getParameter ("descriptor", null));
+ parameters.getParameter ("descriptor", (String) this.settings.get("descriptor")),
+ parameters.getParameterAsBoolean("reloadable",reloadable));
boolean cs = true;
- String create_session = parameters.getParameter ("create-session", null);
+ String create_session = parameters.getParameter ("create-session",
+ (String) this.settings.get("create-session"));
if (create_session != null &&
("no".equals (create_session.trim ()) || "false".equals (create_session.trim ()))) {
cs = false;
@@ -224,5 +231,5 @@
}
}
-// $Id: DatabaseAuthenticatorAction.java,v 1.3 2001/06/05 21:36:20 dims Exp $
+// $Id: DatabaseAuthenticatorAction.java,v 1.3.2.1 2001/07/13 13:37:28 dims Exp $
// vim: set et ts=4 sw=4:
1.3.2.3 +10 -2 xml-cocoon2/src/org/apache/cocoon/acting/DatabaseDeleteAction.java
Index: DatabaseDeleteAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseDeleteAction.java,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -r1.3.2.2 -r1.3.2.3
--- DatabaseDeleteAction.java 2001/07/13 13:22:09 1.3.2.2
+++ DatabaseDeleteAction.java 2001/07/13 13:37:32 1.3.2.3
@@ -38,7 +38,7 @@
* the keys.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.3.2.2 $ $Date: 2001/07/13 13:22:09 $
+ * @version CVS $Revision: 1.3.2.3 $ $Date: 2001/07/13 13:37:32 $
*/
public final class DatabaseDeleteAction extends AbstractDatabaseAction {
private static final Map deleteStatements = new HashMap();
@@ -53,8 +53,16 @@
Connection conn = null;
int currentIndex = 0;
+ // read global parameter settings
+ boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
+ if (this.settings.containsKey("reloadable"))
+ reloadable = Boolean.getBoolean((String) this.settings.get("reloadable"));
+ // read local parameter settings
try {
- Configuration conf = this.getConfiguration(param.getParameter("descriptor", null));
+ Configuration conf =
+ this.getConfiguration(param.getParameter("form-descriptor", (String) this.settings.get("descriptor")),
+ param.getParameterAsBoolean("reloadable",reloadable));
+
String query = this.getDeleteQuery(conf);
datasource = this.getDataSource(conf);
conn = datasource.getConnection();
1.3.2.3 +10 -2 xml-cocoon2/src/org/apache/cocoon/acting/DatabaseUpdateAction.java
Index: DatabaseUpdateAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseUpdateAction.java,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -r1.3.2.2 -r1.3.2.3
--- DatabaseUpdateAction.java 2001/07/13 13:22:11 1.3.2.2
+++ DatabaseUpdateAction.java 2001/07/13 13:37:35 1.3.2.3
@@ -35,7 +35,7 @@
* only one table at a time to update.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.3.2.2 $ $Date: 2001/07/13 13:22:11 $
+ * @version CVS $Revision: 1.3.2.3 $ $Date: 2001/07/13 13:37:35 $
*/
public class DatabaseUpdateAction extends AbstractDatabaseAction {
private static final Map updateStatements = new HashMap();
@@ -50,8 +50,16 @@
Connection conn = null;
int currentIndex = 0;
+ // read global parameter settings
+ boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
+ if (this.settings.containsKey("reloadable"))
+ reloadable = Boolean.getBoolean((String) this.settings.get("reloadable"));
+ // read local parameter settings
try {
- Configuration conf = this.getConfiguration(param.getParameter("descriptor", null));
+ Configuration conf =
+ this.getConfiguration(param.getParameter("form-descriptor", (String) this.settings.get("descriptor")),
+ param.getParameterAsBoolean("reloadable",reloadable));
+
String query = this.getUpdateQuery(conf);
datasource = this.getDataSource(conf);
conn = datasource.getConnection();
1.4.2.3 +12 -4 xml-cocoon2/src/org/apache/cocoon/acting/FormValidatorAction.java
Index: FormValidatorAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/FormValidatorAction.java,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- FormValidatorAction.java 2001/07/07 19:07:41 1.4.2.2
+++ FormValidatorAction.java 2001/07/13 13:37:37 1.4.2.3
@@ -1,4 +1,4 @@
-// $Id: FormValidatorAction.java,v 1.4.2.2 2001/07/07 19:07:41 giacomo Exp $
+// $Id: FormValidatorAction.java,v 1.4.2.3 2001/07/13 13:37:37 dims Exp $
package org.apache.cocoon.acting;
import java.util.Collections;
@@ -57,7 +57,8 @@
* the result is not available for the target page.
*
* @author Martin Man <Martin.Man@seznam.cz>
- * @version CVS $Revision: 1.4.2.2 $ $Date: 2001/07/07 19:07:41 $
+ * @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
+ * @version CVS $Revision: 1.4.2.3 $ $Date: 2001/07/13 13:37:37 $
*/
public class FormValidatorAction extends AbstractValidatorAction
{
@@ -75,9 +76,16 @@
return null;
}
+ // read global parameter settings
+ boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
+ if (this.settings.containsKey("reloadable"))
+ reloadable = Boolean.getBoolean((String) this.settings.get("reloadable"));
+ String constraints = (String) this.settings.get("constraint-set");
+ // read local settings
try {
Configuration conf = this.getConfiguration (
- parameters.getParameter ("descriptor", null));
+ parameters.getParameter ("descriptor", (String) this.settings.get("descriptor")),
+ parameters.getParameterAsBoolean("reloadable", reloadable));
String valstr = parameters.getParameter ("validate", "");
String valsetstr = parameters.getParameter ("validate-set", "");
Configuration[] desc = conf.getChildren ("parameter");
@@ -200,5 +208,5 @@
}
}
-// $Id: FormValidatorAction.java,v 1.4.2.2 2001/07/07 19:07:41 giacomo Exp $
+// $Id: FormValidatorAction.java,v 1.4.2.3 2001/07/13 13:37:37 dims Exp $
// vim: set et ts=4 sw=4:
1.1.2.3 +1 -1 xml-cocoon2/src/org/apache/cocoon/acting/RequestParamAction.java
Index: RequestParamAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/RequestParamAction.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- RequestParamAction.java 2001/07/11 15:16:54 1.1.2.2
+++ RequestParamAction.java 2001/07/13 13:37:42 1.1.2.3
@@ -73,7 +73,7 @@
*
* @author <a href="mailto:Marcus.Crafter@osa.de">Marcus Crafter</a>
* @author <a href="mailto:tcurdt@dff.st">Torsten Curdt</a>
- * @version CVS $Revision: 1.1.2.2 $
+ * @version CVS $Revision: 1.1.2.3 $
*/
public class RequestParamAction extends ComposerAction {
1.3.2.2 +14 -6 xml-cocoon2/src/org/apache/cocoon/acting/SessionValidatorAction.java
Index: SessionValidatorAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/SessionValidatorAction.java,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -r1.3.2.1 -r1.3.2.2
--- SessionValidatorAction.java 2001/06/15 11:27:48 1.3.2.1
+++ SessionValidatorAction.java 2001/07/13 13:37:50 1.3.2.2
@@ -1,4 +1,4 @@
-// $Id: SessionValidatorAction.java,v 1.3.2.1 2001/06/15 11:27:48 dims Exp $
+// $Id: SessionValidatorAction.java,v 1.3.2.2 2001/07/13 13:37:50 dims Exp $
package org.apache.cocoon.acting;
import java.util.Collections;
@@ -53,7 +53,7 @@
* all validated parameters to the sitemap via {name} expression.
*
* @author Martin Man <Martin.Man@seznam.cz>
- * @version CVS $Revision: 1.3.2.1 $ $Date: 2001/06/15 11:27:48 $
+ * @version CVS $Revision: 1.3.2.2 $ $Date: 2001/07/13 13:37:50 $
*/
public class SessionValidatorAction extends AbstractValidatorAction
{
@@ -77,11 +77,19 @@
return null;
}
+ // read global parameter settings
+ boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
+ if (this.settings.containsKey("reloadable"))
+ reloadable = Boolean.getBoolean((String) this.settings.get("reloadable"));
+ String valsetstr = (String) this.settings.get("validate-set");
+ String valstr = (String) this.settings.get("validate");
+
try {
Configuration conf = this.getConfiguration (
- parameters.getParameter ("descriptor", null));
- String valstr = parameters.getParameter ("validate", "");
- String valsetstr = parameters.getParameter ("validate-set", "");
+ parameters.getParameter ("descriptor", (String) this.settings.get("descriptor")),
+ parameters.getParameterAsBoolean("reloadable",reloadable));
+ valstr = parameters.getParameter ("validate", valstr);
+ valsetstr = parameters.getParameter ("validate-set", valsetstr);
Configuration[] desc = conf.getChildren ("parameter");
Configuration[] csets = conf.getChildren ("constraint-set");
HashMap actionMap = new HashMap ();
@@ -190,5 +198,5 @@
}
}
-// $Id: SessionValidatorAction.java,v 1.3.2.1 2001/06/15 11:27:48 dims Exp $
+// $Id: SessionValidatorAction.java,v 1.3.2.2 2001/07/13 13:37:50 dims Exp $
// vim: set et ts=4 sw=4:
1.1.2.2 +1 -1 xml-cocoon2/src/org/apache/cocoon/acting/ValidatorActionHelper.java
Index: ValidatorActionHelper.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/ValidatorActionHelper.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ValidatorActionHelper.java 2001/06/15 11:29:23 1.1.2.1
+++ ValidatorActionHelper.java 2001/07/13 13:37:53 1.1.2.2
@@ -7,7 +7,7 @@
* the validated object itself.
*
* @author Christian Haul <haul@informatik.tu-darmstadt.de>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/15 11:29:23 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/13 13:37:53 $
*/
public class ValidatorActionHelper
1.1.2.2 +58 -35 xml-cocoon2/src/org/apache/cocoon/acting/ValidatorActionResult.java
Index: ValidatorActionResult.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/ValidatorActionResult.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ValidatorActionResult.java 2001/06/15 11:29:24 1.1.2.1
+++ ValidatorActionResult.java 2001/07/13 13:37:55 1.1.2.2
@@ -12,44 +12,67 @@
* A number of constants to represent the possible outcomes of a
* validation.
*
- * <table>
- * <tr><td>OK</td><td>no error occurred, parameter successfully checked</td></tr>
- * <tr><td>ERROR</td><td>some error occurred, this is a result that is never set
- * but serves as a comparison target</td></tr>
- * <tr><td>ISNULL</td><td>the parameter is null but isn't allowed to</td></tr>
- * <tr><td>TOOSMALL</td><td>either value or length in case of a string is less
- * than the specified minimum</td></tr>
- * <tr><td>TOOLARGE</td><td>either value or length in case of a string is greater
- * than the specified maximum</td></tr>
- * <tr><td>NOMATCH</td><td>a string parameter's value is not matched by the specified
- * regular expression</td></tr>
- * <tr><td>NOTPRESENT</td><td>this is returned when the result of a validation is
- * requested but no such result is found in the request attribute
- * </td></tr>
- * </table>
- *
* @author Christian Haul <haul@informatik.tu-darmstadt.de>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/15 11:29:24 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/13 13:37:55 $
*/
public class ValidatorActionResult extends EnumerationFactory {
- public static final ValidatorActionResult
- OK = new ValidatorActionResult ("OK"), // 0
- ERROR = new ValidatorActionResult ("ERROR"), // 1
- ISNULL = new ValidatorActionResult ("ISNULL"), // 2
- TOOSMALL = new ValidatorActionResult ("TOOSMALL"), // 3
- TOOLARGE = new ValidatorActionResult ("TOOLARGE"), // 4
- NOMATCH = new ValidatorActionResult ("NOMATCH"), // 5
- NOTPRESENT = new ValidatorActionResult ("NOTPRESENT"); // 6
-
- /**
- * Make constructor private to inhibit creation outside.
- */
- private ValidatorActionResult (String image) {
- super (image);
- }
- private ValidatorActionResult () {
- super ();
- }
+ /**
+ * no error occurred, parameter successfully checked.
+ */
+ public static final ValidatorActionResult
+ OK = new ValidatorActionResult ("OK"); // 0
+
+ /**
+ * some error occurred, this is a result that is never set but
+ * serves as a comparison target.
+ */
+ public static final ValidatorActionResult
+ ERROR = new ValidatorActionResult ("ERROR"); // 1
+
+ /**
+ * the parameter is null but isn't allowed to.
+ */
+ public static final ValidatorActionResult
+ ISNULL = new ValidatorActionResult ("ISNULL"); // 2
+
+ /**
+ * either value or length in case of a string is less than the
+ * specified minimum.
+ */
+ public static final ValidatorActionResult
+ TOOSMALL = new ValidatorActionResult ("TOOSMALL"); // 3
+
+ /**
+ * either value or length in case of a string is greater than
+ * the specified maximum.
+ */
+ public static final ValidatorActionResult
+ TOOLARGE = new ValidatorActionResult ("TOOLARGE"); // 4
+
+ /**
+ * a string parameter's value is not matched by the specified
+ * regular expression.
+ */
+ public static final ValidatorActionResult
+ NOMATCH = new ValidatorActionResult ("NOMATCH"); // 5
+
+ /**
+ * this is returned when the result of a validation is
+ * requested but no such result is found in the request
+ * attribute.
+ */
+ public static final ValidatorActionResult
+ NOTPRESENT = new ValidatorActionResult ("NOTPRESENT"); // 6
+
+ /**
+ * Make constructor private to inhibit creation outside.
+ */
+ private ValidatorActionResult (String image) {
+ super (image);
+ }
+ private ValidatorActionResult () {
+ super ();
+ }
}
No revision
No revision
1.1.2.1 +1 -1 xml-cocoon2/src/org/apache/cocoon/acting/SessionIsValidAction.java
Index: SessionIsValidAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/SessionIsValidAction.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- SessionIsValidAction.java 2001/07/11 09:50:02 1.1
+++ SessionIsValidAction.java 2001/07/13 13:37:45 1.1.2.1
@@ -28,7 +28,7 @@
* seesion is still valid.
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:50:02 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:37:45 $
*/
public class SessionIsValidAction extends AbstractValidatorAction
1.1.2.1 +1 -1 xml-cocoon2/src/org/apache/cocoon/acting/SessionStateAction.java
Index: SessionStateAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/SessionStateAction.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- SessionStateAction.java 2001/07/11 09:50:03 1.1
+++ SessionStateAction.java 2001/07/13 13:37:48 1.1.2.1
@@ -69,7 +69,7 @@
* @see org.apache.cocoon.selection.SessionStateSelectorFactory
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Id: SessionStateAction.java,v 1.1 2001/07/11 09:50:03 haul Exp $ */
+ * @version CVS $Id: SessionStateAction.java,v 1.1.2.1 2001/07/13 13:37:48 dims Exp $ */
public class SessionStateAction extends ComposerAction {
private static String componentName = "REZEPTE SessionStateAction";
No revision
No revision
1.1.1.1.2.3 +11 -1 xml-cocoon2/src/org/apache/cocoon/environment/Request.java
Index: Request.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/Request.java,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3
--- Request.java 2001/07/12 14:18:04 1.1.1.1.2.2
+++ Request.java 2001/07/13 13:38:34 1.1.1.1.2.3
@@ -12,6 +12,7 @@
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Locale;
+import java.util.Map;
import java.security.Principal;
/**
@@ -20,7 +21,7 @@
* @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.1.1.2.2 $ $Date: 2001/07/12 14:18:04 $
+ * @version CVS $Revision: 1.1.1.1.2.3 $ $Date: 2001/07/13 13:38:34 $
*
*/
@@ -346,6 +347,15 @@
*/
Cookie[] getCookies();
+
+ /**
+ * Returns a map of the <code>Cookie</code> objects the client sent
+ * with this request, indexed by name. This method returns an empty
+ * map if no cookies were sent.
+ *
+ * @return a Map of <code>Cookie</code> objects
+ */
+ Map getCookieMap();
/**
*
No revision
No revision
1.2.2.2 +6 -1 xml-cocoon2/src/org/apache/cocoon/environment/commandline/CommandLineRequest.java
Index: CommandLineRequest.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/commandline/CommandLineRequest.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- CommandLineRequest.java 2001/06/19 12:10:22 1.2.2.1
+++ CommandLineRequest.java 2001/07/13 13:38:46 1.2.2.2
@@ -15,6 +15,8 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.Cookie;
import org.apache.cocoon.environment.Environment;
@@ -25,7 +27,7 @@
* Creates a specific servlet request simulation from command line usage.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/19 12:10:22 $
+ * @version CVS $Revision: 1.2.2.2 $ $Date: 2001/07/13 13:38:46 $
*/
/*
@@ -170,6 +172,9 @@
public String getRemoteUser() { return System.getProperty("user.name"); }
public Cookie[] getCookies() { return null; }
+ public Map getCookieMap() {
+ return Collections.unmodifiableMap(new HashMap());
+ }
public Session getSession() { return null; }
public Session getSession(boolean create) { return null; }
public String getRequestedSessionId() { return null; }
No revision
No revision
1.1.1.1.2.3 +18 -2 xml-cocoon2/src/org/apache/cocoon/environment/http/HttpRequest.java
Index: HttpRequest.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/http/HttpRequest.java,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3
--- HttpRequest.java 2001/06/14 18:27:42 1.1.1.1.2.2
+++ HttpRequest.java 2001/07/13 13:38:55 1.1.1.1.2.3
@@ -13,6 +13,9 @@
import java.util.Enumeration;
import java.util.Locale;
import java.util.Vector;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
@@ -25,7 +28,7 @@
* to provide request information for HTTP servlets.
*
* @author <a href="mailto:giacomo@apache,org">Giacomo Pati</a>
- * @version CVS $Id: HttpRequest.java,v 1.1.1.1.2.2 2001/06/14 18:27:42 dims Exp $
+ * @version CVS $Id: HttpRequest.java,v 1.1.1.1.2.3 2001/07/13 13:38:55 dims Exp $
*/
public class HttpRequest implements Request {
@@ -78,17 +81,30 @@
}
private Cookie[] wrappedCookies = null;
+ private Map wrappedCookieMap = null;
+
public Cookie[] getCookies() {
if (this.wrappedCookies == null) {
+ this.wrappedCookieMap = new HashMap();
javax.servlet.http.Cookie[] cookies = this.req.getCookies();
if (cookies != null) {
this.wrappedCookies = new Cookie[cookies.length];
for(int i=0; i<cookies.length;i++) {
- this.wrappedCookies[i] = new HttpCookie(cookies[i]);
+ HttpCookie cookie = new HttpCookie(cookies[i]);
+ this.wrappedCookies[i] = cookie;
+ this.wrappedCookieMap.put(cookie.getName(),cookie);
}
}
}
return this.wrappedCookies;
+ }
+
+ public Map getCookieMap() {
+ if (this.wrappedCookieMap != null) {
+ return Collections.unmodifiableMap(this.wrappedCookieMap);
+ } else {
+ return Collections.unmodifiableMap(new HashMap());
+ }
}
public long getDateHeader(String name) {
No revision
No revision
1.1.2.5 +7 -2 xml-cocoon2/src/org/apache/cocoon/environment/wrapper/RequestWrapper.java
Index: RequestWrapper.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/wrapper/RequestWrapper.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- RequestWrapper.java 2001/07/12 14:18:15 1.1.2.4
+++ RequestWrapper.java 2001/07/13 13:39:02 1.1.2.5
@@ -23,7 +23,7 @@
* are different.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version $Id: RequestWrapper.java,v 1.1.2.4 2001/07/12 14:18:15 dims Exp $
+ * @version $Id: RequestWrapper.java,v 1.1.2.5 2001/07/13 13:39:02 dims Exp $
*/
public final class RequestWrapper implements Request {
@@ -177,6 +177,10 @@
return this.req.getCookies();
}
+ public Map getCookieMap() {
+ return this.req.getCookieMap();
+ }
+
public long getDateHeader(String name) {
return this.req.getDateHeader(name);
}
@@ -268,4 +272,5 @@
public String getAuthType() {
return this.req.getAuthType();
}
-}
\ No newline at end of file
+
+}
No revision
No revision
1.3.2.1 +7 -6 xml-cocoon2/src/org/apache/cocoon/matching/RequestParamMatcher.java
Index: RequestParamMatcher.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/RequestParamMatcher.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- RequestParamMatcher.java 2001/05/31 17:38:32 1.3
+++ RequestParamMatcher.java 2001/07/13 13:39:10 1.3.2.1
@@ -26,14 +26,15 @@
* If the specified request parameter exists, its value is retrieved for later
* xpath substitution.
*
- * Example:
+ * <p><b>Example:</b></p>
+ * <pre>
+ * <map:match type="request" pattern="dest">
+ * <map:redirect-to uri="{1}"/>
+ * </map:match>
+ * </pre>
*
- * <map:match type="request" pattern="dest">
- * <map:redirect-to uri="{1}"/>
- * </map:match>
- *
* @author <a href="mailto:Marcus.Crafter@osa.de">Marcus Crafter</a>
- * @version CVS $Revision: 1.3 $
+ * @version CVS $Revision: 1.3.2.1 $
*/
public class RequestParamMatcher implements Matcher {
/**
No revision
No revision
1.1.2.1 +1 -1 xml-cocoon2/src/org/apache/cocoon/matching/WildcardHeaderMatcherFactory.java
Index: WildcardHeaderMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardHeaderMatcherFactory.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- WildcardHeaderMatcherFactory.java 2001/07/11 09:50:01 1.1
+++ WildcardHeaderMatcherFactory.java 2001/07/13 13:39:16 1.1.2.1
@@ -25,7 +25,7 @@
* </table>
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:50:01 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:16 $
*/
public class WildcardHeaderMatcherFactory extends WildcardURIMatcherFactory {
1.1.2.1 +1 -1 xml-cocoon2/src/org/apache/cocoon/matching/WildcardParameterValueMatcherFactory.java
Index: WildcardParameterValueMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardParameterValueMatcherFactory.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- WildcardParameterValueMatcherFactory.java 2001/07/11 09:50:01 1.1
+++ WildcardParameterValueMatcherFactory.java 2001/07/13 13:39:19 1.1.2.1
@@ -29,7 +29,7 @@
* </table>
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:50:01 $ */
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:19 $ */
public class WildcardParameterValueMatcherFactory extends WildcardURIMatcherFactory {
1.1.2.1 +1 -1 xml-cocoon2/src/org/apache/cocoon/matching/WildcardSessionStateMatcherFactory.java
Index: WildcardSessionStateMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardSessionStateMatcherFactory.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- WildcardSessionStateMatcherFactory.java 2001/07/11 09:50:01 1.1
+++ WildcardSessionStateMatcherFactory.java 2001/07/13 13:39:20 1.1.2.1
@@ -26,7 +26,7 @@
* </table>
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:50:01 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:20 $
*/
public class WildcardSessionStateMatcherFactory extends WildcardURIMatcherFactory {
No revision
No revision
1.1.1.1.2.1 +14 -12 xml-cocoon2/src/org/apache/cocoon/selection/ParameterSelectorFactory.java
Index: ParameterSelectorFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/ParameterSelectorFactory.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- ParameterSelectorFactory.java 2001/05/09 20:49:28 1.1.1.1
+++ ParameterSelectorFactory.java 2001/07/13 13:39:33 1.1.1.1.2.1
@@ -20,25 +20,27 @@
* This class generates source code to implement a selector that
* matches a string in the parameters object passed to it.
*
- * <map:selector name="parameter" factory="org.apache.cocoon.selection.ParameterSelectorFactory"/>
+ * <pre>
+ * <map:selector name="parameter" factory="org.apache.cocoon.selection.ParameterSelectorFactory"/>
*
- * <map:select type="parameter">
- * <parameter name="parameter-selector-test" value="{$mySitemapParameter}"/>
- * <map:when test="myParameterValue">
- * <!-- executes iff {$mySitemapParameter} == "myParameterValue" -->
- * <map:transform src="stylesheets/page/uk.xsl"/>
- * </map:when>
- * <map:otherwise>
- * <map:transform src="stylesheets/page/us.xsl"/>
- * </map:otherwise>
- * </map:select>
+ * <map:select type="parameter">
+ * <parameter name="parameter-selector-test" value="{$mySitemapParameter}"/>
+ * <map:when test="myParameterValue">
+ * <!-- executes iff {$mySitemapParameter} == "myParameterValue" -->
+ * <map:transform src="stylesheets/page/uk.xsl"/>
+ * </map:when>
+ * <map:otherwise>
+ * <map:transform src="stylesheets/page/us.xsl"/>
+ * </map:otherwise>
+ * </map:select>
+ * </pre>
*
* The purpose of this selector is to allow an action to set parameters
* and to be able to select between different pipeline configurations
* depending on those parameters.
*
* @author <a href="mailto:leo.sutic@inspireinfrastructure.com">Leo Sutic</a>
- * @version CVS $Revision: 1.1.1.1 $ $Date: 2001/05/09 20:49:28 $
+ * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/07/13 13:39:33 $
*/
public class ParameterSelectorFactory implements CodeFactory {
No revision
No revision
1.1.2.1 +1 -1 xml-cocoon2/src/org/apache/cocoon/selection/HeaderSelectorFactory.java
Index: HeaderSelectorFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/HeaderSelectorFactory.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- HeaderSelectorFactory.java 2001/07/11 09:49:59 1.1
+++ HeaderSelectorFactory.java 2001/07/13 13:39:31 1.1.2.1
@@ -27,7 +27,7 @@
* </table>
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:49:59 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:31 $
*/
public class HeaderSelectorFactory extends ParameterSelectorFactory {
1.1.2.1 +1 -1 xml-cocoon2/src/org/apache/cocoon/selection/RequestSelectorFactory.java
Index: RequestSelectorFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/RequestSelectorFactory.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- RequestSelectorFactory.java 2001/07/11 09:49:59 1.1
+++ RequestSelectorFactory.java 2001/07/13 13:39:35 1.1.2.1
@@ -27,7 +27,7 @@
* </table>
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:49:59 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:35 $
*/
public class RequestSelectorFactory extends ParameterSelectorFactory {
1.1.2.1 +1 -1 xml-cocoon2/src/org/apache/cocoon/selection/SessionStateSelectorFactory.java
Index: SessionStateSelectorFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/SessionStateSelectorFactory.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- SessionStateSelectorFactory.java 2001/07/11 09:49:59 1.1
+++ SessionStateSelectorFactory.java 2001/07/13 13:39:40 1.1.2.1
@@ -28,7 +28,7 @@
* </table>
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:49:59 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:40 $
*/
public class SessionStateSelectorFactory extends ParameterSelectorFactory {
No revision
No revision
1.15.2.9 +32 -4 xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java
Index: TraxTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java,v
retrieving revision 1.15.2.8
retrieving revision 1.15.2.9
diff -u -r1.15.2.8 -r1.15.2.9
--- TraxTransformer.java 2001/07/07 19:08:32 1.15.2.8
+++ TraxTransformer.java 2001/07/13 13:39:58 1.15.2.9
@@ -46,6 +46,7 @@
import org.apache.cocoon.components.browser.Browser;
import org.apache.cocoon.components.store.Store;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Cookie;
import org.apache.cocoon.environment.Source;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.util.HashUtil;
@@ -99,7 +100,7 @@
* @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
- * @version CVS $Id: TraxTransformer.java,v 1.15.2.8 2001/07/07 19:08:32 giacomo Exp $
+ * @version CVS $Id: TraxTransformer.java,v 1.15.2.9 2001/07/13 13:39:58 dims Exp $
*/
public class TraxTransformer extends ContentHandlerWrapper
implements Transformer, Composable, Recyclable, Configurable, Cacheable, Disposable, URIResolver {
@@ -125,6 +126,10 @@
private boolean useParameters = false;
private boolean _useParameters = false;
+ /** Should we make the cookies availalbe in the stylesheet? (default is off) **/
+ private boolean useCookies = false;
+ private boolean _useCookies = false;
+
/** Should we make the browser capability properties available in the stylesheet? (default is off) */
private boolean useBrowserCap = false;
private boolean _useBrowserCap = false;
@@ -307,6 +312,10 @@
this.useParameters = child.getValueAsBoolean(false);
this._useParameters = this.useParameters;
getLogger().debug("Use parameters is " + this.useParameters + " for " + this);
+ child = conf.getChild("use-cookies");
+ this.useCookies = child.getValueAsBoolean(false);
+ this._useCookies = this.useCookies;
+ getLogger().debug("Use cookies is " + this.useCookies + " for " + this);
child = conf.getChild("use-browser-capabilities-db");
this.useBrowserCap = child.getValueAsBoolean(false);
this._useBrowserCap = this.useBrowserCap;
@@ -348,6 +357,7 @@
this.resolver = resolver;
getLogger().debug("Using stylesheet: '"+this.inputSource.getSystemId()+"' in " + this + ", last modified: " + this.inputSource.getLastModified());
_useParameters = par.getParameterAsBoolean("use-request-parameters", this.useParameters);
+ _useCookies = par.getParameterAsBoolean("use-cookies", this.useCookies);
_useBrowserCap = par.getParameterAsBoolean("use-browser-capabilities-db", this.useBrowserCap);
}
@@ -392,9 +402,9 @@
return new TimeStampCacheValidity(this.inputSource.getLastModified());
} else {
return new CompositeCacheValidity(
- new ParametersCacheValidity(map),
- new TimeStampCacheValidity(this.inputSource.getLastModified())
- );
+ new ParametersCacheValidity(map),
+ new TimeStampCacheValidity(this.inputSource.getLastModified())
+ );
}
}
return null;
@@ -483,6 +493,23 @@
}
}
+ if (this._useCookies) {
+ Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
+ Cookie cookies[] = request.getCookies();
+ if (cookies != null) {
+ for (int i=0; i<cookies.length; i++) {
+ String name = cookies[i].getName();
+ if (isValidXSLTParameterName(name)) {
+ String value = cookies[i].getValue();
+ if (map == null) {
+ map = new HashMap();
+ }
+ map.put(name,value);
+ }
+ }
+ }
+ }
+
if (this._useBrowserCap) try {
Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
if (map == null) {
@@ -604,6 +631,7 @@
this.par = null;
this.resolver = null;
this._useParameters = this.useParameters;
+ this._useCookies = this.useCookies;
this._useBrowserCap = this.useBrowserCap;
super.recycle();
}
No revision
No revision
1.11.2.16 +73 -0 xml-cocoon2/webapp/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/sitemap.xmap,v
retrieving revision 1.11.2.15
retrieving revision 1.11.2.16
diff -u -r1.11.2.15 -r1.11.2.16
--- sitemap.xmap 2001/07/13 11:25:50 1.11.2.15
+++ sitemap.xmap 2001/07/13 13:40:07 1.11.2.16
@@ -93,6 +93,14 @@
<map:matchers default="wildcard">
<map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcherFactory"/>
<map:matcher name="regexp" src="org.apache.cocoon.matching.RegexpURIMatcherFactory"/>
+ <map:matcher name="request" src="org.apache.cocoon.matching.RequestParamMatcher"/>
+ <map:matcher name="sessionstate" src="org.apache.cocoon.matching.WildcardSessionStateMatcherFactory"/>
+ <map:matcher name="next-page" src="org.apache.cocoon.matching.WildcardParameterValueMatcherFactory">
+ <map:parameter name="parameter-name" value="next-state"/>
+ </map:matcher>
+ <map:matcher name="referer-match" src="org.apache.cocoon.matching.WildcardHeaderMatcherFactory">
+ <map:parameter name="parameter-name" value="referer"/>
+ </map:matcher>
</map:matchers>
<map:actions>
@@ -103,6 +111,8 @@
<map:action name="locale" src="org.apache.cocoon.acting.LocaleAction"/>
<map:action name="request" src="org.apache.cocoon.acting.RequestParamAction"/>
<map:action name="form-validator" src="org.apache.cocoon.acting.FormValidatorAction"/>
+ <map:action name="session-state" src="org.apache.cocoon.acting.SessionStateAction"/>
+ <map:action name="session-isvalid" src="org.apache.cocoon.acting.SessionIsValidAction"/>
</map:actions>
</map:components>
@@ -140,6 +150,28 @@
</map:transform>
<map:serialize/>
</map:resource>
+
+ <map:resource name="dynamic-page1">
+ <map:act type="session-state">
+ <map:parameter name="new-state" value="{../next-state}"/>
+ <map:redirect-to resource="dynamic-page" target="{../target}/state{../../../state}{../../next-state}"/>
+ </map:act>
+ </map:resource>
+
+ <map:resource name="dynamic-page2">
+ <map:act type="session-state">
+ <map:parameter name="new-state" value="1"/>
+ <map:redirect-to resource="dynamic-page" target="{../target}1"/>
+ </map:act>
+ </map:resource>
+
+ <map:resource name="simple-page">
+ <map:generate type="file" src="{target}.xml"/>
+ <map:transform src="stylesheets/page/simple-page2html.xsl">
+ <map:parameter name="view-source" value="{target}.xml"/>
+ </map:transform>
+ <map:serialize/>
+ </map:resource>
</map:resources>
<!-- ========================== Action sets ================================ -->
@@ -472,6 +504,47 @@
</map:transform>
<map:serialize/>
</map:match>
+
+ <!-- ========================== session state ================================= -->
+
+ <map:match pattern="session-state/example">
+ <map:act type="session-isvalid">
+
+ <map:match type="sessionstate" pattern="1">
+ <map:match type="next-page" pattern="1">
+ <map:redirect-to resource="dynamic-page1" target="docs/samples/session-state"/>
+ </map:match>
+ <map:match type="next-page" pattern="2">
+ <map:redirect-to resource="dynamic-page1" target="docs/samples/session-state"/>
+ </map:match>
+ </map:match>
+
+ <map:match type="sessionstate" pattern="2">
+ <map:match type="next-page" pattern="1">
+ <map:redirect-to resource="dynamic-page1" target="docs/samples/session-state"/>
+ </map:match>
+ <map:match type="next-page" pattern="2">
+ <map:redirect-to resource="dynamic-page1" target="docs/samples/session-state"/>
+ </map:match>
+ </map:match>
+
+ <map:redirect-to resource="dynamic-page2" target="docs/samples/session-state/state0"/>
+ </map:act>
+ <map:redirect-to resource="dynamic-page" target="docs/samples/session-state/start"/>
+ </map:match>
+
+ <!-- ========================== referer ================================= -->
+
+ <map:match pattern="referer/*">
+ <map:match type="referer-match" pattern="http://localhost:8080/cocoon/referer/a">
+ <map:redirect-to resource="simple-page" target="docs/samples/referer/a/{../1}"/>
+ </map:match>
+ <map:match type="referer-match" pattern="http://localhost:8080/cocoon/referer/b">
+ <map:redirect-to resource="simple-page" target="docs/samples/referer/b/{../1}"/>
+ </map:match>
+
+ <map:redirect-to resource="simple-page" target="docs/samples/referer/a/a"/>
+ </map:match>
<!-- ========================== Stream ================================= -->
<map:match pattern="request1">
No revision
No revision
1.3.2.4 +11 -0 xml-cocoon2/webapp/docs/samples/samples.xml
Index: samples.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/samples.xml,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -r1.3.2.3 -r1.3.2.4
--- samples.xml 2001/07/10 17:43:49 1.3.2.3
+++ samples.xml 2001/07/13 13:40:19 1.3.2.4
@@ -153,6 +153,17 @@
</sample>
</group>
+ <group name="Stateful Applications">
+ <sample name="Session State" href="session-state/example">
+ Here the application state is stored in a session attribute.
+ </sample>
+ <sample name="Sessionless State" href="referer/a">
+ Whereas this example uses the request header referer
+ attribute. The complete URL must be known to the sitemap, so this
+ works only if you access Cocoon on http://localhost:8080/cocoon
+ </sample>
+ </group>
+
<group name="System Pages">
<sample name="Status Page" href="status">
Cocoon status page.
No revision
No revision
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/referer/a/a.xml
Index: a.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/referer/a/a.xml,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/referer/a/b.xml
Index: b.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/referer/a/b.xml,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
No revision
No revision
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/referer/b/a.xml
Index: a.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/referer/b/a.xml,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/referer/b/b.xml
Index: b.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/referer/b/b.xml,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
No revision
No revision
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/session-state/start.xsp
Index: start.xsp
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/session-state/start.xsp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/session-state/state01.xsp
Index: state01.xsp
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/session-state/state01.xsp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/session-state/state11.xsp
Index: state11.xsp
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/session-state/state11.xsp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/session-state/state12.xsp
Index: state12.xsp
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/session-state/state12.xsp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/session-state/state21.xsp
Index: state21.xsp
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/session-state/state21.xsp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
1.1.2.1 +0 -0 xml-cocoon2/webapp/docs/samples/session-state/state22.xsp
Index: state22.xsp
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/session-state/state22.xsp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org