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 2006/01/12 18:13:34 UTC
svn commit: r368410 [10/10] - in
/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry: ./ bean/
binding/ callback/ coerce/ components/ describe/ engine/ engine/state/
enhance/ error/ event/ form/ form/translator/ form/validator/ html/ link/
l...
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidField.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidField.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidField.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidField.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,20 +20,23 @@
import org.apache.tapestry.form.AbstractFormComponent;
/**
- * A {@link Form}component that creates a text field that allows for validation of user input and
- * conversion between string and object values. [ <a
- * href="../../../../../ComponentReference/ValidField.html">Component Reference </a>]
+ * A {@link Form}component that creates a text field that allows for validation
+ * of user input and conversion between string and object values. [ <a
+ * href="../../../../../ComponentReference/ValidField.html">Component Reference
+ * </a>]
* <p>
- * A ValidatingTextField uses an {@link IValidationDelegate} to track errors and an
- * {@link IValidator}to convert between strings and objects (as well as perform validations). The
- * validation delegate is shared by all validating text fields in a form, the validator may be
- * shared my multiple elements as desired.
+ * A ValidatingTextField uses an {@link IValidationDelegate} to track errors and
+ * an {@link IValidator}to convert between strings and objects (as well as
+ * perform validations). The validation delegate is shared by all validating
+ * text fields in a form, the validator may be shared my multiple elements as
+ * desired.
*
* @author Howard Lewis Ship
*/
public abstract class ValidField extends AbstractFormComponent
{
+
public abstract boolean isHidden();
public abstract boolean isDisabled();
@@ -42,7 +45,7 @@
public abstract void setValue(Object value);
- /** Parameter */
+ /** Parameter. */
public abstract String getDisplayName();
@@ -63,14 +66,12 @@
writer.attribute("type", isHidden() ? "password" : "text");
- if (isDisabled())
- writer.attribute("disabled", "disabled");
+ if (isDisabled()) writer.attribute("disabled", "disabled");
writer.attribute("name", getName());
String value = readValue();
- if (value != null)
- writer.attribute("value", value);
+ if (value != null) writer.attribute("value", value);
renderIdAttribute(writer, cycle);
@@ -80,11 +81,9 @@
IValidator validator = getValidator();
- if (validator == null)
- throw Tapestry.createRequiredParameterException(this, "validator");
+ if (validator == null) throw Tapestry.createRequiredParameterException(this, "validator");
- if (validator.isRequired())
- delegate.registerForFocus(this, ValidationConstants.REQUIRED_FIELD);
+ if (validator.isRequired()) delegate.registerForFocus(this, ValidationConstants.REQUIRED_FIELD);
validator.renderValidatorContribution(this, writer, cycle);
@@ -107,13 +106,11 @@
protected String readValue()
{
IValidator validator = getValidator();
- if (validator == null)
- throw Tapestry.createRequiredParameterException(this, "validator");
+ if (validator == null) throw Tapestry.createRequiredParameterException(this, "validator");
IValidationDelegate delegate = getForm().getDelegate();
- if (delegate.isInError())
- return delegate.getFieldInputValue();
+ if (delegate.isInError()) return delegate.getFieldInputValue();
Object value = getValue();
@@ -127,8 +124,7 @@
Object objectValue = null;
IValidator validator = getValidator();
- if (validator == null)
- throw Tapestry.createRequiredParameterException(this, "validator");
+ if (validator == null) throw Tapestry.createRequiredParameterException(this, "validator");
IValidationDelegate delegate = getForm().getDelegate();
@@ -148,4 +144,4 @@
}
public abstract IValidator getValidator();
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidMessages.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidMessages.java Thu Jan 12 09:12:21 2006
@@ -14,6 +14,7 @@
package org.apache.tapestry.valid;
+import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.tapestry.IComponent;
@@ -21,13 +22,18 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-class ValidMessages
+final class ValidMessages
{
- private final static MessageFormatter _formatter = new MessageFormatter(ValidMessages.class);
- static String noDisplayName(IComponent label, IComponent field)
+ private static final Messages MESSAGES = new MessageFormatter(ValidMessages.class);
+
+ /** @since 4.1 */
+ private ValidMessages()
{
- return _formatter.format("no-display-name", label.getExtendedId(), field.getExtendedId());
}
-}
\ No newline at end of file
+ static String noDisplayName(IComponent label, IComponent field)
+ {
+ return MESSAGES.format("no-display-name", label.getExtendedId(), field.getExtendedId());
+ }
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstraint.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -17,37 +17,35 @@
import java.io.Serializable;
/**
- * Defines an enumeration of different types of validation constraints that may be violated.
+ * Defines an enumeration of different types of validation constraints that may
+ * be violated.
*
* @author Howard Lewis Ship
*/
public class ValidationConstraint implements Serializable
{
- private static final long serialVersionUID = 371593028205311930L;
/**
- * Indicates that no value (or a value consisting only of white space) was provided for a field
- * that requires a non-null value.
+ * Indicates that no value (or a value consisting only of white space) was
+ * provided for a field that requires a non-null value.
*/
public static final ValidationConstraint REQUIRED = new ValidationConstraint("REQUIRED");
/**
- * Indicates that a non-null value was provided, but that (after removing leading and trailing
- * whitespace), the value was not long enough.
+ * Indicates that a non-null value was provided, but that (after removing
+ * leading and trailing whitespace), the value was not long enough.
*/
- public static final ValidationConstraint MINIMUM_WIDTH = new ValidationConstraint(
- "MINIMUM_WIDTH");
+ public static final ValidationConstraint MINIMUM_WIDTH = new ValidationConstraint("MINIMUM_WIDTH");
/**
- * Indicates that a non-null value was provided, but that (after removing leading and trailing
- * whitespace), the value was too long.
+ * Indicates that a non-null value was provided, but that (after removing
+ * leading and trailing whitespace), the value was too long.
*/
- public static final ValidationConstraint MAXIMUM_WIDTH = new ValidationConstraint(
- "MAXIMUM_WIDTH");
+ public static final ValidationConstraint MAXIMUM_WIDTH = new ValidationConstraint("MAXIMUM_WIDTH");
/**
* Indicates a general error in converting a String into a Date.
@@ -56,17 +54,18 @@
public static final ValidationConstraint DATE_FORMAT = new ValidationConstraint("DATE_FORMAT");
/**
- * Indicates a general error in the format of a string that is to be interpreted as a email.
+ * Indicates a general error in the format of a string that is to be
+ * interpreted as a email.
*/
public static final ValidationConstraint EMAIL_FORMAT = new ValidationConstraint("EMAIL_FORMAT");
/**
- * Indicates a general error in the format of a string that is to be interpreted as a number.
+ * Indicates a general error in the format of a string that is to be
+ * interpreted as a number.
*/
- public static final ValidationConstraint NUMBER_FORMAT = new ValidationConstraint(
- "NUMBER_FORMAT");
+ public static final ValidationConstraint NUMBER_FORMAT = new ValidationConstraint("NUMBER_FORMAT");
/**
* Indicates that the value was too small (for a Date, too early).
@@ -86,8 +85,7 @@
* @since 3.0
*/
- public static final ValidationConstraint PATTERN_MISMATCH = new ValidationConstraint(
- "PATTERN_MISMATCH");
+ public static final ValidationConstraint PATTERN_MISMATCH = new ValidationConstraint("PATTERN_MISMATCH");
/**
* Indicates a consistency error, usually between too different fields.
@@ -98,7 +96,7 @@
public static final ValidationConstraint CONSISTENCY = new ValidationConstraint("CONSISTENCY");
/**
- * Indicates that a URL is not of the correct format
+ * Indicates that a URL is not of the correct format.
*
* @since 3.0
*/
@@ -106,18 +104,20 @@
public static final ValidationConstraint URL_FORMAT = new ValidationConstraint("URL_FORMAT");
/**
- * Indicates that the URL does not use one of the specified protocols
+ * Indicates that the URL does not use one of the specified protocols.
*
* @since 3.0
*/
- public static final ValidationConstraint DISALLOWED_PROTOCOL = new ValidationConstraint(
- "DISALLOWED_PROTOCOL");
+ public static final ValidationConstraint DISALLOWED_PROTOCOL = new ValidationConstraint("DISALLOWED_PROTOCOL");
+
+ private static final long serialVersionUID = 371593028205311930L;
private final String _name;
/**
- * Protected constructor, which allows new constraints to be created as subclasses.
+ * Protected constructor, which allows new constraints to be created as
+ * subclasses.
*/
protected ValidationConstraint(String name)
@@ -129,4 +129,4 @@
{
return "ValidationConstraint[" + _name + "]";
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationDelegate.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationDelegate.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationDelegate.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationDelegate.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -28,8 +28,9 @@
import org.apache.tapestry.form.IFormComponent;
/**
- * A base implementation of {@link IValidationDelegate}that can be used as a managed bean. This
- * class is often subclassed, typically to override presentation details.
+ * A base implementation of {@link IValidationDelegate}that can be used as a
+ * managed bean. This class is often subclassed, typically to override
+ * presentation details.
*
* @author Howard Lewis Ship
* @since 1.0.5
@@ -37,6 +38,7 @@
public class ValidationDelegate implements IValidationDelegate
{
+
private static final long serialVersionUID = 6215074338439140780L;
private transient IFormComponent _currentComponent;
@@ -66,21 +68,20 @@
public void clearErrors()
{
- if (_trackings == null)
- return;
+ if (_trackings == null) return;
Iterator i = _trackings.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- FieldTracking ft = (FieldTracking) i.next();
+ FieldTracking ft = (FieldTracking)i.next();
ft.setErrorRenderer(null);
}
}
/**
- * If the form component is in error, places a <font color="red"< around it. Note: this
- * will only work on the render phase after a rewind, and will be confused if components are
- * inside any kind of loop.
+ * If the form component is in error, places a <font color="red"<
+ * around it. Note: this will only work on the render phase after a rewind,
+ * and will be confused if components are inside any kind of loop.
*/
public void writeLabelPrefix(IFormComponent component, IMarkupWriter writer, IRequestCycle cycle)
@@ -93,17 +94,17 @@
}
/**
- * Does nothing by default.
- * {@inheritDoc}
+ * Does nothing by default. {@inheritDoc}
*/
-
- public void writeLabelAttributes(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component) {
- }
- /**
+ public void writeLabelAttributes(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component)
+ {
+ }
+
+ /**
* Closes the <font> element,started by
- * {@link #writeLabelPrefix(IFormComponent,IMarkupWriter,IRequestCycle)}, if the form component
- * is in error.
+ * {@link #writeLabelPrefix(IFormComponent,IMarkupWriter,IRequestCycle)},
+ * if the form component is in error.
*/
public void writeLabelSuffix(IFormComponent component, IMarkupWriter writer, IRequestCycle cycle)
@@ -116,13 +117,14 @@
/**
* Returns the {@link IFieldTracking}for the current component, if any. The
- * {@link IFieldTracking}is usually created in {@link #record(String, ValidationConstraint)}or
- * in {@link #record(IRender, ValidationConstraint)}.
+ * {@link IFieldTracking}is usually created in
+ * {@link #record(String, ValidationConstraint)}or in
+ * {@link #record(IRender, ValidationConstraint)}.
* <p>
- * Components may be rendered multiple times, with multiple names (provided by the
- * {@link org.apache.tapestry.form.Form}, care must be taken that this method is invoked
- * <em>after</em> the Form has provided a unique {@link IFormComponent#getName()}for the
- * component.
+ * Components may be rendered multiple times, with multiple names (provided
+ * by the {@link org.apache.tapestry.form.Form}, care must be taken that
+ * this method is invoked <em>after</em> the Form has provided a unique
+ * {@link IFormComponent#getName()}for the component.
*
* @see #setFormComponent(IFormComponent)
* @return the {@link FieldTracking}, or null if the field has no tracking.
@@ -130,7 +132,7 @@
protected FieldTracking getComponentTracking()
{
- return (FieldTracking) _trackingMap.get(_currentComponent.getName());
+ return (FieldTracking)_trackingMap.get(_currentComponent.getName());
}
public void setFormComponent(IFormComponent component)
@@ -158,8 +160,7 @@
public List getFieldTracking()
{
- if (Tapestry.size(_trackings) == 0)
- return null;
+ if (Tapestry.size(_trackings) == 0) return null;
return Collections.unmodifiableList(_trackings);
}
@@ -184,7 +185,8 @@
/**
* Invokes {@link #record(String, ValidationConstraint)}, or
* {@link #record(IRender, ValidationConstraint)}if the
- * {@link ValidatorException#getErrorRenderer() error renderer property}is not null.
+ * {@link ValidatorException#getErrorRenderer() error renderer property}is
+ * not null.
*/
public void record(ValidatorException ex)
@@ -193,13 +195,12 @@
if (errorRenderer == null)
record(ex.getMessage(), ex.getConstraint());
- else
- record(errorRenderer, ex.getConstraint());
+ else record(errorRenderer, ex.getConstraint());
}
/**
- * Invokes {@link #record(IRender, ValidationConstraint)}, after wrapping the message parameter
- * in a {@link RenderString}.
+ * Invokes {@link #record(IRender, ValidationConstraint)}, after wrapping
+ * the message parameter in a {@link RenderString}.
*/
public void record(String message, ValidationConstraint constraint)
@@ -208,14 +209,16 @@
}
/**
- * Records error information about the currently selected component, or records unassociated
- * (with any field) errors.
+ * Records error information about the currently selected component, or
+ * records unassociated (with any field) errors.
* <p>
- * Currently, you may have at most one error per <em>field</em> (note the difference between
- * field and component), but any number of unassociated errors.
+ * Currently, you may have at most one error per <em>field</em> (note the
+ * difference between field and component), but any number of unassociated
+ * errors.
* <p>
- * Subclasses may override the default error message (based on other factors, such as the field
- * and constraint) before invoking this implementation.
+ * Subclasses may override the default error message (based on other
+ * factors, such as the field and constraint) before invoking this
+ * implementation.
*
* @since 1.0.9
*/
@@ -248,9 +251,9 @@
}
/**
- * Finds or creates the field tracking for the {@link #setFormComponent(IFormComponent)}
- * current component. If no current component, an unassociated error is created and
- * returned.
+ * Finds or creates the field tracking for the
+ * {@link #setFormComponent(IFormComponent)} current component. If no
+ * current component, an unassociated error is created and returned.
*
* @since 3.0
*/
@@ -290,8 +293,7 @@
* Does nothing. Override in a subclass to decoreate fields.
*/
- public void writePrefix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component,
- IValidator validator)
+ public void writePrefix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator)
{
}
@@ -299,18 +301,18 @@
* Does nothing. Override in a subclass to decorate fields.
*/
- public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle,
- IFormComponent component, IValidator validator)
+ public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component,
+ IValidator validator)
{
}
/**
- * Default implementation; if the current field is in error, then a suffix is written. The
- * suffix is: <code>&nbsp;<font color="red">**</font></code>.
+ * Default implementation; if the current field is in error, then a suffix
+ * is written. The suffix is:
+ * <code>&nbsp;<font color="red">**</font></code>.
*/
- public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component,
- IValidator validator)
+ public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator)
{
if (isInError())
{
@@ -330,31 +332,31 @@
/**
* A convienience, as most pages just show the first error on the page.
* <p>
- * As of release 1.0.9, this returns an instance of {@link IRender}, not a {@link String}.
+ * As of release 1.0.9, this returns an instance of {@link IRender}, not a
+ * {@link String}.
*/
public IRender getFirstError()
{
- if (Tapestry.size(_trackings) == 0)
- return null;
+ if (Tapestry.size(_trackings) == 0) return null;
Iterator i = _trackings.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- IFieldTracking tracking = (IFieldTracking) i.next();
+ IFieldTracking tracking = (IFieldTracking)i.next();
- if (tracking.isInError())
- return tracking.getErrorRenderer();
+ if (tracking.isInError()) return tracking.getErrorRenderer();
}
return null;
}
/**
- * Checks to see if the field is in error. This will <em>not</em> work properly in a loop, but
- * is only used by {@link FieldLabel}. Therefore, using {@link FieldLabel}in a loop (where the
- * {@link IFormComponent}is renderred more than once) will not provide correct results.
+ * Checks to see if the field is in error. This will <em>not</em> work
+ * properly in a loop, but is only used by {@link FieldLabel}. Therefore,
+ * using {@link FieldLabel}in a loop (where the {@link IFormComponent}is
+ * renderred more than once) will not provide correct results.
*/
protected boolean isInError(IFormComponent component)
@@ -363,35 +365,33 @@
String fieldName = component.getName();
- IFieldTracking tracking = (IFieldTracking) _trackingMap.get(fieldName);
+ IFieldTracking tracking = (IFieldTracking)_trackingMap.get(fieldName);
return tracking != null && tracking.isInError();
}
/**
- * Returns a {@link List}of {@link IFieldTracking}s. This is the master list of trackings,
- * except that it omits and trackings that are not associated with a particular field. May
- * return an empty list, or null.
+ * Returns a {@link List}of {@link IFieldTracking}s. This is the master
+ * list of trackings, except that it omits and trackings that are not
+ * associated with a particular field. May return an empty list, or null.
* <p>
- * Order is not determined, though it is likely the order in which components are laid out on in
- * the template (this is subject to change).
+ * Order is not determined, though it is likely the order in which
+ * components are laid out on in the template (this is subject to change).
*/
public List getAssociatedTrackings()
{
int count = Tapestry.size(_trackings);
- if (count == 0)
- return null;
+ if (count == 0) return null;
List result = new ArrayList(count);
- for (int i = 0; i < count; i++)
+ for(int i = 0; i < count; i++)
{
- IFieldTracking tracking = (IFieldTracking) _trackings.get(i);
+ IFieldTracking tracking = (IFieldTracking)_trackings.get(i);
- if (tracking.getFieldName() == null)
- continue;
+ if (tracking.getFieldName() == null) continue;
result.add(tracking);
}
@@ -400,29 +400,29 @@
}
/**
- * Like {@link #getAssociatedTrackings()}, but returns only the unassociated trackings.
- * Unassociated trackings are new (in release 1.0.9), and are why interface
- * {@link IFieldTracking}is not very well named.
+ * Like {@link #getAssociatedTrackings()}, but returns only the
+ * unassociated trackings. Unassociated trackings are new (in release
+ * 1.0.9), and are why interface {@link IFieldTracking}is not very well
+ * named.
* <p>
- * The trackings are returned in an unspecified order, which (for the moment, anyway) is the
- * order in which they were added (this could change in the future, or become more concrete).
+ * The trackings are returned in an unspecified order, which (for the
+ * moment, anyway) is the order in which they were added (this could change
+ * in the future, or become more concrete).
*/
public List getUnassociatedTrackings()
{
int count = Tapestry.size(_trackings);
- if (count == 0)
- return null;
+ if (count == 0) return null;
List result = new ArrayList(count);
- for (int i = 0; i < count; i++)
+ for(int i = 0; i < count; i++)
{
- IFieldTracking tracking = (IFieldTracking) _trackings.get(i);
+ IFieldTracking tracking = (IFieldTracking)_trackings.get(i);
- if (tracking.getFieldName() != null)
- continue;
+ if (tracking.getFieldName() != null) continue;
result.add(tracking);
}
@@ -435,14 +435,13 @@
List result = new ArrayList();
Iterator i = _trackings.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- IFieldTracking tracking = (IFieldTracking) i.next();
+ IFieldTracking tracking = (IFieldTracking)i.next();
IRender errorRenderer = tracking.getErrorRenderer();
- if (errorRenderer != null)
- result.add(errorRenderer);
+ if (errorRenderer != null) result.add(errorRenderer);
}
return result;
@@ -460,8 +459,8 @@
}
/**
- * Returns the focus field, or null if no form components registered for focus (i.e., they were
- * all disabled).
+ * Returns the focus field, or null if no form components registered for
+ * focus (i.e., they were all disabled).
*/
public String getFocusField()
@@ -469,4 +468,4 @@
return _focusField;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidationStrings.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -24,38 +24,40 @@
*/
public final class ValidationStrings
{
+
public static final String REQUIRED_FIELD = "field-is-required";
public static final String INVALID_DATE = "invalid-date-format";
public static final String INVALID_NUMBER = "invalid-numeric-format";
public static final String INVALID_EMAIL = "invalid-email-format";
-
+
public static final String REGEX_MISMATCH = "regex-mismatch";
-
+
public static final String VALUE_TOO_SHORT = "field-too-short";
public static final String VALUE_TOO_LONG = "field-too-long";
-
+
public static final String VALUE_TOO_SMALL = "number-too-small";
public static final String VALUE_TOO_LARGE = "number-too-large";
-
+
public static final String DATE_TOO_EARLY = "date-too-early";
public static final String DATE_TOO_LATE = "date-too-late";
-
+
public static final String INVALID_FIELD_EQUALITY = "invalid-field-equality";
-
+
private static final String RESOURCE_BUNDLE = ValidationStrings.class.getName();
-
+
+ private ValidationStrings()
+ {
+ // Disable construction
+ }
+
/**
- * Fetches the appropriate validation message pattern from the appropriate localized resource.
- * This method should be called with the locale of the current request.
+ * Fetches the appropriate validation message pattern from the appropriate
+ * localized resource. This method should be called with the locale of the
+ * current request.
*/
public static String getMessagePattern(String key, Locale locale)
{
return ResourceBundle.getBundle(RESOURCE_BUNDLE, locale).getString(key);
- }
-
- private ValidationStrings()
- {
- // Disable construction
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorBinding.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorBinding.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorBinding.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorBinding.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,11 +20,12 @@
import org.apache.tapestry.coerce.ValueConverter;
/**
- * Implementation of {@link IBinding} that provides {@link org.apache.tapestry.valid.IValidator}
- * instances based on a validator bean descriptor. The descriptor is of the form
- * "type[,properties]". The types are values such as "string", "date" or "number" defined in the
- * tapestry.valid.Validators configuration point. The properties are a properties initialization
- * string.
+ * Implementation of {@link IBinding} that provides
+ * {@link org.apache.tapestry.valid.IValidator} instances based on a
+ * validator bean descriptor. The descriptor is of the form "type[,properties]".
+ * The types are values such as "string", "date" or "number" defined in the
+ * tapestry.valid.Validators configuration point. The properties are a
+ * properties initialization string.
*
* @author Howard M. Lewis Ship
* @since 4.0
@@ -33,10 +34,10 @@
*/
public class ValidatorBinding extends AbstractBinding
{
+
private final IValidator _validator;
- public ValidatorBinding(String description, ValueConverter valueConverter, Location location,
- IValidator validator)
+ public ValidatorBinding(String description, ValueConverter valueConverter, Location location, IValidator validator)
{
super(description, valueConverter, location);
@@ -50,4 +51,4 @@
return _validator;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorBindingFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorBindingFactory.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorBindingFactory.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorBindingFactory.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -22,8 +22,8 @@
import org.apache.tapestry.binding.AbstractBindingFactory;
/**
- * Uses the tapestry.valid.ValidatorBeanFactory service to obtain configuration IValidator
- * instances.
+ * Uses the tapestry.valid.ValidatorBeanFactory service to obtain configuration
+ * IValidator instances.
*
* @author Howard M. Lewis Ship
* @since 4.0
@@ -31,6 +31,7 @@
*/
public class ValidatorBindingFactory extends AbstractBindingFactory
{
+
private BeanFactory _validatorBeanFactory;
public void setValidatorBeanFactory(BeanFactory validatorBeanFactory)
@@ -39,24 +40,22 @@
}
/**
- * Creates and returns a {@link ValidatorBinding}. Interprets the path as a bean initializer,
- * used to locate a particular type of validator and a particular configuration of its
- * properties.
+ * Creates and returns a {@link ValidatorBinding}. Interprets the path as a
+ * bean initializer, used to locate a particular type of validator and a
+ * particular configuration of its properties.
*/
- public IBinding createBinding(IComponent root, String bindingDescription, String expression,
- Location location)
+ public IBinding createBinding(IComponent root, String bindingDescription, String expression, Location location)
{
try
{
- IValidator validator = (IValidator) _validatorBeanFactory.get(expression);
+ IValidator validator = (IValidator)_validatorBeanFactory.get(expression);
- return new ValidatorBinding(bindingDescription, getValueConverter(), location,
- validator);
+ return new ValidatorBinding(bindingDescription, getValueConverter(), location, validator);
}
catch (Exception ex)
{
throw new ApplicationRuntimeException(ex.getMessage(), location, ex);
}
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorException.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorException.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/ValidatorException.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,20 +23,21 @@
* @since 1.0.8
*/
-public class ValidatorException extends Exception
-{
+public class ValidatorException extends Exception {
+
private static final long serialVersionUID = 2451683137746501377L;
- private IRender _errorRenderer;
+ private final IRender _errorRenderer;
- private ValidationConstraint _constraint;
+ private final ValidationConstraint _constraint;
public ValidatorException(String errorMessage)
{
this(errorMessage, null, null);
}
- public ValidatorException(String errorMessage, ValidationConstraint constraint)
+ public ValidatorException(String errorMessage,
+ ValidationConstraint constraint)
{
this(errorMessage, null, constraint);
}
@@ -45,16 +46,17 @@
* Creates a new instance.
*
* @param errorMessage
- * the default error message to be used (this may be overriden by the
- * {@link IValidationDelegate})
+ * the default error message to be used (this may be overriden by
+ * the {@link IValidationDelegate})
* @param errorRenderer
- * to use to render the error message (may be null). This is used with custom
- * validators that create renderers that produce rich markup (such as icons or links
- * to help pages). Such renderes are expected to implement a <code>toString()</code>
- * that returns a simple error message (without any markup).
+ * to use to render the error message (may be null). This is used
+ * with custom validators that create renderers that produce rich
+ * markup (such as icons or links to help pages). Such renderes
+ * are expected to implement a <code>toString()</code> that
+ * returns a simple error message (without any markup).
* @param constraint
- * a validation constraint that has been compromised, or null if no constraint is
- * applicable
+ * a validation constraint that has been compromised, or null if
+ * no constraint is applicable
*/
public ValidatorException(String errorMessage, IRender errorRenderer,
@@ -81,4 +83,4 @@
{
return _errorRenderer;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/LocalizedWebContextResourceFinder.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/LocalizedWebContextResourceFinder.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/LocalizedWebContextResourceFinder.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/LocalizedWebContextResourceFinder.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@
public class LocalizedWebContextResourceFinder
{
+
private WebContext _context;
public LocalizedWebContextResourceFinder(WebContext context)
@@ -36,11 +37,12 @@
}
/**
- * Resolves the resource, returning a path representing the closest match (with respect to the
- * provided locale). Returns null if no match.
+ * Resolves the resource, returning a path representing the closest match
+ * (with respect to the provided locale). Returns null if no match.
* <p>
- * The provided path is split into a base path and a suffix (at the last period character). The
- * locale will provide different suffixes to the base path and the first match is returned.
+ * The provided path is split into a base path and a suffix (at the last
+ * period character). The locale will provide different suffixes to the base
+ * path and the first match is returned.
*/
public LocalizedResource resolve(String contextPath, Locale locale)
@@ -48,20 +50,21 @@
int dotx = contextPath.lastIndexOf('.');
String basePath;
String suffix;
- if (dotx >= 0) {
- basePath = contextPath.substring(0, dotx);
- suffix = contextPath.substring(dotx);
+ if (dotx >= 0)
+ {
+ basePath = contextPath.substring(0, dotx);
+ suffix = contextPath.substring(dotx);
}
else
{
- // Resource without extension
- basePath = contextPath;
- suffix = "";
+ // Resource without extension
+ basePath = contextPath;
+ suffix = "";
}
LocalizedNameGenerator generator = new LocalizedNameGenerator(basePath, locale, suffix);
- while (generator.more())
+ while(generator.more())
{
String candidatePath = generator.next();
@@ -76,4 +79,4 @@
{
return _context.getResource(path) != null;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebActivator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebActivator.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebActivator.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebActivator.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -17,13 +17,16 @@
import org.apache.tapestry.describe.Describable;
/**
- * A wrapper around a {@link javax.servlet.http.HttpServlet} or {@link *
+ * A wrapper around a {@link javax.servlet.http.HttpServlet} or
* {@link javax.portlet.Portlet}.
+ * <p>
+ * A better name for this would have been <em>entry point</em>.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface WebActivator extends InitializationParameterHolder, Describable
{
- public String getActivatorName();
-}
\ No newline at end of file
+
+ String getActivatorName();
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContext.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContext.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContext.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContext.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -19,23 +19,26 @@
import org.apache.tapestry.describe.Describable;
/**
- * A representation of a set of servlets (or portlets) packaged together as a web application
- * archive. Attributes stored within the context are global to all 'lets (but not distributed across
- * a server cluster).
+ * A representation of a set of servlets (or portlets) packaged together as a
+ * web application archive. Attributes stored within the context are global to
+ * all 'lets (but not distributed across a server cluster).
*
* @author Howard M. Lewis Ship
*/
public interface WebContext extends AttributeHolder, InitializationParameterHolder, Describable
{
+
/**
- * Returns a URL to the resource that is mapped to a specified path. The path must begin with a
- * "/" and is interpreted as relative to the current context root.
+ * Returns a URL to the resource that is mapped to a specified path. The
+ * path must begin with a "/" and is interpreted as relative to the current
+ * context root.
*/
- public URL getResource(String path);
+ URL getResource(String path);
/**
- * Returns the MIME type of the specified file, or null if the MIME type is not known.
+ * Returns the MIME type of the specified file, or null if the MIME type is
+ * not known.
*/
- public String getMimeType(String resourcePath);
-}
\ No newline at end of file
+ String getMimeType(String resourcePath);
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContextResource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContextResource.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContextResource.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContextResource.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -22,8 +22,8 @@
import org.apache.hivemind.util.LocalizedResource;
/**
- * Implementation of {@link org.apache.hivemind.Resource}for resources found within a
- * {@link org.apache.tapestry.web.WebContext}.
+ * Implementation of {@link org.apache.hivemind.Resource}for resources found
+ * within a {@link org.apache.tapestry.web.WebContext}.
*
* @author Howard Lewis Ship
* @since 4.0
@@ -31,6 +31,7 @@
public class WebContextResource extends AbstractResource
{
+
private WebContext _context;
public WebContextResource(WebContext context, String path)
@@ -57,17 +58,14 @@
String path = getPath();
LocalizedResource localizedResource = finder.resolve(path, locale);
- if (localizedResource == null)
- return null;
+ if (localizedResource == null) return null;
String localizedPath = localizedResource.getResourcePath();
Locale pathLocale = localizedResource.getResourceLocale();
- if (localizedPath == null)
- return null;
+ if (localizedPath == null) return null;
- if (path.equals(localizedPath))
- return this;
+ if (path.equals(localizedPath)) return this;
return new WebContextResource(_context, localizedPath, pathLocale);
}
@@ -92,4 +90,4 @@
return new WebContextResource(_context, path);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebMessages.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebMessages.java Thu Jan 12 09:12:21 2006
@@ -14,6 +14,7 @@
package org.apache.tapestry.web;
+import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.tapestry.util.ContentType;
@@ -21,47 +22,53 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-class WebMessages
+final class WebMessages
{
- private final static MessageFormatter _formatter = new MessageFormatter(WebMessages.class);
+
+ private static final Messages MESSAGES = new MessageFormatter(WebMessages.class);
+
+ /** @since 4.1 */
+ private WebMessages()
+ {
+ }
static String streamOpenError(ContentType contentType, Throwable cause)
{
- return _formatter.format("stream-open-error", contentType, cause);
+ return MESSAGES.format("stream-open-error", contentType, cause);
}
static String errorGettingResource(String path, Throwable ex)
{
- return _formatter.format("error-getting-resource", path, ex);
+ return MESSAGES.format("error-getting-resource", path, ex);
}
static String unableToFindDispatcher(String url)
{
- return _formatter.format("unable-to-find-dispatcher", url);
+ return MESSAGES.format("unable-to-find-dispatcher", url);
}
static String unableToForward(String url, Throwable cause)
{
- return _formatter.format("unable-to-forward", url, cause);
+ return MESSAGES.format("unable-to-forward", url, cause);
}
static String unableToRedirect(String url, Throwable cause)
{
- return _formatter.format("unable-to-redirect", url, cause);
+ return MESSAGES.format("unable-to-redirect", url, cause);
}
static String writerOpenError(ContentType contentType, Throwable cause)
{
- return _formatter.format("writer-open-error", contentType, cause);
+ return MESSAGES.format("writer-open-error", contentType, cause);
}
static String resetFailed(Throwable cause)
{
- return _formatter.format("reset-failed", cause);
+ return MESSAGES.format("reset-failed", cause);
}
static String contentTypeUnchanged(ContentType existing, ContentType requested)
{
- return _formatter.format("content-type-unchanged", existing, requested);
+ return MESSAGES.format("content-type-unchanged", existing, requested);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebRequest.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebRequest.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebRequest.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebRequest.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -21,175 +21,186 @@
import org.apache.tapestry.describe.Describable;
/**
- * Contains information about the current request, including URLs, schemes, parameters, properties
- * and attributes. This is essentially a generic version of
- * {@link javax.servlet.http.HttpServletRequest}. In some cases, certain methods will be
- * unsupported in some implementations (such as {@link #getHeader(String)} for Portlet Tapestry).
+ * Contains information about the current request, including URLs, schemes,
+ * parameters, properties and attributes. This is essentially a generic version
+ * of {@link javax.servlet.http.HttpServletRequest}. In some cases, certain
+ * methods will be unsupported in some implementations (such as
+ * {@link #getHeader(String)} for Portlet Tapestry).
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface WebRequest extends AttributeHolder, Describable
{
+
/**
- * Returns the names of all query parameters for this request. Note that this may return an
- * empty list if an HTML form submission uploads files (with a request encoding of
- * multipart/form-data). Accessing query parameters in such an event requires parsing of the
- * request input stream.
+ * Returns the names of all query parameters for this request. Note that
+ * this may return an empty list if an HTML form submission uploads files
+ * (with a request encoding of multipart/form-data). Accessing query
+ * parameters in such an event requires parsing of the request input stream.
*
* @returns List of Strings, in ascending alphabetical order
*/
- public List getParameterNames();
+ List getParameterNames();
/**
- * Returns a parameter value. If the parameter was submitted with multiple values, then the
- * first submitted value is returned. May return null if no parameter was submitted with the
- * given name.
+ * Returns a parameter value. If the parameter was submitted with multiple
+ * values, then the first submitted value is returned. May return null if no
+ * parameter was submitted with the given name.
*
* @param parameterName
* name of parameter to obtain
- * @return the corresponding value, or null if a value for the parameter was not submitted in
- * the request
+ * @return the corresponding value, or null if a value for the parameter was
+ * not submitted in the request
* @see #getParameterValues(String)
*/
- public String getParameterValue(String parameterName);
+ String getParameterValue(String parameterName);
/**
- * Returns all parameter values for a particular parameter name. May return null.
+ * Returns all parameter values for a particular parameter name. May return
+ * null.
* <p>
* The caller should <em>not modify</em> the returned value.
*
* @param parameterName
* name of parameter to obtain
- * @return the corresponding values, or null if no values for the parameter were submitted in
- * the request
+ * @return the corresponding values, or null if no values for the parameter
+ * were submitted in the request
* @see #getParameterValue(String)
*/
- public String[] getParameterValues(String parameterName);
+ String[] getParameterValues(String parameterName);
/**
- * Returns the portion of the request URI that indicates the context of the request. The context
- * path always comes first in a request URI. The path starts with a "/" character but does not
- * end with a "/" character.
+ * Returns the portion of the request URI that indicates the context of the
+ * request. The context path always comes first in a request URI. The path
+ * starts with a "/" character but does not end with a "/" character.
*/
- public String getContextPath();
+ String getContextPath();
/**
- * Returns the current {@link WebSession}associated with this request, possibly creating it if
- * it does not already exist. If create is false and the request has no valid session, this
- * method returns null. To make sure the session is properly maintained, you must call this
- * method <em>before</em> the response is committed.
+ * Returns the current {@link WebSession}associated with this request,
+ * possibly creating it if it does not already exist. If create is false and
+ * the request has no valid session, this method returns null. To make sure
+ * the session is properly maintained, you must call this method
+ * <em>before</em> the response is committed.
*
* @param create
- * if true, the session will be created and returned if it does not already exist
+ * if true, the session will be created and returned if it does
+ * not already exist
* @returns The session, or null if it does not exist (and create is false)
*/
- public WebSession getSession(boolean create);
+ WebSession getSession(boolean create);
/**
- * Returns the name of the scheme used to make this request. For example, http, https, or ftp.
- * Different schemes have different rules for constructing URLs, as noted in RFC 1738.
+ * Returns the name of the scheme used to make this request. For example,
+ * http, https, or ftp. Different schemes have different rules for
+ * constructing URLs, as noted in RFC 1738.
*/
- public String getScheme();
+ String getScheme();
/**
- * Returns the host name of the server that received the request. Note that behind a firewall,
- * this may be obscured (i.e., it may be the name of the firewall server, which is not
- * necessarily visible to clients outside the firewall).
+ * Returns the host name of the server that received the request. Note that
+ * behind a firewall, this may be obscured (i.e., it may be the name of the
+ * firewall server, which is not necessarily visible to clients outside the
+ * firewall).
*
* @see org.apache.tapestry.request.IRequestDecoder
*/
- public String getServerName();
+ String getServerName();
/**
* Returns the port number on which this request was received.
*/
- public int getServerPort();
+ int getServerPort();
/**
- * Returns the path portion of the request which triggered this request. Query parameters,
- * scheme, server and port are omitted.
+ * Returns the path portion of the request which triggered this request.
+ * Query parameters, scheme, server and port are omitted.
* <p>
* Note: portlets do not know their request URI.
*/
- public String getRequestURI();
+ String getRequestURI();
/**
- * Redirects to the indicated URL. If the URL is local, then a forward occurs. Otherwise, a
- * client side redirect is returned to the client browser.
+ * Redirects to the indicated URL. If the URL is local, then a forward
+ * occurs. Otherwise, a client side redirect is returned to the client
+ * browser.
*/
- public void forward(String URL);
+ void forward(String URL);
/**
- * Returns the path of the resource which activated this request (this is the equivalent of the
- * servlet path for a servlet request). The activation path will not end with a slash.
+ * Returns the path of the resource which activated this request (this is
+ * the equivalent of the servlet path for a servlet request). The activation
+ * path will not end with a slash.
*
- * @returns the full servlet path (for servlet requests), or a blank string (for portlet
- * requests).
+ * @returns the full servlet path (for servlet requests), or a blank string
+ * (for portlet requests).
*/
- public String getActivationPath();
+ String getActivationPath();
/**
- * Return any additional path info beyond the servlet path itself. Path info, if non-null,
- * begins with a path.
+ * Return any additional path info beyond the servlet path itself. Path
+ * info, if non-null, begins with a path.
*
* @return path info, or null if no path info
*/
- public String getPathInfo();
+ String getPathInfo();
/**
- * Returns the preferred locale to which content should be localized, as specified by the client
- * or by the container. May return null.
+ * Returns the preferred locale to which content should be localized, as
+ * specified by the client or by the container. May return null.
*/
- public Locale getLocale();
+ Locale getLocale();
/**
* Returns the value of the specified request header.
*
* @param name
* the name of the header to retrieve
- * @return the header value as a string, or null if the header is not in the request.
+ * @return the header value as a string, or null if the header is not in the
+ * request.
*/
- public String getHeader(String name);
+ String getHeader(String name);
/**
- * Returns the login of the user making this request, if the user has been authenticated, or
- * null if the user has not been authenticated.
+ * Returns the login of the user making this request, if the user has been
+ * authenticated, or null if the user has not been authenticated.
*
- * @return a String specifying the login of the user making this request, or null if the user
- * login is not known.
+ * @return a String specifying the login of the user making this request, or
+ * null if the user login is not known.
*/
- public String getRemoteUser();
+ String getRemoteUser();
/**
- * Returns a java.security.Principal object containing the name of the current authenticated
- * user.
+ * Returns a java.security.Principal object containing the name of the
+ * current authenticated user.
*
- * @return a java.security.Principal containing the name of the user making this request, or
- * null if the user has not been authenticated.
+ * @return a java.security.Principal containing the name of the user making
+ * this request, or null if the user has not been authenticated.
*/
- public Principal getUserPrincipal();
+ Principal getUserPrincipal();
/**
- * * Returns a boolean indicating whether the authenticated user is included in the specified
- * logical "role". Roles and role membership can be defined using deployment descriptors. If the
- * user has not been authenticated, the method returns false.
+ * * Returns a boolean indicating whether the authenticated user is included
+ * in the specified logical "role". Roles and role membership can be defined
+ * using deployment descriptors. If the user has not been authenticated, the
+ * method returns false.
*
* @param role
* a String specifying the name of the role
- * @return a boolean indicating whether the user making this request belongs to a given role;
- * false if the user has not been authenticated.
+ * @return a boolean indicating whether the user making this request belongs
+ * to a given role; false if the user has not been authenticated.
*/
- public boolean isUserInRole(String role);
-}
\ No newline at end of file
+ boolean isUserInRole(String role);
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebResponse.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebResponse.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebResponse.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebResponse.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -21,58 +21,63 @@
import org.apache.tapestry.util.ContentType;
/**
- * Controls the response to the client, and specifically allows for creating the output stream (or
- * print writer) to which content is sent. This is essentially a generic version of
- * {@link javax.servlet.http.HttpServletResponse}. Some operations may be unsupported in some
- * implementations (for example, the portlet implementation can't handle any of the setHeader
- * methods).
+ * Controls the response to the client, and specifically allows for creating the
+ * output stream (or print writer) to which content is sent. This is essentially
+ * a generic version of {@link javax.servlet.http.HttpServletResponse}. Some
+ * operations may be unsupported in some implementations (for example, the
+ * portlet implementation can't handle any of the setHeader methods).
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface WebResponse
{
+
/**
- * Returns a output stream to which output should be sent. This method should only be invoked
- * once on a response.
+ * Returns a output stream to which output should be sent. This method
+ * should only be invoked once on a response.
*
* @return the output stream, configured for the given type.
*/
- public OutputStream getOutputStream(ContentType contentType) throws IOException;
+ OutputStream getOutputStream(ContentType contentType)
+ throws IOException;
/**
- * Returns a {@link PrintWriter} to which output should be sent. This method should be invoked
- * once on a response. A second call is expected to be so that an exception page can be
- * rendered, and the underlying request data is reset.
+ * Returns a {@link PrintWriter} to which output should be sent. This method
+ * should be invoked once on a response. A second call is expected to be so
+ * that an exception page can be rendered, and the underlying request data
+ * is reset.
*/
- public PrintWriter getPrintWriter(ContentType contentType) throws IOException;
+ PrintWriter getPrintWriter(ContentType contentType)
+ throws IOException;
/**
- * Encodes a URL, which adds information to the URL needed to ensure that the request triggered
- * by the URL will be associated with the current session (if any). In most cases, the string is
- * returned unchanged.
+ * Encodes a URL, which adds information to the URL needed to ensure that
+ * the request triggered by the URL will be associated with the current
+ * session (if any). In most cases, the string is returned unchanged.
*/
- public String encodeURL(String url);
+ String encodeURL(String url);
/**
- * Resets any buffered content. This may be used after an error to radically change what the
- * output will be.
+ * Resets any buffered content. This may be used after an error to radically
+ * change what the output will be.
*/
- public void reset();
+ void reset();
- public void setContentLength(int contentLength);
+ void setContentLength(int contentLength);
/**
- * Returns a value to be prefixed or suffixed with any client-side JavaScript elements
- * (variables and function names) to ensure that they are unique with the context of the entire
- * page. For servlets, this is the empty string.
+ * Returns a value to be prefixed or suffixed with any client-side
+ * JavaScript elements (variables and function names) to ensure that they
+ * are unique with the context of the entire page. For servlets, this is the
+ * empty string.
*/
- public String getNamespace();
+ String getNamespace();
/**
* Sets a response header as a date.
@@ -82,7 +87,7 @@
* @param date
* the date value to set, in milliseconds since the epoch
*/
- public void setDateHeader(String name, long date);
+ void setDateHeader(String name, long date);
/**
* Sets a response header as a string.
@@ -93,7 +98,7 @@
* the value for the named header
*/
- public void setHeader(String name, String value);
+ void setHeader(String name, String value);
/**
* Sets a response header with the given name and integer value.
@@ -103,16 +108,17 @@
* @param value
* the value for the named header
*/
- public void setIntHeader(String name, int value);
+ void setIntHeader(String name, int value);
/**
* Sets the status code for this response.
*/
- public void setStatus(int status);
+ void setStatus(int status);
/**
* Sends an error response.
*/
- public void sendError(int statusCode, String message) throws IOException;
-}
\ No newline at end of file
+ void sendError(int statusCode, String message)
+ throws IOException;
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebSession.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebSession.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebSession.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebSession.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -24,19 +24,21 @@
*/
public interface WebSession extends AttributeHolder, Describable
{
+
/**
- * Returns a unique string identifier used to identify the session. This value is provided by
- * the container, and is typically incorporated into URLs, or stored as a HTTP cookie.
+ * Returns a unique string identifier used to identify the session. This
+ * value is provided by the container, and is typically incorporated into
+ * URLs, or stored as a HTTP cookie.
*
* @see org.apache.tapestry.web.WebResponse#encodeURL(String).
*/
- public String getId();
+ String getId();
/**
- * Returns true if the client does not yet know about the session or if the client chooses not
- * to join the session.
+ * Returns true if the client does not yet know about the session or if the
+ * client chooses not to join the session.
*/
- public boolean isNew();
+ boolean isNew();
/**
* Invalidates this session then unbinds any objects bound to it.
@@ -45,5 +47,5 @@
* if the session is already invalidated.
*/
- public void invalidate();
-}
\ No newline at end of file
+ void invalidate();
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebUtils.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebUtils.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebUtils.java Thu Jan 12 09:12:21 2006
@@ -25,11 +25,18 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class WebUtils
+public final class WebUtils
{
+
+ /** @since 4.1 */
+
+ private WebUtils()
+ {
+ }
+
/**
- * Converts an Enumeration of Strings into an unmodifiable List of Strings, sorted into
- * ascending order.
+ * Converts an Enumeration of Strings into an unmodifiable List of Strings,
+ * sorted into ascending order.
*/
public static List toSortedList(Enumeration e)
@@ -37,15 +44,13 @@
Defense.notNull(e, "e");
List list = new ArrayList();
- while (e.hasMoreElements())
+ while(e.hasMoreElements())
list.add(e.nextElement());
- if (list.isEmpty())
- return Collections.EMPTY_LIST;
+ if (list.isEmpty()) return Collections.EMPTY_LIST;
Collections.sort(list);
return Collections.unmodifiableList(list);
}
-
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/AbstractPostfield.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/AbstractPostfield.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/AbstractPostfield.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/AbstractPostfield.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -19,17 +19,19 @@
import org.apache.tapestry.form.AbstractFormComponent;
/**
- * A base class for building components that correspond to WML postfield elements. All such
- * components must be wrapped (directly or indirectly) by a {@link Go}component.
+ * A base class for building components that correspond to WML postfield
+ * elements. All such components must be wrapped (directly or indirectly) by a
+ * {@link Go}component.
*
* @author David Solis
* @since 3.0
*/
-public abstract class AbstractPostfield extends AbstractFormComponent
-{
+public abstract class AbstractPostfield extends AbstractFormComponent {
+
/**
- * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+ * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter,
+ * org.apache.tapestry.IRequestCycle)
*/
protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
{
@@ -38,7 +40,8 @@
writer.attribute("name", getName());
String varName = getVarName();
- writer.attributeRaw("value", varName != null ? getEncodedVarName(varName) : "");
+ writer.attributeRaw("value",
+ varName != null ? getEncodedVarName(varName) : "");
renderInformalParameters(writer, cycle);
@@ -61,4 +64,4 @@
{
getBinding("value").setObject(value);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/GoLinkRenderer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/GoLinkRenderer.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/GoLinkRenderer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/GoLinkRenderer.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,20 +18,20 @@
import org.apache.tapestry.link.ILinkRenderer;
/**
- * A subclass of {@link org.apache.tapestry.link.DefaultLinkRenderer} for
- * the WML Go element.
- *
- * @author David Solis
- * @since 3.0
- **/
+ * A subclass of {@link org.apache.tapestry.link.DefaultLinkRenderer} for the
+ * WML Go element.
+ *
+ * @author David Solis
+ * @since 3.0
+ */
public class GoLinkRenderer extends DefaultLinkRenderer
{
- /**
- * A singleton for the go link.
- **/
+ /**
+ * A singleton for the go link.
+ */
- public static final ILinkRenderer SHARED_INSTANCE = new GoLinkRenderer();
+ public static final ILinkRenderer SHARED_INSTANCE = new GoLinkRenderer();
public String getElement()
{
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Image.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Image.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Image.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Image.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,19 +20,20 @@
import org.apache.tapestry.IRequestCycle;
/**
- * The Image component indicates that an image is to be included in the text flow. Image layout is done within the
- * context of normal text layout.
- *
- * @author David Solis
- * @since 3.0
- *
- **/
+ * The Image component indicates that an image is to be included in the text
+ * flow. Image layout is done within the context of normal text layout.
+ *
+ * @author David Solis
+ * @since 3.0
+ */
public abstract class Image extends AbstractComponent
{
+
/**
- * @see org.apache.tapestry.AbstractComponent#renderComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
- **/
+ * @see org.apache.tapestry.AbstractComponent#renderComponent(org.apache.tapestry.IMarkupWriter,
+ * org.apache.tapestry.IRequestCycle)
+ */
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
@@ -54,5 +55,5 @@
public abstract IAsset getImage();
- public abstract String getAlt();
+ public abstract String getAlt();
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Input.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Input.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Input.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Input.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -46,22 +46,18 @@
writer.attribute("name", getName());
String title = getTitle();
- if (HiveMind.isNonBlank(title))
- writer.attribute("title", title);
+ if (HiveMind.isNonBlank(title)) writer.attribute("title", title);
String format = getFormat();
- if (HiveMind.isNonBlank(format))
- writer.attribute("format", format);
+ if (HiveMind.isNonBlank(format)) writer.attribute("format", format);
boolean emptyok = isEmptyok();
- if (emptyok != false)
- writer.attribute("emptyok", emptyok);
+ if (emptyok) writer.attribute("emptyok", emptyok);
renderInformalParameters(writer, cycle);
String value = getValue();
- if (HiveMind.isNonBlank(value))
- writer.attribute("value", value);
+ if (HiveMind.isNonBlank(value)) writer.attribute("value", value);
writer.closeTag();
}
@@ -79,4 +75,4 @@
public abstract String getValue();
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/OptionRenderer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/OptionRenderer.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/OptionRenderer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/OptionRenderer.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,23 +18,21 @@
import org.apache.tapestry.link.ILinkRenderer;
/**
- * Implementation of {@link org.apache.tapestry.link.ILinkRenderer} for
- * the WML Option element.
- *
- * The value attribute is reserved.
- *
- * @author David Solis
- * @since 3.0
- *
- **/
+ * Implementation of {@link org.apache.tapestry.link.ILinkRenderer} for the WML
+ * Option element. The value attribute is reserved.
+ *
+ * @author David Solis
+ * @since 3.0
+ */
public class OptionRenderer extends DefaultLinkRenderer
{
- /**
- * A singleton for the option link.
- **/
- public static final ILinkRenderer SHARED_INSTANCE = new OptionRenderer();
+ /**
+ * A singleton for the option link.
+ */
+
+ public static final ILinkRenderer SHARED_INSTANCE = new OptionRenderer();
protected String getElement()
{
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Timer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Timer.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Timer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Timer.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,8 +20,9 @@
import org.apache.tapestry.IRequestCycle;
/**
- * The Timer element declares a card timer, which exposes a means of processing inactivity or idle
- * time. The timer is initialised and started at card entry and is stopped when the card is exited.
+ * The Timer element declares a card timer, which exposes a means of processing
+ * inactivity or idle time. The timer is initialised and started at card entry
+ * and is stopped when the card is exited.
*
* @author David Solis
* @since 3.0
@@ -29,6 +30,7 @@
public abstract class Timer extends AbstractComponent
{
+
/**
* @see AbstractComponent#renderComponent(IMarkupWriter, IRequestCycle)
*/
@@ -46,8 +48,7 @@
String value = getValue();
if (HiveMind.isNonBlank(value))
writer.attribute("value", value);
- else
- writer.attribute("value", "0");
+ else writer.attribute("value", "0");
renderInformalParameters(writer, cycle);
@@ -60,4 +61,4 @@
/** @since 4.0 */
public abstract String getValue();
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLCharacterTranslatorSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLCharacterTranslatorSource.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLCharacterTranslatorSource.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLCharacterTranslatorSource.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -22,46 +22,41 @@
import org.apache.tapestry.util.text.MarkupCharacterTranslator;
/**
- * The WML implementation of a character translator source.
- * Returns a WML translator that encodes everything that is non-safe.
- *
- * Some code borrowed from WMLWriter (by David Solis)
+ * The WML implementation of a character translator source. Returns a WML
+ * translator that encodes everything that is non-safe. Some code borrowed from
+ * WMLWriter (by David Solis)
*
* @author mb
* @since 4.0
*/
public class WMLCharacterTranslatorSource implements ICharacterTranslatorSource
{
- private static final String SAFE_CHARACTERS =
- "01234567890"
- + "abcdefghijklmnopqrstuvwxyz"
- + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- + "\t\n\r !\"#%'()*+,-./:;=?@[\\]^_`{|}~";
-
- private static final String[][] ENTITIES = {
- { "\"", """ },
- { "<", "<" },
- { ">", ">" },
- { "&", "&" },
- { "$", "$$" }
- };
+
+ private static final String SAFE_CHARACTERS = "01234567890" + "abcdefghijklmnopqrstuvwxyz"
+ + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "\t\n\r !\"#%'()*+,-./:;=?@[\\]^_`{|}~";
+
+ private static final String[][] ENTITIES = { { "\"", """ }, { "<", "<" }, { ">", ">" },
+ { "&", "&" }, { "$", "$$" } };
private static final ICharacterMatcher SAFE_MATCHER = new AsciiCharacterMatcher(SAFE_CHARACTERS);
private static final ICharacterTranslator ENTITY_TRANSLATOR = new AsciiCharacterTranslator(ENTITIES);
- private static final ICharacterTranslator WML_TRANSLATOR = new MarkupCharacterTranslator(true, SAFE_MATCHER, ENTITY_TRANSLATOR);
+ private static final ICharacterTranslator WML_TRANSLATOR = new MarkupCharacterTranslator(true, SAFE_MATCHER,
+ ENTITY_TRANSLATOR);
- /**
- * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getDefaultTranslator()
- */
- public ICharacterTranslator getDefaultTranslator() {
- return WML_TRANSLATOR;
- }
-
- /**
- * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getTranslator(java.lang.String)
- */
- public ICharacterTranslator getTranslator(String encoding) {
- return getDefaultTranslator();
- }
+ /**
+ * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getDefaultTranslator()
+ */
+ public ICharacterTranslator getDefaultTranslator()
+ {
+ return WML_TRANSLATOR;
+ }
+
+ /**
+ * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getTranslator(java.lang.String)
+ */
+ public ICharacterTranslator getTranslator(String encoding)
+ {
+ return getDefaultTranslator();
+ }
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLEngine.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLEngine.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLEngine.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLEngine.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -17,16 +17,17 @@
import org.apache.tapestry.engine.BaseEngine;
/**
- * Subclass of {@link BaseEngine} used for WML applications to change the Exception, StaleLink and
- * StaleSession pages.
+ * Subclass of {@link BaseEngine} used for WML applications to change the
+ * Exception, StaleLink and StaleSession pages.
*
* @author David Solis
* @since 3.0
- * @deprecated To be removed in 4.1. No longer necessary; the differences between WML applications
- * and HTML applications are now handled via a startup mode. See
+ * @deprecated To be removed in 4.1. No longer necessary; the differences
+ * between WML applications and HTML applications are now handled
+ * via a startup mode. See
* {@link org.apache.tapestry.services.impl.SetupServletApplicationGlobals}.
*/
public class WMLEngine extends BaseEngine
{
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLMarkupFilter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLMarkupFilter.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLMarkupFilter.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLMarkupFilter.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -22,8 +22,9 @@
*/
public class WMLMarkupFilter extends AbstractMarkupFilter
{
+
public WMLMarkupFilter()
{
super(new WMLCharacterTranslatorSource().getDefaultTranslator());
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/pages/WMLException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/pages/WMLException.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/pages/WMLException.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/pages/WMLException.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@
*/
public abstract class WMLException extends Deck
{
+
private ExceptionDescription[] _exceptions;
public void initialize()
@@ -46,4 +47,4 @@
_exceptions = analyzer.analyze(value);
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org