You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2003/07/01 22:49:36 UTC
cvs commit: jakarta-tapestry/examples/Workbench/src/org/apache/tapestry/workbench/upload Upload.java
hlship 2003/07/01 13:49:36
Modified: framework/src/org/apache/tapestry/parse
AbstractSpecificationRule.java
SetMetaPropertyRule.java ComponentCopyOfRule.java
SetExtendedPropertyRule.java
SpecificationParser.java
SetLimitedPropertiesRule.java
SpecificationDigester.java
examples/Vlib/src/org/apache/tapestry/vlib/pages
EditBook.java EditProfile.java NewBook.java
framework/src/org/apache/tapestry/form DatePicker.java
Form.java
framework/src/org/apache/tapestry/engine AbstractEngine.java
IMonitor.java RequestCycle.java
DefaultComponentMessagesSource.java
framework/src/org/apache/tapestry/param
ParameterManager.java
examples/Workbench/src/org/apache/tapestry/workbench/chart
ChartPage.java
web new.html
framework/src/org/apache/tapestry/html Shell.java
framework/src/org/apache/tapestry/valid BaseValidator.java
ValidField.java
framework/src/org/apache/tapestry/util/xml
RuleDirectedParser.java BaseRule.java
framework/src/org/apache/tapestry/pageload PageLoader.java
examples/Vlib/src/org/apache/tapestry/vlib/pages/admin
EditUsers.java
doc/src/common TapestryLinks.xml
doc/src/UsersGuide configuration.xml
junit/src/org/apache/tapestry/junit/mock MockTester.java
framework/src/org/apache/tapestry/util
LocalizedNameGenerator.java
framework/src/org/apache/tapestry/script
InputSymbolRule.java
framework/src/org/apache/tapestry RedirectFilter.java
Tapestry.java
examples/Workbench/src/org/apache/tapestry/workbench/upload
Upload.java
Added: framework/src/org/apache/tapestry/engine
IMonitorFactory.java DefaultMonitorFactory.java
Log:
[ 18379 ] IMonitor Enhancement
[ 18382 ] isRewinding not set properly during events
Revision Changes Path
1.4 +3 -3 jakarta-tapestry/framework/src/org/apache/tapestry/parse/AbstractSpecificationRule.java
Index: AbstractSpecificationRule.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/AbstractSpecificationRule.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractSpecificationRule.java 21 Apr 2003 13:15:28 -0000 1.3
+++ AbstractSpecificationRule.java 1 Jul 2003 20:49:32 -0000 1.4
@@ -57,9 +57,9 @@
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.digester.Rule;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.ILocation;
import org.apache.tapestry.IResourceLocation;
-import org.apache.tapestry.Tapestry;
import org.xml.sax.Attributes;
/**
@@ -83,7 +83,7 @@
{
String attributeName = attributes.getLocalName(i);
- if (Tapestry.isNull(attributeName))
+ if (StringUtils.isEmpty(attributeName))
attributeName = attributes.getQName(i);
if (attributeName.equals(name))
1.4 +5 -7 jakarta-tapestry/framework/src/org/apache/tapestry/parse/SetMetaPropertyRule.java
Index: SetMetaPropertyRule.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/SetMetaPropertyRule.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SetMetaPropertyRule.java 28 May 2003 13:41:44 -0000 1.3
+++ SetMetaPropertyRule.java 1 Jul 2003 20:49:32 -0000 1.4
@@ -55,6 +55,7 @@
package org.apache.tapestry.parse;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.util.IPropertyHolder;
import org.apache.tapestry.util.xml.DocumentParseException;
@@ -88,7 +89,7 @@
public void body(String namespace, String name, String text) throws Exception
{
- if (Tapestry.isNull(text))
+ if (StringUtils.isEmpty(text))
return;
if (_value != null)
@@ -105,11 +106,8 @@
{
if (_value == null)
throw new DocumentParseException(
- Tapestry.format(
- "SpecificationParser.required-extended-attribute",
- name,
- "value"),
- getResourceLocation());
+ Tapestry.format("SpecificationParser.required-extended-attribute", name, "value"),
+ getResourceLocation());
IPropertyHolder holder = (IPropertyHolder) digester.peek();
1.5 +5 -4 jakarta-tapestry/framework/src/org/apache/tapestry/parse/ComponentCopyOfRule.java
Index: ComponentCopyOfRule.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/ComponentCopyOfRule.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ComponentCopyOfRule.java 28 May 2003 13:41:44 -0000 1.4
+++ ComponentCopyOfRule.java 1 Jul 2003 20:49:32 -0000 1.5
@@ -57,6 +57,7 @@
import java.util.Iterator;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.spec.IBindingSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
@@ -90,9 +91,9 @@
String copyOf = getValue(attributes, "copy-of");
String type = getValue(attributes, "type");
- if (Tapestry.isNull(copyOf))
+ if (StringUtils.isEmpty(copyOf))
{
- if (Tapestry.isNull(type))
+ if (StringUtils.isEmpty(type))
throw new DocumentParseException(
Tapestry.format("SpecificationParser.missing-type-or-copy-of", id),
getResourceLocation());
@@ -100,7 +101,7 @@
return;
}
- if (!Tapestry.isNull(type))
+ if (!StringUtils.isEmpty(type))
throw new DocumentParseException(
Tapestry.format("SpecificationParser.both-type-and-copy-of", id),
getResourceLocation());
1.4 +3 -2 jakarta-tapestry/framework/src/org/apache/tapestry/parse/SetExtendedPropertyRule.java
Index: SetExtendedPropertyRule.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/SetExtendedPropertyRule.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SetExtendedPropertyRule.java 28 May 2003 13:41:44 -0000 1.3
+++ SetExtendedPropertyRule.java 1 Jul 2003 20:49:32 -0000 1.4
@@ -55,6 +55,7 @@
package org.apache.tapestry.parse;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.util.xml.DocumentParseException;
import org.xml.sax.Attributes;
@@ -100,7 +101,7 @@
public void body(String namespace, String name, String text) throws Exception
{
- if (Tapestry.isNull(text))
+ if (StringUtils.isEmpty(text))
return;
if (_valueSet)
1.14 +21 -20 jakarta-tapestry/framework/src/org/apache/tapestry/parse/SpecificationParser.java
Index: SpecificationParser.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/SpecificationParser.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SpecificationParser.java 21 Jun 2003 21:25:21 -0000 1.13
+++ SpecificationParser.java 1 Jul 2003 20:49:32 -0000 1.14
@@ -60,6 +60,7 @@
import java.util.Map;
import org.apache.commons.digester.Rule;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.ILocationHolder;
@@ -542,7 +543,7 @@
public void body(String namespace, String name, String text) throws Exception
{
- if (Tapestry.isNull(text))
+ if (StringUtils.isEmpty(text))
return;
if (_value != null)
@@ -1158,18 +1159,18 @@
digester.addSetNext(pattern, "addInitializer");
- // It's now set-message-property in the 3.0 DTD
-
- pattern = rootElementName + "/bean/set-message-property";
-
- digester.addRule(pattern, new CreateStringBeanInitializerRule());
- digester.addSetLimitedProperties(
- pattern,
- new String[] { "name", "key" },
- new String[] { "propertyName", "key" });
+ // It's now set-message-property in the 3.0 DTD
+
+ pattern = rootElementName + "/bean/set-message-property";
+
+ digester.addRule(pattern, new CreateStringBeanInitializerRule());
+ digester.addSetLimitedProperties(
+ pattern,
+ new String[] { "name", "key" },
+ new String[] { "propertyName", "key" });
+
+ digester.addSetNext(pattern, "addInitializer");
- digester.addSetNext(pattern, "addInitializer");
-
// <component>
pattern = rootElementName + "/component";
@@ -1241,15 +1242,15 @@
digester.addInitializeProperty(pattern, "type", BindingType.STRING);
digester.addSetLimitedProperties(pattern, "key", "value");
digester.addConnectChild(pattern, "setBinding", "name");
-
+
// Renamed to <message-binding> in the 3.0 DTD
-
- pattern = rootElementName + "/component/message-binding";
- digester.addRule(pattern, createBindingSpecificationRule);
- digester.addInitializeProperty(pattern, "type", BindingType.STRING);
- digester.addSetLimitedProperties(pattern, "key", "value");
- digester.addConnectChild(pattern, "setBinding", "name");
+ pattern = rootElementName + "/component/message-binding";
+
+ digester.addRule(pattern, createBindingSpecificationRule);
+ digester.addInitializeProperty(pattern, "type", BindingType.STRING);
+ digester.addSetLimitedProperties(pattern, "key", "value");
+ digester.addConnectChild(pattern, "setBinding", "name");
// <listener-binding> inside <component>
1.3 +52 -52 jakarta-tapestry/framework/src/org/apache/tapestry/parse/SetLimitedPropertiesRule.java
Index: SetLimitedPropertiesRule.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/SetLimitedPropertiesRule.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SetLimitedPropertiesRule.java 17 Apr 2003 21:33:48 -0000 1.2
+++ SetLimitedPropertiesRule.java 1 Jul 2003 20:49:32 -0000 1.3
@@ -59,7 +59,7 @@
import java.util.Map;
import org.apache.commons.beanutils.BeanUtils;
-import org.apache.tapestry.Tapestry;
+import org.apache.commons.lang.StringUtils;
import org.xml.sax.Attributes;
/**
@@ -74,58 +74,58 @@
**/
public class SetLimitedPropertiesRule extends AbstractSpecificationRule
{
- private String[] _attributeNames;
- private String[] _propertyNames;
-
- private Map _populateMap = new HashMap();
-
- public SetLimitedPropertiesRule(String attributeName, String propertyName)
- {
- this(new String[] { attributeName }, new String[] { propertyName });
- }
-
- public SetLimitedPropertiesRule(String[] attributeNames, String[] propertyNames)
- {
- _attributeNames = attributeNames;
- _propertyNames = propertyNames;
- }
-
+ private String[] _attributeNames;
+ private String[] _propertyNames;
+
+ private Map _populateMap = new HashMap();
+
+ public SetLimitedPropertiesRule(String attributeName, String propertyName)
+ {
+ this(new String[] { attributeName }, new String[] { propertyName });
+ }
+
+ public SetLimitedPropertiesRule(String[] attributeNames, String[] propertyNames)
+ {
+ _attributeNames = attributeNames;
+ _propertyNames = propertyNames;
+ }
+
public void begin(String namespace, String name, Attributes attributes) throws Exception
{
- _populateMap.clear();
-
- int count = attributes.getLength();
-
- for (int i = 0; i < count; i++)
- {
- String attributeName = attributes.getLocalName(i);
-
- if (Tapestry.isNull(attributeName))
- attributeName = attributes.getQName(i);
-
- for (int x = 0; x < _attributeNames.length; x++)
- {
- if (_attributeNames[x].equals(attributeName))
- {
- String value = attributes.getValue(i);
- String propertyName = _propertyNames[x];
-
- _populateMap.put(propertyName, value);
-
- break;
- }
- }
- }
-
- if (_populateMap.isEmpty())
- return;
-
- Object top = digester.peek();
-
- BeanUtils.populate(top, _populateMap);
-
- _populateMap.clear();
-
+ _populateMap.clear();
+
+ int count = attributes.getLength();
+
+ for (int i = 0; i < count; i++)
+ {
+ String attributeName = attributes.getLocalName(i);
+
+ if (StringUtils.isEmpty(attributeName))
+ attributeName = attributes.getQName(i);
+
+ for (int x = 0; x < _attributeNames.length; x++)
+ {
+ if (_attributeNames[x].equals(attributeName))
+ {
+ String value = attributes.getValue(i);
+ String propertyName = _propertyNames[x];
+
+ _populateMap.put(propertyName, value);
+
+ break;
+ }
+ }
+ }
+
+ if (_populateMap.isEmpty())
+ return;
+
+ Object top = digester.peek();
+
+ BeanUtils.populate(top, _populateMap);
+
+ _populateMap.clear();
+
}
}
1.7 +15 -14 jakarta-tapestry/framework/src/org/apache/tapestry/parse/SpecificationDigester.java
Index: SpecificationDigester.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/SpecificationDigester.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SpecificationDigester.java 23 May 2003 11:39:42 -0000 1.6
+++ SpecificationDigester.java 1 Jul 2003 20:49:32 -0000 1.7
@@ -60,6 +60,7 @@
import java.util.Map;
import org.apache.commons.digester.Digester;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.ILocation;
import org.apache.tapestry.IResourceLocation;
import org.apache.tapestry.Location;
@@ -161,10 +162,10 @@
{
addRule(pattern, new SetLimitedPropertiesRule(attributeNames, propertyNames));
}
-
+
public void addBody(String pattern, String propertyName)
{
- addRule(pattern, new BodyRule(propertyName));
+ addRule(pattern, new BodyRule(propertyName));
}
/**
@@ -295,7 +296,7 @@
{
int count = Tapestry.size(_documentRules);
- String name = Tapestry.isNull(localName) ? qName : localName;
+ String name = StringUtils.isEmpty(localName) ? qName : localName;
for (int i = 0; i < count; i++)
{
@@ -312,27 +313,27 @@
}
}
-
+
/**
* Invokes {@link #fatalError(SAXParseException)}.
*/
public void error(SAXParseException exception) throws SAXException
{
- fatalError(exception);
+ fatalError(exception);
}
- /**
- * Simply re-throws the exception. All exceptions when parsing
- * documents are fatal.
- */
+ /**
+ * Simply re-throws the exception. All exceptions when parsing
+ * documents are fatal.
+ */
public void fatalError(SAXParseException exception) throws SAXException
{
- throw exception;
+ throw exception;
}
- /**
- * Invokes {@link #fatalError(SAXParseException)}.
- */
+ /**
+ * Invokes {@link #fatalError(SAXParseException)}.
+ */
public void warning(SAXParseException exception) throws SAXException
{
fatalError(exception);
1.11 +4 -4 jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/EditBook.java
Index: EditBook.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/EditBook.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- EditBook.java 28 May 2003 13:41:42 -0000 1.10
+++ EditBook.java 1 Jul 2003 20:49:33 -0000 1.11
@@ -62,9 +62,9 @@
import javax.ejb.CreateException;
import javax.ejb.FinderException;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.Tapestry;
import org.apache.tapestry.event.PageEvent;
import org.apache.tapestry.event.PageRenderListener;
import org.apache.tapestry.vlib.Protected;
@@ -144,13 +144,13 @@
Integer publisherId = (Integer) attributes.get("publisherId");
String publisherName = getPublisherName();
- if (publisherId == null && Tapestry.isNull(publisherName))
+ if (publisherId == null && StringUtils.isEmpty(publisherName))
{
setErrorField("inputPublisherName", getMessage("need-publisher-name"));
return;
}
- if (publisherId != null && !Tapestry.isNull(publisherName))
+ if (publisherId != null && !StringUtils.isEmpty(publisherName))
{
setErrorField("inputPublisherName", getMessage("leave-publisher-name-empty"));
return;
1.12 +4 -4 jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/EditProfile.java
Index: EditProfile.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/EditProfile.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- EditProfile.java 28 May 2003 13:41:42 -0000 1.11
+++ EditProfile.java 1 Jul 2003 20:49:33 -0000 1.12
@@ -61,9 +61,9 @@
import javax.ejb.FinderException;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.Tapestry;
import org.apache.tapestry.event.PageEvent;
import org.apache.tapestry.event.PageRenderListener;
import org.apache.tapestry.form.IFormComponent;
@@ -161,14 +161,14 @@
Map attributes = getAttributes();
- if (Tapestry.isNull(password1) != Tapestry.isNull(password2))
+ if (StringUtils.isEmpty(password1) != StringUtils.isEmpty(password2))
{
setErrorField("inputPassword1", getMessage("enter-password-twice"));
return;
}
- if (!Tapestry.isNull(password1))
+ if (!StringUtils.isEmpty(password1))
{
if (!password1.equals(password2))
{
1.11 +4 -4 jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/NewBook.java
Index: NewBook.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/NewBook.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NewBook.java 28 May 2003 13:41:42 -0000 1.10
+++ NewBook.java 1 Jul 2003 20:49:33 -0000 1.11
@@ -61,8 +61,8 @@
import javax.ejb.CreateException;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.Tapestry;
import org.apache.tapestry.event.PageEvent;
import org.apache.tapestry.event.PageRenderListener;
import org.apache.tapestry.vlib.Protected;
@@ -94,13 +94,13 @@
Integer publisherId = (Integer) attributes.get("publisherId");
String publisherName = getPublisherName();
- if (publisherId == null && Tapestry.isNull(publisherName))
+ if (publisherId == null && StringUtils.isEmpty(publisherName))
{
setErrorField("inputPublisherName", getMessage("need-publisher-name"));
return;
}
- if (publisherId != null && !Tapestry.isNull(publisherName))
+ if (publisherId != null && !StringUtils.isEmpty(publisherName))
{
setErrorField("inputPublisherName", getMessage("leave-publisher-name-empty"));
return;
1.8 +3 -2 jakarta-tapestry/framework/src/org/apache/tapestry/form/DatePicker.java
Index: DatePicker.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/form/DatePicker.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DatePicker.java 28 May 2003 13:41:36 -0000 1.7
+++ DatePicker.java 1 Jul 2003 20:49:33 -0000 1.8
@@ -64,6 +64,7 @@
import java.util.Locale;
import java.util.Map;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IEngine;
import org.apache.tapestry.IForm;
@@ -205,7 +206,7 @@
String textValue = cycle.getRequestContext().getParameter(name);
- if (Tapestry.isNull(textValue))
+ if (StringUtils.isEmpty(textValue))
return;
try
1.11 +3 -2 jakarta-tapestry/framework/src/org/apache/tapestry/form/Form.java
Index: Form.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/form/Form.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Form.java 19 Jun 2003 10:58:10 -0000 1.10
+++ Form.java 1 Jul 2003 20:49:33 -0000 1.11
@@ -61,6 +61,7 @@
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.AbstractComponent;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IActionListener;
@@ -723,7 +724,7 @@
protected void reconstructAllocatedIds(String storedIdList)
{
- if (Tapestry.isNull(storedIdList))
+ if (StringUtils.isEmpty(storedIdList))
return;
StringSplitter splitter = new StringSplitter(',');
1.16 +60 -62 jakarta-tapestry/framework/src/org/apache/tapestry/engine/AbstractEngine.java
Index: AbstractEngine.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/AbstractEngine.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AbstractEngine.java 29 Jun 2003 18:05:41 -0000 1.15
+++ AbstractEngine.java 1 Jul 2003 20:49:33 -0000 1.16
@@ -81,6 +81,7 @@
import javax.servlet.http.HttpSessionBindingListener;
import org.apache.bsf.BSFManager;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -222,18 +223,19 @@
* determine the encoding to use when generating the output
*
* @since 3.0
- **/
-
- public static final String OUTPUT_ENCODING_PROPERTY_NAME = "org.apache.tapestry.output-encoding";
+ **/
+
+ public static final String OUTPUT_ENCODING_PROPERTY_NAME =
+ "org.apache.tapestry.output-encoding";
/**
* The default encoding that will be used when generating the output.
* It is used if no output encoding property has been specified.
*
* @since 3.0
- */
-
- public static final String DEFAULT_OUTPUT_ENCODING = "UTF-8";
+ */
+
+ public static final String DEFAULT_OUTPUT_ENCODING = "UTF-8";
/**
* The curent locale for the engine, which may be changed at any time.
@@ -468,6 +470,14 @@
private transient boolean _dirty;
/**
+ * The instance of {@link IMonitorFactory} used to create a monitor.
+ *
+ * @since 3.0
+ */
+
+ private transient IMonitorFactory _monitorFactory;
+
+ /**
* Sets the Exception page's exception property, then renders the Exception page.
*
* <p>If the render throws an exception, then copious output is sent to
@@ -576,31 +586,36 @@
}
/**
- * Overriden in subclasses that support monitoring. Should create and return
- * an instance of {@link IMonitor} that is appropriate for the request cycle described
- * by the {@link RequestContext}.
- *
- * <p>The monitor is used to create a {@link RequestCycle}.
- *
- * <p>This implementation returns either an application extension named
- * <code>org.apache.tapestry.monitor</code>, or
- * the shared instance of {@link NullMonitor}.
+ * Overriden in subclasses that support monitoring. Should create and return
+ * an instance of {@link IMonitor} that is appropriate for the request cycle described
+ * by the {@link RequestContext}.
+ *
+ * <p>The monitor is used to create a {@link RequestCycle}.
+ *
+ * <p>This implementation uses a {@link IMonitorFactory}
+ * to create the monitor instance. The factory
+ * is provided as an application extension. If the application
+ * extension does not exist, {@link DefaultMonitorFactory} is used.
*
- * <p>Subclasses could create their own instances of {@link IMonitor}, specific
- * to the individual request or session.
- *
- * <p>As of release 3.0, this method should <em>not</em> return null.
+ * <p>As of release 3.0, this method should <em>not</em> return null.
*
- * <p>TBD: Lifecycle of the monitor ... should there be a commit?
*
- **/
+ */
public IMonitor getMonitor(RequestContext context)
{
- if (_specification.checkExtension(MONITOR_EXTENSION_NAME))
- return (IMonitor) _specification.getExtension(MONITOR_EXTENSION_NAME, IMonitor.class);
+ if (_monitorFactory == null)
+ {
+ if (_specification.checkExtension(Tapestry.MONITOR_FACTORY_EXTENSION_NAME))
+ _monitorFactory =
+ (IMonitorFactory) _specification.getExtension(
+ Tapestry.MONITOR_FACTORY_EXTENSION_NAME,
+ IMonitorFactory.class);
+ else
+ _monitorFactory = DefaultMonitorFactory.SHARED;
+ }
- return NullMonitor.SHARED;
+ return _monitorFactory.createMonitor(context);
}
public IPageSource getPageSource()
@@ -870,7 +885,7 @@
{
String serviceName = extractServiceName(context);
- if (Tapestry.isNull(serviceName))
+ if (StringUtils.isEmpty(serviceName))
serviceName = Tapestry.HOME_SERVICE;
// Must have a service to create the request cycle.
@@ -895,7 +910,7 @@
// Invoke the service, which returns true if it may have changed
// the state of the engine (most do return true).
- service.service(this, cycle, output);
+ service.service(this, cycle, output);
// Return true only if the engine is actually dirty. This cuts down
// on the number of times the engine is stored into the
@@ -979,9 +994,6 @@
}
- // When in doubt, assume that the request did cause some change
- // to the engine.
-
return _dirty;
}
@@ -1228,6 +1240,10 @@
else
_sessionId = null;
+ _clientAddress = request.getRemoteHost();
+ if (_clientAddress == null)
+ _clientAddress = request.getRemoteAddr();
+
// servletPath is null, so this means either we're doing the
// first request in this session, or we're handling a subsequent
// request in another JVM (i.e. another server in the cluster).
@@ -1237,15 +1253,16 @@
{
// Get the path *within* the servlet context
- // In rare cases related to the tagsupport service, getServletPath() is wrong
- // (its a JSP, which invokes Tapestry as an include, thus muddling what
- // the real servlet and servlet path is). In those cases, the JSP tag
- // will inform us.
-
- String path = (String)request.getAttribute(Tapestry.TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE);
-
- if (path == null)
- path = request.getServletPath();
+ // In rare cases related to the tagsupport service, getServletPath() is wrong
+ // (its a JSP, which invokes Tapestry as an include, thus muddling what
+ // the real servlet and servlet path is). In those cases, the JSP tag
+ // will inform us.
+
+ String path =
+ (String) request.getAttribute(Tapestry.TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE);
+
+ if (path == null)
+ path = request.getServletPath();
// Get the context path, which may be the empty string
// (but won't be null).
@@ -1411,9 +1428,9 @@
}
}
-
String encoding = request.getCharacterEncoding();
- if (encoding == null) {
+ if (encoding == null)
+ {
encoding = getOutputEncoding();
try
{
@@ -1422,15 +1439,9 @@
catch (UnsupportedEncodingException e)
{
throw new IllegalArgumentException(
- Tapestry.format("AbstractEngine.illegal-encoding", encoding));
+ Tapestry.format("AbstractEngine.illegal-encoding", encoding));
}
}
-
-
- _clientAddress = request.getRemoteHost();
- if (_clientAddress == null)
- _clientAddress = request.getRemoteAddr();
-
}
/**
@@ -1745,7 +1756,7 @@
private RedirectAnalyzer(String location)
{
- if (Tapestry.isNull(location))
+ if (StringUtils.isEmpty(location))
{
_location = "";
_internal = true;
@@ -2086,16 +2097,6 @@
"org.apache.tapestry.property-source";
/**
- * The name of an application extension that implements {@link IMonitor}.
- *
- * @see #getMonitor(RequestContext)
- * @since 3.0
- *
- **/
-
- protected static final String MONITOR_EXTENSION_NAME = "org.apache.tapestry.monitor";
-
- /**
* Creates a shared property source that will be stored into
* the servlet context.
* Subclasses may override this method to build thier
@@ -2303,7 +2304,6 @@
{
}
-
/**
*
* The encoding to be used if none has been defined using the output encoding property.
@@ -2315,10 +2315,9 @@
**/
protected String getDefaultOutputEncoding()
{
- return DEFAULT_OUTPUT_ENCODING;
+ return DEFAULT_OUTPUT_ENCODING;
}
-
/**
*
* Returns the encoding to be used to generate the servlet responses and
@@ -2341,6 +2340,5 @@
return encoding;
}
-
}
1.2 +5 -1 jakarta-tapestry/framework/src/org/apache/tapestry/engine/IMonitor.java
Index: IMonitor.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/IMonitor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IMonitor.java 5 Mar 2003 22:59:42 -0000 1.1
+++ IMonitor.java 1 Jul 2003 20:49:33 -0000 1.2
@@ -143,6 +143,10 @@
* Invoked when a service throws an exception rather than completing normally.
* Processing of the request may continue with the display of an exception
* page.
+ *
+ * <p>
+ * serviceException() is always invoked <em>before</em>
+ * {@link #serviceEnd(String)}.
*
**/
1.8 +17 -12 jakarta-tapestry/framework/src/org/apache/tapestry/engine/RequestCycle.java
Index: RequestCycle.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/RequestCycle.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RequestCycle.java 28 May 2003 13:41:39 -0000 1.7
+++ RequestCycle.java 1 Jul 2003 20:49:33 -0000 1.8
@@ -454,10 +454,10 @@
IPage page = form.getPage();
String pageName = page.getPageName();
- _monitor.pageRewindBegin(pageName);
-
_rewinding = true;
+ _monitor.pageRewindBegin(pageName);
+
if (_attributes != null)
_attributes.clear();
@@ -499,16 +499,16 @@
}
finally
{
- _rewinding = false;
_actionId = 0;
_targetActionId = 0;
_targetComponent = null;
page.endPageRender();
- }
- _monitor.pageRewindEnd(pageName);
+ _monitor.pageRewindEnd(pageName);
+ _rewinding = false;
+ }
}
/**
@@ -529,10 +529,10 @@
{
String pageName = _page.getPageName();
- _monitor.pageRewindBegin(pageName);
-
_rewinding = true;
+ _monitor.pageRewindBegin(pageName);
+
if (_attributes != null)
_attributes.clear();
@@ -570,13 +570,15 @@
}
finally
{
- _rewinding = false;
+
_actionId = 0;
_targetActionId = 0;
_targetComponent = null;
- }
- _monitor.pageRewindEnd(pageName);
+ _monitor.pageRewindEnd(pageName);
+
+ _rewinding = false;
+ }
}
@@ -725,7 +727,10 @@
page.validate(this);
- Tapestry.checkMethodInvocation(Tapestry.ABSTRACTPAGE_VALIDATE_METHOD_ID, "validate()", page);
+ Tapestry.checkMethodInvocation(
+ Tapestry.ABSTRACTPAGE_VALIDATE_METHOD_ID,
+ "validate()",
+ page);
setPage(page);
}
1.3 +5 -4 jakarta-tapestry/framework/src/org/apache/tapestry/engine/DefaultComponentMessagesSource.java
Index: DefaultComponentMessagesSource.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/DefaultComponentMessagesSource.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultComponentMessagesSource.java 28 May 2003 14:53:53 -0000 1.2
+++ DefaultComponentMessagesSource.java 1 Jul 2003 20:49:33 -0000 1.3
@@ -63,6 +63,7 @@
import java.util.Map;
import java.util.Properties;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.ApplicationRuntimeException;
@@ -163,7 +164,7 @@
Properties result = parent;
- if (!Tapestry.isNull(language))
+ if (!StringUtils.isEmpty(language))
{
Locale l = new Locale(language, "");
MultiKey key = buildKey(baseResourceLocation, l);
@@ -180,7 +181,7 @@
else
language = "";
- if (!Tapestry.isNull(country))
+ if (!StringUtils.isEmpty(country))
{
Locale l = new Locale(language, country);
MultiKey key = buildKey(baseResourceLocation, l);
@@ -197,7 +198,7 @@
else
country = "";
- if (!Tapestry.isNull(variant))
+ if (!StringUtils.isEmpty(variant))
{
Locale l = new Locale(language, country, variant);
MultiKey key = buildKey(baseResourceLocation, l);
1.1 jakarta-tapestry/framework/src/org/apache/tapestry/engine/IMonitorFactory.java
Index: IMonitorFactory.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation", "Tapestry"
* must not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* or "Tapestry", nor may "Apache" or "Tapestry" appear in their
* name, without prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE TAPESTRY CONTRIBUTOR COMMUNITY
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.tapestry.engine;
import org.apache.tapestry.request.RequestContext;
/**
* Interface for an object that can create a {@link IMonitor} instance
* for a particular {@link org.apache.tapestry.request.RequestContext}.
* The engine expects there to be a monitor factory
* as application extension
* <code>org.apache.tapestry.monitor-factory</code>. If no such
* extension exists, then {@link org.apache.tapestry.engine.DefaultMonitorFactory}
* is used instead.
*
* @author Howard Lewis Ship
* @version $Id: IMonitorFactory.java,v 1.1 2003/07/01 20:49:33 hlship Exp $
* @since 3.0
*/
public interface IMonitorFactory
{
/**
* Create a new {@link IMonitor} instance. Alternately, return a shared instance.
* This method may be invoked by multiple threads.
*
*/
public IMonitor createMonitor(RequestContext context);
}
1.1 jakarta-tapestry/framework/src/org/apache/tapestry/engine/DefaultMonitorFactory.java
Index: DefaultMonitorFactory.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation", "Tapestry"
* must not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* or "Tapestry", nor may "Apache" or "Tapestry" appear in their
* name, without prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE TAPESTRY CONTRIBUTOR COMMUNITY
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.tapestry.engine;
import org.apache.tapestry.request.RequestContext;
/**
* Implementation of {@link org.apache.tapestry.engine.IMonitorFactory}
* that returns the {@link org.apache.tapestry.engine.NullMonitor}.
*
* @author Howard Lewis Ship
* @version $Id: DefaultMonitorFactory.java,v 1.1 2003/07/01 20:49:33 hlship Exp $
*/
public class DefaultMonitorFactory implements IMonitorFactory
{
public static final IMonitorFactory SHARED = new DefaultMonitorFactory();
/**
* Returns {@link NullMonitor#SHARED}.
*/
public IMonitor createMonitor(RequestContext context)
{
return NullMonitor.SHARED;
}
}
1.7 +3 -2 jakarta-tapestry/framework/src/org/apache/tapestry/param/ParameterManager.java
Index: ParameterManager.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/param/ParameterManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ParameterManager.java 28 May 2003 13:41:39 -0000 1.6
+++ ParameterManager.java 1 Jul 2003 20:49:33 -0000 1.7
@@ -62,6 +62,7 @@
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.BindingException;
@@ -360,7 +361,7 @@
private Class getType(String name, IResourceResolver resolver)
{
- if (Tapestry.isNull(name))
+ if (StringUtils.isEmpty(name))
return null;
Class result = (Class) SPECIAL_TYPE_MAP.get(name);
1.3 +3 -3 jakarta-tapestry/examples/Workbench/src/org/apache/tapestry/workbench/chart/ChartPage.java
Index: ChartPage.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/examples/Workbench/src/org/apache/tapestry/workbench/chart/ChartPage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ChartPage.java 15 Mar 2003 21:22:23 -0000 1.2
+++ ChartPage.java 1 Jul 2003 20:49:34 -0000 1.3
@@ -60,10 +60,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.IAsset;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.Tapestry;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.valid.IValidationDelegate;
import org.jCharts.Chart;
@@ -266,7 +266,7 @@
String name = pv.getName();
- if (Tapestry.isNull(name))
+ if (StringUtils.isEmpty(name))
name = "<New>";
data[i] = new Double(pv.getValue()).doubleValue();
1.183 +3 -1 jakarta-tapestry/web/new.html
Index: new.html
===================================================================
RCS file: /home/cvs/jakarta-tapestry/web/new.html,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -r1.182 -r1.183
--- new.html 30 Jun 2003 17:05:01 -0000 1.182
+++ new.html 1 Jul 2003 20:49:34 -0000 1.183
@@ -34,10 +34,12 @@
</ul>
<pre>
+[ 18379 ] IMonitor Enhancement
+[ 18382 ] isRewinding not set properly during events
[ 20954 ] Missing component InsertRenderer in Contrib
[ 21002 ] CodeGenerationException uses JDK 1.4 API
[ 21073 ] "isXXXXX" getter for boolean properties in components missin
-[ 21145 ] array properties and parameters do not work
+[ 21145 ] array properties and parameters do not work
</pre>
<h4>Non-backwards compatible changes:</h4>
1.6 +2 -1 jakarta-tapestry/framework/src/org/apache/tapestry/html/Shell.java
Index: Shell.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/html/Shell.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Shell.java 29 Jun 2003 18:05:41 -0000 1.5
+++ Shell.java 1 Jul 2003 20:49:34 -0000 1.6
@@ -58,6 +58,7 @@
import java.util.Date;
import java.util.Iterator;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.AbstractComponent;
import org.apache.tapestry.IAsset;
import org.apache.tapestry.IMarkupWriter;
@@ -100,7 +101,7 @@
String DTD = getDTD();
- if (!Tapestry.isNull(DTD))
+ if (!StringUtils.isEmpty(DTD))
{
writer.printRaw("<!DOCTYPE HTML PUBLIC \"");
writer.printRaw(DTD);
1.6 +3 -2 jakarta-tapestry/framework/src/org/apache/tapestry/valid/BaseValidator.java
Index: BaseValidator.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/valid/BaseValidator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BaseValidator.java 28 May 2003 13:41:48 -0000 1.5
+++ BaseValidator.java 1 Jul 2003 20:49:34 -0000 1.6
@@ -61,6 +61,7 @@
import java.util.Map;
import java.util.ResourceBundle;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IEngine;
import org.apache.tapestry.IForm;
@@ -252,7 +253,7 @@
protected boolean checkRequired(IFormComponent field, String value) throws ValidatorException
{
- boolean isNull = Tapestry.isNull(value);
+ boolean isNull = StringUtils.isEmpty(value);
if (_required && isNull)
throw new ValidatorException(
1.9 +3 -2 jakarta-tapestry/framework/src/org/apache/tapestry/valid/ValidField.java
Index: ValidField.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/valid/ValidField.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ValidField.java 28 May 2003 13:41:48 -0000 1.8
+++ ValidField.java 1 Jul 2003 20:49:34 -0000 1.9
@@ -55,6 +55,7 @@
package org.apache.tapestry.valid;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IForm;
import org.apache.tapestry.IMarkupWriter;
@@ -206,7 +207,7 @@
Object value = getValue();
String result = getValidator().toString(this, value);
- if (Tapestry.isNull(result) && getValidator().isRequired())
+ if (StringUtils.isEmpty(result) && getValidator().isRequired())
addSelect(getPage().getRequestCycle());
return result;
1.4 +3 -2 jakarta-tapestry/framework/src/org/apache/tapestry/util/xml/RuleDirectedParser.java
Index: RuleDirectedParser.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/util/xml/RuleDirectedParser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RuleDirectedParser.java 28 May 2003 13:41:45 -0000 1.3
+++ RuleDirectedParser.java 1 Jul 2003 20:49:34 -0000 1.4
@@ -67,6 +67,7 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.ApplicationRuntimeException;
@@ -447,7 +448,7 @@
private String extractName(String uri, String localName, String qName)
{
- return Tapestry.isNull(localName) ? qName : localName;
+ return StringUtils.isEmpty(localName) ? qName : localName;
}
/**
1.2 +3 -3 jakarta-tapestry/framework/src/org/apache/tapestry/util/xml/BaseRule.java
Index: BaseRule.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/util/xml/BaseRule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseRule.java 25 Apr 2003 01:18:33 -0000 1.1
+++ BaseRule.java 1 Jul 2003 20:49:34 -0000 1.2
@@ -55,7 +55,7 @@
package org.apache.tapestry.util.xml;
-import org.apache.tapestry.Tapestry;
+import org.apache.commons.lang.StringUtils;
import org.xml.sax.Attributes;
/**
@@ -76,7 +76,7 @@
{
String attributeName = attributes.getLocalName(i);
- if (Tapestry.isNull(attributeName))
+ if (StringUtils.isEmpty(attributeName))
attributeName = attributes.getQName(i);
if (attributeName.equals(name))
1.17 +6 -5 jakarta-tapestry/framework/src/org/apache/tapestry/pageload/PageLoader.java
Index: PageLoader.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/pageload/PageLoader.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- PageLoader.java 21 Jun 2003 21:25:21 -0000 1.16
+++ PageLoader.java 1 Jul 2003 20:49:34 -0000 1.17
@@ -62,6 +62,7 @@
import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.ApplicationRuntimeException;
@@ -454,7 +455,7 @@
// If not provided in the page or component specification, then
// search for a default (factory default is "jython").
- if (Tapestry.isNull(language))
+ if (StringUtils.isEmpty(language))
language =
_engine.getPropertySource().getPropertyValue(
"org.apache.tapestry.default-script-language");
@@ -642,7 +643,7 @@
IComponent result = null;
String className = spec.getComponentClassName();
- if (Tapestry.isNull(className))
+ if (StringUtils.isEmpty(className))
className = BaseComponent.class.getName();
Class componentClass = _enhancer.getEnhancedClass(spec, className);
@@ -709,7 +710,7 @@
String className = spec.getComponentClassName();
ILocation location = spec.getLocation();
- if (Tapestry.isNull(className))
+ if (StringUtils.isEmpty(className))
{
if (LOG.isDebugEnabled())
LOG.debug(
@@ -895,7 +896,7 @@
try
{
- if (Tapestry.isNull(expression))
+ if (StringUtils.isEmpty(expression))
{
initialValue = OgnlUtils.get(name, _resolver, component);
}
1.11 +5 -4 jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/admin/EditUsers.java
Index: EditUsers.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/admin/EditUsers.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- EditUsers.java 28 May 2003 13:41:46 -0000 1.10
+++ EditUsers.java 1 Jul 2003 20:49:35 -0000 1.11
@@ -62,6 +62,7 @@
import javax.ejb.FinderException;
import javax.ejb.RemoveException;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.PageRedirectException;
@@ -175,7 +176,7 @@
List updatedUsers = map.getValues();
- Person[] updatedUserIds = (Person[]) updatedUsers.toArray(new Person[updatedUsers.size()]);
+ Person[] updates = (Person[]) updatedUsers.toArray(new Person[updatedUsers.size()]);
Integer[] resetPasswordUserIds = toArray(map.getResetPasswordKeys());
Integer[] deletedUserIds = toArray(map.getDeletedKeys());
@@ -183,7 +184,7 @@
String password = getPassword();
setPassword(null);
- if (Tapestry.isNull(password) && Tapestry.size(resetPasswordUserIds) != 0)
+ if (StringUtils.isEmpty(password) && Tapestry.size(resetPasswordUserIds) != 0)
{
setErrorField("inputPassword", getMessage("need-password"));
return;
@@ -199,7 +200,7 @@
IOperations operations = vengine.getOperations();
operations.updatePersons(
- updatedUserIds,
+ updates,
resetPasswordUserIds,
password,
deletedUserIds,
1.28 +3 -1 jakarta-tapestry/doc/src/common/TapestryLinks.xml
Index: TapestryLinks.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/doc/src/common/TapestryLinks.xml,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- TapestryLinks.xml 23 Mar 2003 23:13:24 -0000 1.27
+++ TapestryLinks.xml 1 Jul 2003 20:49:35 -0000 1.28
@@ -31,6 +31,7 @@
<!ENTITY BaseEngine '<ulink url="&ApiRoot;/engine/BaseEngine.html"><classname>BaseEngine</classname></ulink>'>
<!ENTITY BasePage '<ulink url="&ApiRoot;/html/BasePage.html"><classname>BasePage</classname></ulink>'>
<!ENTITY Default '<ulink url="&ApiRoot;/bean/Default.html"><classname>Default</classname></ulink>'>
+<!ENTITY DefaultMonitorFactory '<ulink url="&ApiRoot;/engine/DefaultMonitorFactory.html"><classname>DefaultMonitorFactory</classname></ulink>'>
<!ENTITY DefaultMultipartDecoder '<ulink url="&ApiRoot;/multipart/DefaultMultipartDecoder.html"><classname>DefaultMultipartDecoder</classname></ulink>'>
<!ENTITY DefaultValuePersister '<ulink url="&ApiRoot;/record/DefaultValuePersister.html"><classname>DefaultValuePersister</classname></ulink>'>
<!ENTITY Enum '<ulink url="&ApiRoot;/util/Enum.html"><classname>Enum</classname></ulink>'>
@@ -48,6 +49,7 @@
<!ENTITY ILifecycle '<classname>ILifecycle</classname>'>
<!ENTITY IMarkupWriter '<ulink url="&ApiRoot;/IMarkupWriter.html"><classname>IMarkupWriter</classname></ulink>'>
<!ENTITY IMonitor '<ulink url="&ApiRoot;/engine/IMonitor.html"><classname>IMonitor</classname></ulink>'>
+<!ENTITY IMonitorFactory '<ulink url="&ApiRoot;/engine/IMonitorFactory.html"><classname>IMonitorFactory</classname></ulink>'>
<!ENTITY IMultipartDecoder '<ulink url="&ApiRoot;/multipart/IMultipartDecoder.html"><classname>IMultipartDecoder</classname></ulink>'>
<!ENTITY IPage '<ulink url="&ApiRoot;/IPage.html"><classname>IPage</classname></ulink>'>
<!ENTITY IPageRecorder '<ulink url="&ApiRoot;/IPageRecorder.html"><classname>IPageRecorder</classname></ulink>'>
1.9 +22 -5 jakarta-tapestry/doc/src/UsersGuide/configuration.xml
Index: configuration.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/doc/src/UsersGuide/configuration.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- configuration.xml 17 Apr 2003 21:33:54 -0000 1.8
+++ configuration.xml 1 Jul 2003 20:49:35 -0000 1.9
@@ -56,6 +56,14 @@
application servers ignore this element, but future servers may only distribute
applications within a cluster if this element is present.
</para>
+
+<warning>
+ <title>JBoss is very literal!</title>
+JBoss 3.0.x appears to be very literal about the <sgmltag class="starttag">distributable</sgmltag>
+element. If it appears, you had better be deploying into a clustered environment, otherwise
+HttpSession state management simply doesn't work.
+</warning>
+
</callout>
<callout arearefs="configuration.web.servlet-name">
<para>
@@ -426,13 +434,22 @@
</varlistentry>
<varlistentry>
- <term>org.apache.tapestry.monitor (&IMonitor;)</term>
+ <term>org.apache.tapestry.monitor-factory (&IMonitorFactory;)</term>
<listitem>
- <para>A monitor is informed
- about key events during each request and is intended to support performance
- monitoring.
+ <para>An object that is used to create &IMonitor; instances. Monitors
+ are informed about key application events (such as loading a page)
+ during the processing of a request.
</para>
+
+ <para>
+ The factory may create a new instance for the request, or may simply
+ provide access to a shared instance.
+ </para>
+
+ <para>
+ If not specified, a default implementation is used (&DefaultMonitorFactory;).
+ </para>
</listitem>
</varlistentry>
1.6 +6 -6 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/MockTester.java
Index: MockTester.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/MockTester.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MockTester.java 16 May 2003 18:54:23 -0000 1.5
+++ MockTester.java 1 Jul 2003 20:49:35 -0000 1.6
@@ -73,6 +73,7 @@
import ognl.Ognl;
import ognl.OgnlException;
+import org.apache.commons.lang.StringUtils;
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.MatchResult;
import org.apache.oro.text.regex.Pattern;
@@ -83,7 +84,6 @@
import org.apache.oro.text.regex.Perl5Matcher;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.ApplicationServlet;
-import org.apache.tapestry.Tapestry;
import org.apache.tapestry.util.xml.DocumentParseException;
import org.jdom.Document;
import org.jdom.Element;
@@ -515,7 +515,7 @@
String name = a.getAttributeValue("name");
String pattern = a.getTextTrim();
- if (Tapestry.isNull(pattern))
+ if (StringUtils.isEmpty(pattern))
throw new DocumentParseException("Pattern is null in " + a);
if (outputString == null)
@@ -549,7 +549,7 @@
String name = a.getAttributeValue("name");
String substring = a.getTextTrim();
- if (Tapestry.isNull(substring))
+ if (StringUtils.isEmpty(substring))
throw new DocumentParseException("Substring is null in " + a);
if (outputString == null)
@@ -583,7 +583,7 @@
String name = a.getAttributeValue("name");
String substring = a.getTextTrim();
- if (Tapestry.isNull(substring))
+ if (StringUtils.isEmpty(substring))
throw new DocumentParseException("Substring is null in " + a);
if (outputString == null)
@@ -701,7 +701,7 @@
String pattern = element.getTextTrim();
- if (Tapestry.isNull(pattern))
+ if (StringUtils.isEmpty(pattern))
throw new DocumentParseException("Pattern is null in " + element);
PatternMatcherInput input = new PatternMatcherInput(outputString);
1.4 +6 -6 jakarta-tapestry/framework/src/org/apache/tapestry/util/LocalizedNameGenerator.java
Index: LocalizedNameGenerator.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/util/LocalizedNameGenerator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LocalizedNameGenerator.java 29 Jun 2003 18:05:41 -0000 1.3
+++ LocalizedNameGenerator.java 1 Jul 2003 20:49:36 -0000 1.4
@@ -58,7 +58,7 @@
import java.util.Locale;
import java.util.NoSuchElementException;
-import org.apache.tapestry.Tapestry;
+import org.apache.commons.lang.StringUtils;
/**
* Used in a wide variety of resource searches. Generates
@@ -123,14 +123,14 @@
{
case LCV :
- if (Tapestry.isNull(_variant))
+ if (StringUtils.isEmpty(_variant))
continue;
return;
case LC :
- if (Tapestry.isNull(_country))
+ if (StringUtils.isEmpty(_country))
continue;
return;
@@ -140,14 +140,14 @@
// If _country is null, then we've already generated this string
// as state LCV and we can continue directly to state L
- if (Tapestry.isNull(_variant) || Tapestry.isNull(_country))
+ if (StringUtils.isEmpty(_variant) || StringUtils.isEmpty(_country))
continue;
return;
case L :
- if (Tapestry.isNull(_language))
+ if (StringUtils.isEmpty(_language))
continue;
return;
@@ -245,6 +245,6 @@
default :
return null;
- }
+}
}
}
1.3 +3 -2 jakarta-tapestry/framework/src/org/apache/tapestry/script/InputSymbolRule.java
Index: InputSymbolRule.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/script/InputSymbolRule.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InputSymbolRule.java 28 May 2003 13:41:49 -0000 1.2
+++ InputSymbolRule.java 1 Jul 2003 20:49:36 -0000 1.3
@@ -55,6 +55,7 @@
package org.apache.tapestry.script;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.IResourceResolver;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.util.xml.BaseRule;
@@ -99,7 +100,7 @@
private Class lookupClass(RuleDirectedParser parser, String className)
{
- if (Tapestry.isNull(className))
+ if (StringUtils.isEmpty(className))
return null;
try
1.4 +5 -4 jakarta-tapestry/framework/src/org/apache/tapestry/RedirectFilter.java
Index: RedirectFilter.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/RedirectFilter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RedirectFilter.java 28 May 2003 13:41:38 -0000 1.3
+++ RedirectFilter.java 1 Jul 2003 20:49:36 -0000 1.4
@@ -66,6 +66,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -100,7 +101,7 @@
{
_redirectPath = config.getInitParameter(REDIRECT_PATH_PARAM);
- if (Tapestry.isNull(_redirectPath))
+ if (StringUtils.isEmpty(_redirectPath))
_redirectPath = "/app";
if (LOG.isInfoEnabled())
@@ -132,8 +133,8 @@
// resources have a non-null servletPath. If JBossWeb 3.0.6, the servletPath is
// null and the pathInfo indicates the relative location of the resource.
- if ((Tapestry.isNull(servletPath) || servletPath.equals("/"))
- && (Tapestry.isNull(pathInfo) || pathInfo.equals("/")))
+ if ((StringUtils.isEmpty(servletPath) || servletPath.equals("/"))
+ && (StringUtils.isEmpty(pathInfo) || pathInfo.equals("/")))
{
String path = hrequest.getContextPath() + _redirectPath;
1.15 +26 -32 jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java
Index: Tapestry.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Tapestry.java 22 Jun 2003 02:55:23 -0000 1.14
+++ Tapestry.java 1 Jul 2003 20:49:36 -0000 1.15
@@ -103,20 +103,20 @@
public final static String TAG_SUPPORT_SERVICE_ATTRIBUTE =
"org.apache.tapestry.tagsupport.service";
- /**
- * Name of a request attribute used with the
- * {@link #TAGSUPPORT_SERVICE} service. The attribute
- * defines the correct servlet path for the
- * Tapestry application (which, for the odd-man-out TAGSUPPORT_SERVICE
- * may not match HttpServletRequest.getServletPath() because of
- * the use of an include.
- *
- * @since 3.0
- */
-
- public final static String TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE =
- "org.apach.tapestry.tagsupport.servlet-path";
-
+ /**
+ * Name of a request attribute used with the
+ * {@link #TAGSUPPORT_SERVICE} service. The attribute
+ * defines the correct servlet path for the
+ * Tapestry application (which, for the odd-man-out TAGSUPPORT_SERVICE
+ * may not match HttpServletRequest.getServletPath() because of
+ * the use of an include.
+ *
+ * @since 3.0
+ */
+
+ public final static String TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE =
+ "org.apach.tapestry.tagsupport.servlet-path";
+
/**
* Name of a request attribute used with the
* {@link #TAGSUPPORT_SERVICE} service. The attribute
@@ -381,6 +381,17 @@
public static final String SIMPLE_PROPERTY_NAME_PATTERN = "^_?[a-zA-Z]\\w*$";
/**
+ * Name of an application extension used as a factory for
+ * {@link org.apache.tapestry.engine.IMonitor} instances. The extension
+ * must implement {@link org.apache.tapestry.engine.IMonitorFactory}.
+ *
+ * @since 3.0
+ */
+
+ public static final String MONITOR_FACTORY_EXTENSION_NAME =
+ "org.apache.tapestry.monitor-factory";
+
+ /**
* Prevent instantiation.
*
**/
@@ -739,23 +750,6 @@
_iteratorAdaptors.register(long[].class, new LongArrayIteratorAdaptor());
_iteratorAdaptors.register(float[].class, new FloatArrayIteratorAdaptor());
_iteratorAdaptors.register(double[].class, new DoubleArrayIteratorAdaptor());
- }
-
- /**
- * Returns true if the value is null or empty (is the empty string,
- * or contains only whitespace).
- *
- **/
-
- public static boolean isNull(String value)
- {
- if (value == null)
- return true;
-
- if (value.length() == 0)
- return true;
-
- return value.trim().length() == 0;
}
/**
1.3 +79 -82 jakarta-tapestry/examples/Workbench/src/org/apache/tapestry/workbench/upload/Upload.java
Index: Upload.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/examples/Workbench/src/org/apache/tapestry/workbench/upload/Upload.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Upload.java 15 Mar 2003 21:22:29 -0000 1.2
+++ Upload.java 1 Jul 2003 20:49:36 -0000 1.3
@@ -55,8 +55,8 @@
package org.apache.tapestry.workbench.upload;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.Tapestry;
import org.apache.tapestry.form.IFormComponent;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.form.StringPropertySelectionModel;
@@ -76,89 +76,86 @@
public class Upload extends BasePage
{
- private static final String[] bytesPerLineOptions =
- new String[] { "8", "16", "24", "32", "40", "48" };
+ private static final String[] bytesPerLineOptions =
+ new String[] { "8", "16", "24", "32", "40", "48" };
- private static final String DEFAULT_BPL = "16";
+ private static final String DEFAULT_BPL = "16";
- private String bytesPerLine = DEFAULT_BPL;
- private boolean showAscii;
- private IUploadFile file;
- private IPropertySelectionModel bplModel;
-
- public void detach()
- {
- bytesPerLine = DEFAULT_BPL;
- showAscii = false;
- file = null;
-
- super.detach();
- }
-
- public void formSubmit(IRequestCycle cycle)
- {
- if (Tapestry.isNull(file.getFileName()))
- {
- IValidationDelegate delegate =
- (IValidationDelegate) getBeans().getBean("delegate");
-
- delegate.setFormComponent((IFormComponent) getComponent("inputFile"));
- delegate.record(
- "You must specify a file to upload.",
- ValidationConstraint.REQUIRED);
- return;
- }
-
- UploadResults results = (UploadResults) cycle.getPage("UploadResults");
-
- results.activate(file, showAscii, Integer.parseInt(bytesPerLine), cycle);
- }
-
- public String getBytesPerLine()
- {
- return bytesPerLine;
- }
-
- public void setBytesPerLine(String bytesPerLine)
- {
- this.bytesPerLine = bytesPerLine;
-
- fireObservedChange("bytesPerLine", bytesPerLine);
- }
-
- public boolean getShowAscii()
- {
- return showAscii;
- }
-
- public void setShowAscii(boolean showAscii)
- {
- this.showAscii = showAscii;
-
- fireObservedChange("showAscii", showAscii);
- }
-
- public IPropertySelectionModel getBytesPerLineModel()
- {
- if (bplModel == null)
- bplModel = new StringPropertySelectionModel(bytesPerLineOptions);
-
- return bplModel;
- }
-
- public IUploadFile getFile()
- {
- return file;
- }
-
- public void setFile(IUploadFile file)
- {
- this.file = file;
- }
+ private String bytesPerLine = DEFAULT_BPL;
+ private boolean showAscii;
+ private IUploadFile file;
+ private IPropertySelectionModel bplModel;
+
+ public void detach()
+ {
+ bytesPerLine = DEFAULT_BPL;
+ showAscii = false;
+ file = null;
+
+ super.detach();
+ }
+
+ public void formSubmit(IRequestCycle cycle)
+ {
+ if (StringUtils.isEmpty(file.getFileName()))
+ {
+ IValidationDelegate delegate = (IValidationDelegate) getBeans().getBean("delegate");
+
+ delegate.setFormComponent((IFormComponent) getComponent("inputFile"));
+ delegate.record("You must specify a file to upload.", ValidationConstraint.REQUIRED);
+ return;
+ }
+
+ UploadResults results = (UploadResults) cycle.getPage("UploadResults");
+
+ results.activate(file, showAscii, Integer.parseInt(bytesPerLine), cycle);
+ }
+
+ public String getBytesPerLine()
+ {
+ return bytesPerLine;
+ }
+
+ public void setBytesPerLine(String bytesPerLine)
+ {
+ this.bytesPerLine = bytesPerLine;
+
+ fireObservedChange("bytesPerLine", bytesPerLine);
+ }
+
+ public boolean getShowAscii()
+ {
+ return showAscii;
+ }
+
+ public void setShowAscii(boolean showAscii)
+ {
+ this.showAscii = showAscii;
+
+ fireObservedChange("showAscii", showAscii);
+ }
+
+ public IPropertySelectionModel getBytesPerLineModel()
+ {
+ if (bplModel == null)
+ bplModel = new StringPropertySelectionModel(bytesPerLineOptions);
+
+ return bplModel;
+ }
+
+ public IUploadFile getFile()
+ {
+ return file;
+ }
+
+ public void setFile(IUploadFile file)
+ {
+ this.file = file;
+ }
- public void setMessage(String message)
- {
+ public void setMessage(String message)
+ {
- }
+ }
}