You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/03/11 21:55:35 UTC
svn commit: r385164 [12/32] - in /jakarta/tapestry/trunk: ./ .settings/
annotations/src/java/org/apache/tapestry/annotations/
annotations/src/test/org/apache/tapestry/annotations/ config/
contrib/src/documentation/content/xdocs/tapestry-contrib/Compone...
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryConstants.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryConstants.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryConstants.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryConstants.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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,12 +18,10 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public final class TapestryConstants
+public class TapestryConstants
{
-
/**
- * Name of the cookie written to the client web browser to identify the
- * locale.
+ * Name of the cookie written to the client web browser to identify the locale.
*/
public static final String LOCALE_COOKIE_NAME = "org.apache.tapestry.locale";
@@ -35,8 +33,8 @@
public static final String PAGE_CLASS_NAME = "org.apache.tapestry.default-page-class";
/**
- * Name of meta-data property used to determine the default binding prefix.
- * The meta default for this is "ognl".
+ * Name of meta-data property used to determine the default binding prefix. The meta default for
+ * this is "ognl".
*/
public static final String DEFAULT_BINDING_PREFIX_NAME = "org.apache.tapestry.default-binding-prefix";
@@ -44,4 +42,4 @@
private TapestryConstants()
{
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryMessages.java Sat Mar 11 12:54:27 2006
@@ -14,65 +14,62 @@
package org.apache.tapestry;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
/**
* @author Howard Lewis Ship
* @since 4.0
*/
-final class TapestryMessages
+class TapestryMessages
{
-
- private static final Messages MESSAGES = new MessageFormatter(TapestryMessages.class, "TapestryStrings2");
-
- /** @since 4.1 */
- private TapestryMessages()
- {
- }
+ private final static MessageFormatter _formatter = new MessageFormatter(TapestryMessages.class,
+ "TapestryStrings2");
static String servletInitFailure(Throwable cause)
{
- return MESSAGES.format("servlet-init-failure", cause);
+ return _formatter.format("servlet-init-failure", cause);
}
static String componentIsLocked(IComponent component)
{
- return MESSAGES.format("component-is-locked", component.getExtendedId());
+ return _formatter.format("component-is-locked", component.getExtendedId());
}
static String servletInit(String name, long elapsedToRegistry, long elapsedOverall)
{
- return MESSAGES.format("servlet-init", name, new Long(elapsedToRegistry), new Long(elapsedOverall));
+ return _formatter.format("servlet-init", name, new Long(elapsedToRegistry), new Long(
+ elapsedOverall));
}
static String nonUniqueAttribute(Object newInstance, String key, Object existingInstance)
{
- return MESSAGES.format("non-unique-attribute", newInstance, key, existingInstance);
+ return _formatter.format("non-unique-attribute", newInstance, key, existingInstance);
}
static String noPageRenderSupport(IComponent component)
{
- return MESSAGES.format("no-page-render-support", component.getExtendedId());
+ return _formatter.format("no-page-render-support", component.getExtendedId());
}
static String noForm(IComponent component)
{
- return MESSAGES.format("no-form", component.getExtendedId());
+ return _formatter.format("no-form", component.getExtendedId());
}
static String providedByEnhancement(String methodName)
{
- return MESSAGES.format("provided-by-enhancement", methodName);
+ return _formatter.format("provided-by-enhancement", methodName);
}
static String attemptToChangeContainedComponent(IComponent component)
{
- return MESSAGES.format("attempt-to-change-contained-component", component.getExtendedId());
+ return _formatter
+ .format("attempt-to-change-contained-component", component.getExtendedId());
}
static String componentWrongType(IComponent component, Class expectedType)
{
- return MESSAGES.format("component-wrong-type", component.getExtendedId(), expectedType.getName());
+ return _formatter.format("component-wrong-type", component.getExtendedId(), expectedType
+ .getName());
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryUtils.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryUtils.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/TapestryUtils.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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,27 +28,17 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public final class TapestryUtils
+public class TapestryUtils
{
-
- public static final String PAGE_RENDER_SUPPORT_ATTRIBUTE = "org.apache.tapestry.PageRenderSupport";
-
- public static final String FORM_ATTRIBUTE = "org.apache.tapestry.Form";
-
private static final char QUOTE = '\'';
private static final char BACKSLASH = '\\';
private static final String EMPTY_QUOTES = "''";
- /** @since 4.1 */
- private TapestryUtils()
- {
- }
-
/**
- * Stores an attribute into the request cycle, verifying that no object with
- * that key is already present.
+ * Stores an attribute into the request cycle, verifying that no object with that key is already
+ * present.
*
* @param cycle
* the cycle to store the attribute into
@@ -57,8 +47,7 @@
* @param object
* the attribute value to store
* @throws IllegalStateException
- * if a non-null value has been stored into the cycle with the
- * provided key.
+ * if a non-null value has been stored into the cycle with the provided key.
*/
public static void storeUniqueAttribute(IRequestCycle cycle, String key, Object object)
@@ -69,14 +58,20 @@
Object existing = cycle.getAttribute(key);
if (existing != null)
- throw new IllegalStateException(TapestryMessages.nonUniqueAttribute(object, key, existing));
+ throw new IllegalStateException(TapestryMessages.nonUniqueAttribute(
+ object,
+ key,
+ existing));
cycle.setAttribute(key, object);
}
+ public static final String PAGE_RENDER_SUPPORT_ATTRIBUTE = "org.apache.tapestry.PageRenderSupport";
+
+ public static final String FORM_ATTRIBUTE = "org.apache.tapestry.Form";
+
/**
- * Stores the support object using
- * {@link #storeUniqueAttribute(IRequestCycle, String, Object)}.
+ * Stores the support object using {@link #storeUniqueAttribute(IRequestCycle, String, Object)}.
*/
public static void storePageRenderSupport(IRequestCycle cycle, PageRenderSupport support)
@@ -85,8 +80,7 @@
}
/**
- * Store the IForm instance using
- * {@link #storeUniqueAttribute(IRequestCycle, String, Object)}.
+ * Store the IForm instance using {@link #storeUniqueAttribute(IRequestCycle, String, Object)}.
*/
public static void storeForm(IRequestCycle cycle, IForm form)
@@ -100,8 +94,7 @@
* @param cycle
* the request cycle storing the support object
* @param component
- * the component which requires the support (used to report
- * exceptions)
+ * the component which requires the support (used to report exceptions)
* @throws ApplicationRuntimeException
* if no support object has been stored
*/
@@ -112,8 +105,8 @@
PageRenderSupport result = getOptionalPageRenderSupport(cycle);
if (result == null)
- throw new ApplicationRuntimeException(TapestryMessages.noPageRenderSupport(component), component
- .getLocation(), null);
+ throw new ApplicationRuntimeException(TapestryMessages.noPageRenderSupport(component),
+ component.getLocation(), null);
return result;
}
@@ -124,8 +117,7 @@
* @param cycle
* the request cycle storing the support object
* @param component
- * the component which requires the form (used to report
- * exceptions)
+ * the component which requires the form (used to report exceptions)
* @throws ApplicationRuntimeException
* if no form object has been stored
*/
@@ -134,10 +126,11 @@
Defense.notNull(cycle, "cycle");
Defense.notNull(component, "component");
- IForm result = (IForm)cycle.getAttribute(FORM_ATTRIBUTE);
+ IForm result = (IForm) cycle.getAttribute(FORM_ATTRIBUTE);
if (result == null)
- throw new ApplicationRuntimeException(TapestryMessages.noForm(component), component.getLocation(), null);
+ throw new ApplicationRuntimeException(TapestryMessages.noForm(component), component
+ .getLocation(), null);
return result;
}
@@ -153,16 +146,15 @@
}
/**
- * Returns the {@link PageRenderSupport} object if previously stored,
- * or null otherwise. This is used in the rare case that a component wishes
- * to adjust its behavior based on whether the page render support services
- * are avaiable (typically, adjust for whether enclosed by a Body component,
- * or not).
+ * Returns the {@link PageRenderSupport} object if previously stored, or null otherwise.
+ * This is used in the rare case that a component wishes to adjust its behavior based on whether
+ * the page render support services are avaiable (typically, adjust for whether enclosed by a
+ * Body component, or not).
*/
public static PageRenderSupport getOptionalPageRenderSupport(IRequestCycle cycle)
{
- return (PageRenderSupport)cycle.getAttribute(PAGE_RENDER_SUPPORT_ATTRIBUTE);
+ return (PageRenderSupport) cycle.getAttribute(PAGE_RENDER_SUPPORT_ATTRIBUTE);
}
/**
@@ -175,13 +167,13 @@
}
/**
- * Splits a single string into an array of strings, using a specific
- * delimiter character.
+ * Splits a single string into an array of strings, using a specific delimiter character.
*/
public static String[] split(String input, char delimiter)
{
- if (HiveMind.isBlank(input)) return new String[0];
+ if (HiveMind.isBlank(input))
+ return new String[0];
List strings = new ArrayList();
@@ -190,7 +182,7 @@
int start = 0;
int length = 0;
- for(int i = 0; i < buffer.length; i++)
+ for (int i = 0; i < buffer.length; i++)
{
if (buffer[i] != delimiter)
{
@@ -211,24 +203,28 @@
// If the string contains no delimiters, then
// wrap it an an array and return it.
- if (start == 0 && length == buffer.length) { return new String[] { input }; }
+ if (start == 0 && length == buffer.length)
+ {
+ return new String[]
+ { input };
+ }
// The final token.
String token = new String(buffer, start, length);
strings.add(token);
- return (String[])strings.toArray(new String[strings.size()]);
+ return (String[]) strings.toArray(new String[strings.size()]);
}
/**
- * Enquotes a string within single quotes, ready for insertion as part of a
- * block of JavaScript. Single quotes and backslashes within the input
- * string are properly escaped.
+ * Enquotes a string within single quotes, ready for insertion as part of a block of JavaScript.
+ * Single quotes and backslashes within the input string are properly escaped.
*/
public static String enquote(String input)
{
- if (input == null) return EMPTY_QUOTES;
+ if (input == null)
+ return EMPTY_QUOTES;
char[] chars = input.toCharArray();
@@ -238,11 +234,12 @@
buffer.append(QUOTE);
- for(int i = 0; i < chars.length; i++)
+ for (int i = 0; i < chars.length; i++)
{
char ch = chars[i];
- if (ch == QUOTE || ch == BACKSLASH) buffer.append(BACKSLASH);
+ if (ch == QUOTE || ch == BACKSLASH)
+ buffer.append(BACKSLASH);
buffer.append(ch);
}
@@ -253,17 +250,16 @@
}
/**
- * A Tapestry component id is a little more liberal than an XML NMTOKEN.
- * NMTOKEN must be [A-Za-z][A-Za-z0-9:_.-]*, but a component id might
- * include a leading dollar sign (for an anonymous component with a
- * fabricated id).
+ * A Tapestry component id is a little more liberal than an XML NMTOKEN. NMTOKEN must be
+ * [A-Za-z][A-Za-z0-9:_.-]*, but a component id might include a leading dollar sign (for an
+ * anonymous component with a fabricated id).
*/
public static String convertTapestryIdToNMToken(String baseId)
{
String result = baseId.replace('$', '_');
- while(result.startsWith("_"))
+ while (result.startsWith("_"))
result = result.substring(1);
return result;
@@ -282,12 +278,11 @@
}
/**
- * Used by some generated code; obtains a component and ensures it is of the
- * correct type.
+ * Used by some generated code; obtains a component and ensures it is of the correct type.
*/
- public static IComponent getComponent(IComponent container, String componentId, Class expectedType,
- Location location)
+ public static IComponent getComponent(IComponent container, String componentId,
+ Class expectedType, Location location)
{
Defense.notNull(container, "container");
Defense.notNull(componentId, "componentId");
@@ -306,9 +301,10 @@
}
if (!expectedType.isAssignableFrom(component.getClass()))
- throw new ApplicationRuntimeException(TapestryMessages.componentWrongType(component, expectedType),
- location, null);
+ throw new ApplicationRuntimeException(TapestryMessages.componentWrongType(
+ component,
+ expectedType), location, null);
return component;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AbstractAsset.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AbstractAsset.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AbstractAsset.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AbstractAsset.java Sat Mar 11 12:54:27 2006
@@ -20,21 +20,22 @@
import org.apache.tapestry.IAsset;
/**
- * Base class for {@link org.apache.tapestry.IAsset} implementations. Provides
- * the location property.
- *
- * @author Howard Lewis Ship
- * @since 3.0
- */
-
-public abstract class AbstractAsset implements IAsset {
-
- private Resource _resourceLocation;
+ * Base class for {@link org.apache.tapestry.IAsset} implementations. Provides
+ * the location property.
+ *
+ * @author Howard Lewis Ship
+ * @since 3.0
+ *
+ **/
+
+public abstract class AbstractAsset implements IAsset
+{
+ private Resource _resourceLocation;
private Location _location;
protected AbstractAsset(Resource resourceLocation, Location location)
{
- _resourceLocation = resourceLocation;
+ _resourceLocation = resourceLocation;
_location = location;
}
@@ -42,19 +43,19 @@
{
return _location;
}
-
+
public Resource getResourceLocation()
{
- return _resourceLocation;
+ return _resourceLocation;
}
-
+
public String toString()
{
- ToStringBuilder builder = new ToStringBuilder(this);
-
- builder.append("resourceLocation", _resourceLocation);
- builder.append("location", _location);
-
- return builder.toString();
+ ToStringBuilder builder = new ToStringBuilder(this);
+
+ builder.append("resourceLocation", _resourceLocation);
+ builder.append("location", _location);
+
+ return builder.toString();
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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.
@@ -16,7 +16,6 @@
import java.io.IOException;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.Resource;
import org.apache.hivemind.impl.MessageFormatter;
@@ -24,48 +23,42 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-final class AssetMessages
+class AssetMessages
{
-
- private final static Messages MESSAGES = new MessageFormatter(AssetMessages.class);
-
- /** @since 4.1 */
- private AssetMessages()
- {
- }
+ private final static MessageFormatter _formatter = new MessageFormatter(AssetMessages.class);
static String missingAsset(String path, Resource resource)
{
- return MESSAGES.format("missing-asset", path, resource);
+ return _formatter.format("missing-asset", path, resource);
}
static String noSuchResource(String resourcePath)
{
- return MESSAGES.format("no-such-resource", resourcePath);
+ return _formatter.format("no-such-resource", resourcePath);
}
static String unableToReadResource(String resourcePath, IOException cause)
{
- return MESSAGES.format("unable-to-read-resource", resourcePath, cause);
+ return _formatter.format("unable-to-read-resource", resourcePath, cause);
}
static String md5Mismatch(String path)
{
- return MESSAGES.format("md5-mismatch", path);
+ return _formatter.format("md5-mismatch", path);
}
static String exceptionReportTitle(String path)
{
- return MESSAGES.format("exception-report-title", path);
+ return _formatter.format("exception-report-title", path);
}
static String missingClasspathResource(String path)
{
- return MESSAGES.format("missing-classpath-resource", path);
+ return _formatter.format("missing-classpath-resource", path);
}
static String missingContextResource(String path)
{
- return MESSAGES.format("missing-context-resource", path);
+ return _formatter.format("missing-context-resource", path);
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java Sat Mar 11 12:54:27 2006
@@ -15,7 +15,6 @@
package org.apache.tapestry.asset;
import java.io.BufferedInputStream;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -58,45 +57,7 @@
public class AssetService implements IEngineService
{
-
- /**
- * Query parameter that stores the path to the resource (with a leading slash).
- *
- * @since 4.0
- */
-
- public static final String PATH = "path";
-
- /**
- * Query parameter that stores the digest for the file; this is used to authenticate that the
- * client is allowed to access the file.
- *
- * @since 4.0
- */
- public static final String DIGEST = "digest";
-
-
- /**
- * Defaults MIME types, by extension, used when the servlet container doesn't provide MIME
- * types. ServletExec Debugger, for example, fails to provide these.
- */
-
- private static final Map MIME_TYPES;
-
- static
- {
- MIME_TYPES = new HashMap(17);
- MIME_TYPES.put("css", "text/css");
- MIME_TYPES.put("gif", "image/gif");
- MIME_TYPES.put("jpg", "image/jpeg");
- MIME_TYPES.put("jpeg", "image/jpeg");
- MIME_TYPES.put("htm", "text/html");
- MIME_TYPES.put("html", "text/html");
- }
-
- private static final int BUFFER_SIZE = 10240;
-
/** @since 4.0 */
private ClassResolver _classResolver;
@@ -107,6 +68,7 @@
private WebContext _context;
/** @since 4.0 */
+
private WebRequest _request;
/** @since 4.0 */
@@ -115,9 +77,26 @@
/** @since 4.0 */
private ResourceDigestSource _digestSource;
- /** @since 4.1 */
- private ResourceMatcher _unprotectedMatcher;
-
+ /**
+ * Defaults MIME types, by extension, used when the servlet container doesn't provide MIME
+ * types. ServletExec Debugger, for example, fails to provide these.
+ */
+
+ private final static Map _mimeTypes;
+
+ static
+ {
+ _mimeTypes = new HashMap(17);
+ _mimeTypes.put("css", "text/css");
+ _mimeTypes.put("gif", "image/gif");
+ _mimeTypes.put("jpg", "image/jpeg");
+ _mimeTypes.put("jpeg", "image/jpeg");
+ _mimeTypes.put("htm", "text/html");
+ _mimeTypes.put("html", "text/html");
+ }
+
+ private static final int BUFFER_SIZE = 10240;
+
/**
* Startup time for this service; used to set the Last-Modified response header.
*
@@ -136,7 +115,24 @@
/** @since 4.0 */
private RequestExceptionReporter _exceptionReporter;
-
+
+ /**
+ * Query parameter that stores the path to the resource (with a leading slash).
+ *
+ * @since 4.0
+ */
+
+ public static final String PATH = "path";
+
+ /**
+ * Query parameter that stores the digest for the file; this is used to authenticate that the
+ * client is allowed to access the file.
+ *
+ * @since 4.0
+ */
+
+ public static final String DIGEST = "digest";
+
/**
* Builds a {@link ILink}for a {@link PrivateAsset}.
* <p>
@@ -147,19 +143,19 @@
public ILink getLink(boolean post, Object parameter)
{
Defense.isAssignable(parameter, String.class, "parameter");
-
+
String path = (String) parameter;
-
+
String digest = _digestSource.getDigestForResource(path);
-
+
Map parameters = new HashMap();
-
+
parameters.put(ServiceConstants.SERVICE, getName());
parameters.put(PATH, path);
parameters.put(DIGEST, digest);
-
+
// Service is stateless, which is the exception to the rule.
-
+
return _linkFactory.constructLink(this, post, parameters, false);
}
@@ -171,14 +167,15 @@
private String getMimeType(String path)
{
String result = _context.getMimeType(path);
-
+
if (result == null)
{
int dotx = path.lastIndexOf('.');
- String key = path.substring(dotx + 1).toLowerCase();
-
- result = (String) MIME_TYPES.get(key);
-
+ if (dotx > -1) {
+ String key = path.substring(dotx + 1).toLowerCase();
+ result = (String) _mimeTypes.get(key);
+ }
+
if (result == null)
result = "text/plain";
}
@@ -195,38 +192,32 @@
{
String path = cycle.getParameter(PATH);
String md5Digest = cycle.getParameter(DIGEST);
- boolean checkDigest = !_unprotectedMatcher.containsResource(path);
+
try
{
- if (checkDigest
- && !_digestSource.getDigestForResource(path).equals(md5Digest))
+ if (!_digestSource.getDigestForResource(path).equals(md5Digest))
{
_response.sendError(HttpServletResponse.SC_FORBIDDEN, AssetMessages
.md5Mismatch(path));
return;
}
-
+
// If they were vended an asset in the past then it must be up-to date.
- // Asset URIs change if the underlying file is modified. (unless unprotected)
-
- if (checkDigest && _request.getHeader("If-Modified-Since") != null)
+ // Asset URIs change if the underlying file is modified.
+
+ if (_request.getHeader("If-Modified-Since") != null)
{
_response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return;
}
-
+
URL resourceURL = _classResolver.getResource(path);
-
+
if (resourceURL == null)
throw new ApplicationRuntimeException(AssetMessages.noSuchResource(path));
-
- //check caching for unprotected resources
-
- if (!checkDigest && cachedResource(resourceURL))
- return;
-
+
URLConnection resourceConnection = resourceURL.openConnection();
-
+
writeAssetContent(cycle, path, resourceConnection);
}
catch (Throwable ex)
@@ -235,41 +226,14 @@
}
}
-
- /**
- * Checks if the resource contained within the specified URL
- * has a modified time greater than the request header value
- * of <code>If-Modified-Since</code>. If it doesn't then the
- * response status is set to {@link HttpServletResponse#SC_NOT_MODIFIED}.
- *
- * @param resourceURL Resource being checked
- * @return True if resource should be cached and response header was set.
- * @since 4.1
- */
-
- protected boolean cachedResource(URL resourceURL)
- {
- File resource = new File(resourceURL.getFile());
- if (!resource.exists()) return false;
-
- //even if it doesn't exist in header the value will be -1,
- //which means we need to write out the contents of the resource
-
- long modify = Long.parseLong(_request.getHeader("If-Modified-Since"));
- if (resource.lastModified() > modify)
- return false;
-
- _response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- return true;
- }
-
+
/** @since 2.2 */
private void writeAssetContent(IRequestCycle cycle, String resourcePath,
URLConnection resourceConnection) throws IOException
{
InputStream input = null;
-
+
try
{
// Getting the content type and length is very dependant
@@ -284,13 +248,13 @@
_response.setDateHeader("Last-Modified", _startupTime);
_response.setDateHeader("Expires", _expireTime);
-
+
// Set the content type. If the servlet container doesn't
// provide it, try and guess it by the extension.
-
+
if (contentType == null || contentType.length() == 0)
contentType = getMimeType(resourcePath);
-
+
OutputStream output = _response.getOutputStream(new ContentType(contentType));
input = new BufferedInputStream(resourceConnection.getInputStream());
@@ -358,10 +322,4 @@
{
_request = request;
}
-
- /** @since 4.1 */
- public void setUnprotectedMatcher(ResourceMatcher matcher)
- {
- _unprotectedMatcher = matcher;
- }
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetSourceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetSourceImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetSourceImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/AssetSourceImpl.java Sat Mar 11 12:54:27 2006
@@ -117,4 +117,4 @@
_defaultAssetFactory = defaultAssetFactory;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ClasspathAssetFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ClasspathAssetFactory.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ClasspathAssetFactory.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ClasspathAssetFactory.java Sat Mar 11 12:54:27 2006
@@ -44,14 +44,14 @@
{
Resource asset = baseResource.getRelativeResource(path);
Resource localized = _localizer.findLocalization(asset, locale);
-
+
if (localized == null)
throw new ApplicationRuntimeException(AssetMessages.missingAsset(path, baseResource),
location, null);
-
+
return createAsset(localized, location);
}
-
+
public IAsset createAbsoluteAsset(String path, Locale locale, Location location)
{
Resource base = new ClasspathResource(_classResolver, path);
@@ -85,4 +85,4 @@
{
_localizer = localizer;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ContextAsset.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ContextAsset.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ContextAsset.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ContextAsset.java Sat Mar 11 12:54:27 2006
@@ -22,6 +22,7 @@
import org.apache.hivemind.Resource;
import org.apache.hivemind.util.Defense;
import org.apache.tapestry.IAsset;
+import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.Tapestry;
/**
@@ -37,13 +38,17 @@
private String _resolvedURL;
- public ContextAsset(String contextPath, Resource resource, Location location)
+ private IRequestCycle _requestCycle;
+
+ public ContextAsset(String contextPath, Resource resource, Location location, IRequestCycle cycle)
{
super(resource, location);
Defense.notNull(contextPath, "contextPath");
_contextPath = contextPath;
+
+ _requestCycle = cycle;
}
/**
@@ -57,7 +62,7 @@
if (_resolvedURL == null)
_resolvedURL = _contextPath + getResourceLocation().getPath();
- return _resolvedURL;
+ return _requestCycle.encodeURL(_resolvedURL);
}
public InputStream getResourceAsStream()
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ContextAssetFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ContextAssetFactory.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ContextAssetFactory.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ContextAssetFactory.java Sat Mar 11 12:54:27 2006
@@ -20,6 +20,7 @@
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
import org.apache.tapestry.IAsset;
+import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.l10n.ResourceLocalizer;
import org.apache.tapestry.web.WebContext;
import org.apache.tapestry.web.WebContextResource;
@@ -41,6 +42,8 @@
private ResourceLocalizer _localizer;
+ private IRequestCycle _requestCycle;
+
public void setWebContext(WebContext webContext)
{
_webContext = webContext;
@@ -85,7 +88,7 @@
public IAsset createAsset(Resource resource, Location location)
{
- return new ContextAsset(_contextPath, resource, location);
+ return new ContextAsset(_contextPath, resource, location, _requestCycle);
}
public void setContextPath(String contextPath)
@@ -101,5 +104,10 @@
public void setLocalizer(ResourceLocalizer localizer)
{
_localizer = localizer;
+ }
+
+ public void setRequestCycle(IRequestCycle cycle)
+ {
+ _requestCycle = cycle;
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ExternalAsset.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ExternalAsset.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ExternalAsset.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ExternalAsset.java Sat Mar 11 12:54:27 2006
@@ -22,25 +22,28 @@
import org.apache.tapestry.Tapestry;
/**
- * A reference to an external URL. {@link ExternalAsset}s are not localizable.
+ * A reference to an external URL. {@link ExternalAsset}s are not
+ * localizable.
+ *
+ * @author Howard Lewis Ship
*
- * @author Howard Lewis Ship
- */
-
-public class ExternalAsset extends AbstractAsset {
+ **/
+public class ExternalAsset extends AbstractAsset
+{
private String _URL;
public ExternalAsset(String URL, Location location)
{
- super(null, location);
-
+ super(null, location);
+
_URL = URL;
}
/**
- * Simply returns the URL of the external asset.
- */
+ * Simply returns the URL of the external asset.
+ *
+ **/
public String buildURL()
{
@@ -51,15 +54,17 @@
{
URL url;
- try {
+ try
+ {
url = new URL(_URL);
return url.openStream();
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
// MalrformedURLException or IOException
- throw new ApplicationRuntimeException(Tapestry.format(
- "ExternalAsset.resource-missing", _URL), ex);
+ throw new ApplicationRuntimeException(Tapestry.format("ExternalAsset.resource-missing", _URL), ex);
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/AbstractBeanInitializer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/AbstractBeanInitializer.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/AbstractBeanInitializer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/AbstractBeanInitializer.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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,9 +26,8 @@
* @since 1.0.5
*/
-public abstract class AbstractBeanInitializer extends BaseLocatable implements
- IBeanInitializer {
-
+abstract public class AbstractBeanInitializer extends BaseLocatable implements IBeanInitializer
+{
protected String _propertyName;
public String getPropertyName()
@@ -45,15 +44,20 @@
protected void setBeanProperty(Object bean, Object value)
{
- try {
+ try
+ {
PropertyUtils.write(bean, _propertyName, value);
- } catch (ApplicationRuntimeException ex) {
+ }
+ catch (ApplicationRuntimeException ex)
+ {
String message = Tapestry.format(
"AbstractBeanInitializer.unable-to-set-property",
- _propertyName, bean, value);
+ _propertyName,
+ bean,
+ value);
throw new ApplicationRuntimeException(message, getLocation(), ex);
}
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/BeanMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/BeanMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/BeanMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/BeanMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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.
@@ -14,7 +14,6 @@
package org.apache.tapestry.bean;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.tapestry.IComponent;
@@ -22,41 +21,38 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-final class BeanMessages
+class BeanMessages
{
- private final static Messages MESSAGES = new MessageFormatter(BeanMessages.class);
+ private final static MessageFormatter _formatter = new MessageFormatter(BeanMessages.class);
- /** @since 4.1 */
- private BeanMessages(){}
-
static String propertyInitializerName(String propertyName)
{
- return MESSAGES.format("property-initializer-name", propertyName);
+ return _formatter.format("property-initializer-name", propertyName);
}
static String beanNotDefined(IComponent component, String name)
{
- return MESSAGES.format("bean-not-defined", component.getExtendedId(), name);
+ return _formatter.format("bean-not-defined", component.getExtendedId(), name);
}
static String instantiationError(String name, IComponent component, Class beanClass,
Throwable cause)
{
- return MESSAGES.format("instantiation-error", new Object[]
+ return _formatter.format("instantiation-error", new Object[]
{ name, component.getExtendedId(), beanClass.getName(), cause });
}
static String initializationError(IComponent component, String beanName, String propertyName,
Throwable cause)
{
- return MESSAGES.format("initialization-error", new Object[]
+ return _formatter.format("initialization-error", new Object[]
{ propertyName, beanName, component.getExtendedId(), cause });
}
static String missingBeanClass(IComponent component, String beanName, String className,
String packageList)
{
- return MESSAGES.format("missing-bean-class", new Object[]
+ return _formatter.format("missing-bean-class", new Object[]
{ beanName, component.getExtendedId(), className, packageList });
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/EvenOdd.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/EvenOdd.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/EvenOdd.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/bean/EvenOdd.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -15,23 +15,24 @@
package org.apache.tapestry.bean;
/**
- * Used to emit a stream of alterating string values: "even", "odd", etc. This
- * is often used in the Inspector pages to make the class of a <tr>
- * alternate for presentation reasons.
- *
- * @author Howard Lewis Ship
- */
+ * Used to emit a stream of alterating string values: "even", "odd", etc. This
+ * is often used in the Inspector pages to make the class of a <tr> alternate
+ * for presentation reasons.
+ *
+ * @author Howard Lewis Ship
+ *
+ **/
public class EvenOdd
{
-
private boolean even = true;
/**
- * Returns "even" or "odd". Whatever it returns on one invocation, it will
- * return the opposite on the next. By default, the first value returned is
- * "even".
- */
+ * Returns "even" or "odd". Whatever it returns on one invocation, it will
+ * return the opposite on the next. By default, the first value
+ * returned is "even".
+ *
+ **/
public String getNext()
{
@@ -41,18 +42,19 @@
return result;
}
-
+
public boolean isEven()
{
return even;
}
- /**
- * Overrides the even flag.
- */
-
+ /**
+ * Overrides the even flag.
+ *
+ **/
+
public void setEven(boolean value)
{
even = value;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/AbstractBinding.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/AbstractBinding.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/AbstractBinding.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/AbstractBinding.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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,8 +26,8 @@
* @author Howard Lewis Ship
*/
-public abstract class AbstractBinding implements IBinding {
-
+public abstract class AbstractBinding implements IBinding
+{
/** @since 4.0 */
private final String _description;
@@ -42,8 +42,7 @@
/** @since 3.0 */
- protected AbstractBinding(String description,
- ValueConverter valueConverter, Location location)
+ protected AbstractBinding(String description, ValueConverter valueConverter, Location location)
{
Defense.notNull(description, "description");
Defense.notNull(valueConverter, "valueConverter");
@@ -87,20 +86,21 @@
Object raw = getObject();
- try {
+ try
+ {
return _valueConverter.coerceValue(raw, type);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
String message = BindingMessages.convertObjectError(this, ex);
- throw new BindingException(message, getComponent(), _location,
- this, ex);
+ throw new BindingException(message, getComponent(), _location, this, ex);
}
}
/**
- * Returns the component to which this binding is connected; this is
- * currently only used when building certain exceptions. This implementation
- * returns null.
+ * Returns the component to which this binding is connected; this is currently only used when
+ * building certain exceptions. This implementation returns null.
*
* @since 4.0
*/
@@ -114,8 +114,7 @@
protected BindingException createReadOnlyBindingException(IBinding binding)
{
- return new BindingException(BindingMessages.readOnlyBinding(binding),
- binding);
+ return new BindingException(BindingMessages.readOnlyBinding(binding), binding);
}
/** @since 4.0 */
@@ -156,4 +155,4 @@
{
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/AbstractBindingFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/AbstractBindingFactory.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/AbstractBindingFactory.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/AbstractBindingFactory.java Sat Mar 11 12:54:27 2006
@@ -17,15 +17,15 @@
import org.apache.tapestry.coerce.ValueConverter;
/**
- * Base class for {@link org.apache.tapestry.binding.BindingFactory}s. Manages
- * a {@link #getValueConverter() valueConverter property}, as all binding
- * instances will need such a value injected.
+ * Base class for {@link org.apache.tapestry.binding.BindingFactory}s. Manages a
+ * {@link #getValueConverter() valueConverter property}, as all binding instances will need such a
+ * value injected.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public abstract class AbstractBindingFactory implements BindingFactory {
-
+public abstract class AbstractBindingFactory implements BindingFactory
+{
private ValueConverter _valueConverter;
public ValueConverter getValueConverter()
@@ -38,4 +38,4 @@
_valueConverter = valueConverter;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/BindingMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/BindingMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/BindingMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/binding/BindingMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -14,7 +14,6 @@
package org.apache.tapestry.binding;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.tapestry.IBinding;
import org.apache.tapestry.IComponent;
@@ -23,33 +22,31 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-final class BindingMessages
+class BindingMessages
{
-
- private final static Messages MESSAGES = new MessageFormatter(BindingMessages.class);
-
- /** @since 4.1 */
- private BindingMessages()
- {
- }
+ private final static MessageFormatter _formatter = new MessageFormatter(BindingMessages.class);
static String convertObjectError(IBinding binding, Throwable cause)
{
- return MESSAGES.format("convert-object-error", binding.getDescription(), cause);
+ return _formatter.format("convert-object-error", binding.getDescription(), cause);
}
static String readOnlyBinding(IBinding binding)
{
- return MESSAGES.format("read-only-binding", binding.getDescription(), binding);
+ return _formatter.format("read-only-binding", binding.getDescription(), binding);
}
static String missingAsset(IComponent component, String assetName)
{
- return MESSAGES.format("missing-asset", component.getExtendedId(), assetName);
+ return _formatter.format("missing-asset", component.getExtendedId(), assetName);
}
static String listenerMethodFailure(IComponent component, String methodName, Throwable cause)
{
- return MESSAGES.format("listener-method-failure", methodName, component.getExtendedId(), cause);
+ return _formatter.format(
+ "listener-method-failure",
+ methodName,
+ component.getExtendedId(),
+ cause);
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/callback/CallbackMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/callback/CallbackMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/callback/CallbackMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/callback/CallbackMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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.
@@ -14,7 +14,6 @@
package org.apache.tapestry.callback;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.tapestry.IComponent;
@@ -22,23 +21,17 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-final class CallbackMessages
+class CallbackMessages
{
-
- private final static Messages MESSAGES = new MessageFormatter(CallbackMessages.class);
-
- /** @since 4.1 */
- private CallbackMessages()
- {
- }
+ private final static MessageFormatter _formatter = new MessageFormatter(CallbackMessages.class);
static String pageNotExternal(String pageName)
{
- return MESSAGES.format("page-not-external", pageName);
+ return _formatter.format("page-not-external", pageName);
}
static String componentNotDirect(IComponent component)
{
- return MESSAGES.format("component-not-direct", component.getExtendedId());
+ return _formatter.format("component-not-direct", component.getExtendedId());
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/CoerceMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/CoerceMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/CoerceMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/CoerceMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -14,7 +14,6 @@
package org.apache.tapestry.coerce;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.hivemind.service.ClassFabUtils;
@@ -22,23 +21,21 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-final class CoerceMessages
+class CoerceMessages
{
-
- private final static Messages MESSAGES = new MessageFormatter(CoerceMessages.class);
-
- /** @since 4.1 */
- private CoerceMessages()
- {
- }
+ private final static MessageFormatter _formatter = new MessageFormatter(CoerceMessages.class);
static String noConverter(Class desiredType)
{
- return MESSAGES.format("no-converter", ClassFabUtils.getJavaClassName(desiredType));
+ return _formatter.format("no-converter", ClassFabUtils.getJavaClassName(desiredType));
}
static String stringToNumberConversionError(String value, Class targetClass, Throwable cause)
{
- return MESSAGES.format("string-to-number-conversion-error", value, targetClass.getName(), cause);
+ return _formatter.format(
+ "string-to-number-conversion-error",
+ value,
+ targetClass.getName(),
+ cause);
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/IteratorToListConverter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/IteratorToListConverter.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/IteratorToListConverter.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/IteratorToListConverter.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -27,11 +27,11 @@
public Object convertValue(Object value)
{
- Iterator it = (Iterator)value;
+ Iterator it = (Iterator) value;
List list = new ArrayList();
- while(it.hasNext())
- list.add(it.next());
+ while (it.hasNext())
+ list.add(it.next());
return list;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ObjectToStringConverter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ObjectToStringConverter.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ObjectToStringConverter.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ObjectToStringConverter.java Sat Mar 11 12:54:27 2006
@@ -26,4 +26,4 @@
return value == null ? null : value.toString();
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/StringConvertedPropertySelectionModel.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/StringConvertedPropertySelectionModel.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/StringConvertedPropertySelectionModel.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/StringConvertedPropertySelectionModel.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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,8 +21,7 @@
import org.apache.tapestry.form.IPropertySelectionModel;
/**
- * {@link org.apache.tapestry.form.IPropertySelectionModel} created from a
- * comma-seperated string by
+ * {@link org.apache.tapestry.form.IPropertySelectionModel} created from a comma-seperated string by
* {@link org.apache.tapestry.coerce.StringToPropertySelectionModelConverter}.
*
* @author Howard M. Lewis Ship
@@ -30,11 +29,8 @@
*/
public final class StringConvertedPropertySelectionModel implements IPropertySelectionModel
{
-
- /** Stores a single label/value pair. */
private static class Entry
{
-
String _label;
String _value;
@@ -66,7 +62,7 @@
_entries = new ArrayList(terms.length);
- for(int i = 0; i < terms.length; i++)
+ for (int i = 0; i < terms.length; i++)
{
_entries.add(new Entry(terms[i]));
}
@@ -79,7 +75,7 @@
private Entry getEntry(int index)
{
- return (Entry)_entries.get(index);
+ return (Entry) _entries.get(index);
}
public Object getOption(int index)
@@ -100,8 +96,7 @@
public Object translateValue(String value)
{
- // Values are the same on the client and the server, so no translation
- // needed.
+ // Values are the same on the client and the server, so no translation needed.
return value;
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverter.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverter.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverter.java Sat Mar 11 12:54:27 2006
@@ -14,7 +14,7 @@
package org.apache.tapestry.coerce;
-/**
+/**
* Converts a value to a specific (implicit) type.
*
* @author Howard M. Lewis Ship
@@ -22,16 +22,13 @@
*/
public interface TypeConverter
{
-
/**
* Converts the value.
*
- * @param value
- * the value to be converted (which may be null)
- * @return the value converted to a specific type; different implementations
- * of TypeConverter will return different types.
- * @throws org.apache.hivemind.ApplicationRuntimeException
- * if the value can not be converted
+ * @param value the value to be converted (which may be null)
+ * @return the value converted to a specific type; different implementations of TypeConverter
+ * will return different types.
+ * @throws org.apache.hivemind.ApplicationRuntimeException if the value can not be converted
*/
- Object convertValue(Object value);
+ public Object convertValue(Object value);
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverterContribution.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverterContribution.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverterContribution.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverterContribution.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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,7 +23,6 @@
*/
public final class TypeConverterContribution
{
-
private TypeConverter _converter;
private Class _subjectClass;
@@ -48,4 +47,4 @@
_subjectClass = subjectClass;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverterWrapper.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverterWrapper.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverterWrapper.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/TypeConverterWrapper.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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,18 +22,16 @@
/**
* A service implementation that works around an
- * {@link org.apache.hivemind.lib.util.StrategyRegistry}. The registry is
- * contructed from a configuration that follows the
- * <code>tapestry.coerce.Converters</code> schema (a List of
- * {@link org.apache.tapestry.coerce.TypeConverterContribution}plus an
- * additional converter for nulls.
+ * {@link org.apache.hivemind.lib.util.StrategyRegistry}. The registry is contructed from a
+ * configuration that follows the <code>tapestry.coerce.Converters</code> schema (a List of
+ * {@link org.apache.tapestry.coerce.TypeConverterContribution}plus an additional converter for
+ * nulls.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public final class TypeConverterWrapper implements TypeConverter
{
-
private StrategyRegistry _registry = new StrategyRegistryImpl();
private List _contributions;
@@ -44,9 +42,9 @@
{
Iterator i = _contributions.iterator();
- while(i.hasNext())
+ while (i.hasNext())
{
- TypeConverterContribution c = (TypeConverterContribution)i.next();
+ TypeConverterContribution c = (TypeConverterContribution) i.next();
_registry.register(c.getSubjectClass(), c.getConverter());
}
@@ -56,19 +54,19 @@
{
if (value == null)
{
- if (_nullConverter == null) return null;
+ if (_nullConverter == null)
+ return null;
return _nullConverter.convertValue(null);
}
- TypeConverter delegate = (TypeConverter)_registry.getStrategy(value.getClass());
+ TypeConverter delegate = (TypeConverter) _registry.getStrategy(value.getClass());
return delegate.convertValue(value);
}
/**
- * Sets the List of
- * {@link org.apache.tapestry.coerce.TypeConverterContribution}s.
+ * Sets the List of {@link org.apache.tapestry.coerce.TypeConverterContribution}s.
*/
public void setContributions(List contributions)
@@ -84,4 +82,4 @@
{
_nullConverter = nullConverter;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ValueConverter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ValueConverter.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ValueConverter.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ValueConverter.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -15,20 +15,19 @@
package org.apache.tapestry.coerce;
/**
- * Converts a value (possibly null) to an alternate data type; typically from
- * String to boolean or a number type.
+ * Converts a value (possibly null) to an alternate data type; typically from String to boolean or a
+ * number type.
* <p>
* Typically, a ValueConverter will select a particular
- * {@link org.apache.tapestry.coerce.TypeConverter} to perform the conversion.
- * The {@link org.apache.tapestry.coerce.ValueConverterImpl} implementation also
- * makes use of built-in {@link java.beans.PropertyEditor}s.
+ * {@link org.apache.tapestry.coerce.TypeConverter}to perform the conversion. The
+ * {@link org.apache.tapestry.coerce.ValueConverterImpl}implementation also makes use of built-in
+ * {@link java.beans.PropertyEditor}s.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface ValueConverter
{
-
/**
* Performs a conversion of a value to a particular type.
*
@@ -36,10 +35,10 @@
* The value to be converted (may be null)
* @param desiredType
* the type that will be converted to
- * @returns the value converted to the indicated type. May return the input
- * value if it is already assignable to the desiredType.
+ * @returns the value converted to the indicated type. May return the input value if it is
+ * already assignable to the desiredType.
* @throws org.apache.hivemind.ApplicationRuntimeException
* if the value can not be converted
*/
- Object coerceValue(Object value, Class desiredType);
-}
+ public Object coerceValue(Object value, Class desiredType);
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ValueConverterImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ValueConverterImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ValueConverterImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/coerce/ValueConverterImpl.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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,20 +26,19 @@
import org.apache.hivemind.util.Defense;
/**
- * Implementation of {@link org.apache.tapestry.coerce.ValueConverter}. Selects
- * an appropriate type converter and delegates to it.
+ * Implementation of {@link org.apache.tapestry.coerce.ValueConverter}. Selects an appropriate type
+ * converter and delegates to it.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public class ValueConverterImpl implements ValueConverter
{
-
private Map _converterMap = new HashMap();
/** List of {@link org.apache.tapestry.coerce.TypeConverterContribution}. */
- private List _contributions;
+ public List _contributions;
private Map _primitiveToWrapper = new HashMap();
@@ -66,9 +65,9 @@
public void initializeService()
{
Iterator i = _contributions.iterator();
- while(i.hasNext())
+ while (i.hasNext())
{
- TypeConverterContribution c = (TypeConverterContribution)i.next();
+ TypeConverterContribution c = (TypeConverterContribution) i.next();
_converterMap.put(c.getSubjectClass(), c.getConverter());
}
@@ -82,37 +81,40 @@
// Already the correct type? Go no further!
- if (value != null && effectiveType.isAssignableFrom(value.getClass())) return value;
-
+ if (value != null && effectiveType.isAssignableFrom(value.getClass()))
+ return value;
+
Object result = convertNumberToNumber(value, effectiveType);
- if (result != null) return result;
+ if (result != null)
+ return result;
result = convertUsingPropertyEditor(value, effectiveType);
- if (result != null) return result;
+ if (result != null)
+ return result;
- TypeConverter converter = (TypeConverter)_converterMap.get(effectiveType);
+ TypeConverter converter = (TypeConverter) _converterMap.get(effectiveType);
// null value and no converter for the given type? Just return null.
- if (value == null && converter == null) return null;
+ if (value == null && converter == null)
+ return null;
- if (converter == null) throw new ApplicationRuntimeException(CoerceMessages.noConverter(effectiveType));
+ if (converter == null)
+ throw new ApplicationRuntimeException(CoerceMessages.noConverter(effectiveType));
return converter.convertValue(value);
}
/**
- * Attempts to use {@link java.beans.PropertyEditor}to perform a conversion
- * from a string to a numeric type. Returns null if no property editor can
- * be found.
+ * Attempts to use {@link java.beans.PropertyEditor}to perform a conversion from a string to a
+ * numeric type. Returns null if no property editor can be found.
*
* @param value
* The value to convert
* @param targetType
- * The type to convert to (must be a wrapper type, not a
- * primitive type)
+ * The type to convert to (must be a wrapper type, not a primitive type)
*/
private Number convertUsingPropertyEditor(Object value, Class targetType)
@@ -121,14 +123,16 @@
// PropertyEditorManager expects primitive types not
// wrapper types.
- if (value == null || value.getClass() != String.class || !Number.class.isAssignableFrom(targetType))
+ if (value == null || value.getClass() != String.class
+ || !Number.class.isAssignableFrom(targetType))
return null;
- Class primitiveType = (Class)_wrapperToPrimitive.get(targetType);
+ Class primitiveType = (Class) _wrapperToPrimitive.get(targetType);
// Note a primitive type.
- if (primitiveType == null) return null;
+ if (primitiveType == null)
+ return null;
// Looks like a conversion from String to Number, let's see.
@@ -137,20 +141,23 @@
// This should not happen, since we've filtered down to just the
// primitive types that do have property editors.
- if (editor == null) return null;
+ if (editor == null)
+ return null;
- String text = (String)value;
+ String text = (String) value;
try
{
editor.setAsText(text);
- return (Number)editor.getValue();
+ return (Number) editor.getValue();
}
catch (Exception ex)
{
- throw new ApplicationRuntimeException(CoerceMessages.stringToNumberConversionError(text, targetType, ex),
- ex);
+ throw new ApplicationRuntimeException(CoerceMessages.stringToNumberConversionError(
+ text,
+ targetType,
+ ex), ex);
}
}
@@ -158,16 +165,18 @@
private Number convertNumberToNumber(Object value, Class targetType)
{
if (value == null || !Number.class.isAssignableFrom(value.getClass())
- || !Number.class.isAssignableFrom(targetType)) return null;
+ || !Number.class.isAssignableFrom(targetType))
+ return null;
String valueAsString = value.toString();
- return (Number)ConstructorUtils.invokeConstructor(targetType, new Object[] { valueAsString });
+ return (Number) ConstructorUtils.invokeConstructor(targetType, new Object[]
+ { valueAsString });
}
private Class convertType(Class possiblePrimitiveType)
{
- Class wrapperType = (Class)_primitiveToWrapper.get(possiblePrimitiveType);
+ Class wrapperType = (Class) _primitiveToWrapper.get(possiblePrimitiveType);
return wrapperType == null ? possiblePrimitiveType : wrapperType;
}
@@ -176,4 +185,4 @@
{
_contributions = contributions;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/BlockRenderer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/BlockRenderer.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/BlockRenderer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/BlockRenderer.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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,23 +20,24 @@
/**
* An implementation of IRender that renders a Block component.
- * <p>
- * The BlockRenderer allows the contents of a {@link Block} to be rendered via
- * {@link IRender}. It can be used in cases when an {@link IRender} object is
- * required as an argument or a binding to render a part of a Component. To
- * provide a complicated view, it could be defined in a {@link Block} and then
+ *
+ * <p>The BlockRenderer allows the contents of a {@link Block} to be rendered
+ * via {@link IRender}. It can be used in cases when an {@link IRender} object is
+ * required as an argument or a binding to render a part of a Component.
+ * To provide a complicated view, it could be defined in a {@link Block} and then
* returned encapsulated in a BlockRenderer.
- * <p>
- * It is important to note that a special care has to be taken if the
- * BlockRenderer is used within an inner class of a component or a page. In such
- * a case the instance of the component that created the inner class may not be
- * the currently active instance in the RequestCycle when the BlockRenderer is
- * required. Thus, calling getComponent("blockName") to get the block component
- * may return a Block component that is not initialized for this RequestCycle.
- * <p>
- * To avoid similar problems, the ComponentAddress class could be used in
- * conjunction with BlockRenderer. Here is a quick example of how BlockRenderer
- * could be used with ComponentAddress:
+ *
+ * <p>It is important to note that a special care has to be taken if
+ * the BlockRenderer is used within an inner class of a component or a page.
+ * In such a case the instance of the component that created the inner class
+ * may not be the currently active instance in the RequestCycle when the
+ * BlockRenderer is required. Thus, calling getComponent("blockName") to get the
+ * block component may return a Block component that is not initialized for this
+ * RequestCycle.
+ *
+ * <p>To avoid similar problems, the ComponentAddress class could be used in
+ * conjunction with BlockRenderer.
+ * Here is a quick example of how BlockRenderer could be used with ComponentAddress:
* <p>
* <code>
* <br>// Create a component address for the current component
@@ -55,26 +56,23 @@
*/
public class BlockRenderer implements IRender
{
+ private Block m_objBlock;
- private Block m_objBlock;
-
- /**
- * Creates a new BlockRenderer that will render the content of the argument
- *
- * @param objBlock
- * the Block to be rendered
- */
- public BlockRenderer(Block objBlock)
- {
- m_objBlock = objBlock;
- }
-
- /**
- * @see org.apache.tapestry.IRender#render(IMarkupWriter, IRequestCycle)
- */
- public void render(IMarkupWriter writer, IRequestCycle cycle)
- {
- m_objBlock.renderBody(writer, cycle);
- }
+ /**
+ * Creates a new BlockRenderer that will render the content of the argument
+ * @param objBlock the Block to be rendered
+ */
+ public BlockRenderer(Block objBlock)
+ {
+ m_objBlock = objBlock;
+ }
+
+ /**
+ * @see org.apache.tapestry.IRender#render(IMarkupWriter, IRequestCycle)
+ */
+ public void render(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ m_objBlock.renderBody(writer, cycle);
+ }
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/ComponentMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/ComponentMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/ComponentMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/ComponentMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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.
@@ -14,7 +14,6 @@
package org.apache.tapestry.components;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.tapestry.IComponent;
@@ -22,20 +21,17 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-final class ComponentMessages
+class ComponentMessages
{
- private final static Messages MESSAGES = new MessageFormatter(ComponentMessages.class);
+ private final static MessageFormatter _formatter = new MessageFormatter(ComponentMessages.class);
- /** @since 4.1 */
- private ComponentMessages(){}
-
static String unableToFormat(IComponent component, Object value, Throwable cause)
{
- return MESSAGES.format("unable-to-format", component.getExtendedId(), value, cause);
+ return _formatter.format("unable-to-format", component.getExtendedId(), value, cause);
}
static String anyElementNotDefined()
{
- return MESSAGES.getMessage("any-element-not-defined");
+ return _formatter.getMessage("any-element-not-defined");
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/Delegator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/Delegator.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/Delegator.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/components/Delegator.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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,26 +20,29 @@
import org.apache.tapestry.IRequestCycle;
/**
- * A component which delegates it's behavior to another object. [<a
- * href="../../../../../ComponentReference/Delegator.html">Component Reference</a>]
+ * A component which delegates it's behavior to another object.
+ *
+ * [<a href="../../../../../ComponentReference/Delegator.html">Component Reference</a>]
+ *
+ * @author Howard Lewis Ship
*
- * @author Howard Lewis Ship
- */
+ **/
public abstract class Delegator extends AbstractComponent
{
-
/**
- * Gets its delegate and invokes
- * {@link IRender#render(IMarkupWriter, IRequestCycle)} on it.
- */
+ * Gets its delegate and invokes {@link IRender#render(IMarkupWriter, IRequestCycle)}
+ * on it.
+ *
+ **/
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
- IRender delegate = getDelegate();
-
- if (delegate != null) delegate.render(writer, cycle);
+ IRender delegate = getDelegate();
+
+ if (delegate != null)
+ delegate.render(writer, cycle);
}
-
+
public abstract IRender getDelegate();
-}
+}
\ 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