[CONF] Apache Tapestry Injection
Injection Page edited by Bob Harner Comment: Minor layout issue Changes (8) ... A large number of services are provided by Tapestry. See the following packages: {float:left} {float:left|width=12em} * [Core Services|http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/package-summary.html] * [AJAX Services|http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ajax/package-summary.html] ... {float} {float:left} {float:left|width=12em} * [_javascript_ Services|http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/_javascript_/package-summary.html] * [Link Transformation Services|http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/linktransform/package-summary.html] ... {float} {float:left} {float:left|width=12em} * [Page Loading Services|http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/pageload/package-summary.html] * [Security Services|http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/security/package-summary.html] ... {float} {float:left} {float:left|width=12em} * [Tapestry IOC Services|http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/package-summary.html] * [Tapestry IOC Cron Services|http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/cron/package-summary.html] ... Full Content Injection Injection is Tapestry's way of making a dependency such as a resource, asset, component, block or service available in a page, component, mixin or service class. Injection is a key concept in Tapestry, and it is used in several different but related ways. Related Articles Page: Injection FAQ Page: Injection in Detail Page: Injection Injection in Tapestry IOC Services Main Article: Tapestry IoC Overview The Tapestry IoC container makes use of injection primarily through constructors and via parameters to service builder methods. Injection in Component Classes For components, however, Tapestry takes a completely different tack: injection directly into component fields. The @Inject annotation is used to identify fields that will contain injected services and other resources. Tapestry allows for two kinds of injection: Default injection, where Tapestry determines the object to inject into the field based on its type. Explicit injection, where the particular service to be injected is specified. In both cases, the field is transformed into a read only value. As elsewhere in Tapestry, this transformation occurs at runtime (which is very important in terms of being able to test your components). Attempting to update an injected field will result in a runtime exception. In addition, there are a few special cases that are triggered by specific field types, or additional annotations, in addition, to @Inject, on a field. Block Injection For field type Block, the value of the Inject annotation is the id of the t:block element within the component's template. Normally, the id of the block is determined from the field name (after stripping out any leading "_" and "$" characters): @Inject private Block foo; Where that is not appropriate, an @Id annotation can be supplied: @Inject @Id("bar") private Block barBlock; The first injection will inject the Block with id "foo" (as always, case is ignored). The second injection will inject the Block with id "bar". Resource Injection For a particular set of field types, Tapestry will inject a resource related to the component, such as its Locale. A very common example occurs when a component needs access to its resources. The component can define a field of the appropriate type and use the @Inject annotation without a value: @Inject private ComponentResources resources; Tapestry uses the type of the field, ComponentResources, to determine what to inject into this field. The following types are supported for resources injection: java.lang.String The complete id of the component, which
svn commit: r882304 - in /websites/production/tapestry/content: cache/main.pageCache injection.html
Author: buildbot Date: Sat Oct 12 15:20:40 2013 New Revision: 882304 Log: Production update by buildbot for tapestry Modified: websites/production/tapestry/content/cache/main.pageCache websites/production/tapestry/content/injection.html Modified: websites/production/tapestry/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/tapestry/content/injection.html == --- websites/production/tapestry/content/injection.html (original) +++ websites/production/tapestry/content/injection.html Sat Oct 12 15:20:40 2013 @@ -193,16 +193,16 @@ private EmployeeService employeeService; pA large number of services are provided by Tapestry. See the following packages:/p -div class=navmenu style=float:left; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/package-summary.html;Core Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ajax/package-summary.html;AJAX Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/assets/package-summary.html;Assets Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/dynamic/package-summary.html;Dynamic Component Services/a/li/ul +div class=navmenu style=float:left; width:12em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/package-summary.html;Core Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ajax/package-summary.html;AJAX Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/assets/package-summary.html;Assets Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/dynamic/package-summary.html;Dynamic Component Services/a/li/ul /div -div class=navmenu style=float:left; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/package-summary.html;JavaScript Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/linktransform/package-summary.html;Link Transformation Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/messages/package-summary.html;Message Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/package-summary.html;Component Metadata Services/a/li/ul +div class=navmenu style=float:left; width:12em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/package-summary.html;JavaScript Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/linktransform/package-summary.html;Link Transformation Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/messages/package-summary.html;Message Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/package-summary.html;Component Metadata Services/a/li/ul /div -div class=navmenu style=float:left; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/pageload/package-summary.html;Page Loading Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/security/package-summary.html;Security Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/templates/package-summary.html;Template Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/transform/package-summary.html;Class Transformation Services/a/li/ul +div class=navmenu style=float:left; width:12em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/pageload/package-summary.html;Page Loading Services/a/lilia shape=rect
svn commit: r882311 - in /websites/production/tapestry/content: cache/main.pageCache injection.html
Author: buildbot Date: Sat Oct 12 16:20:36 2013 New Revision: 882311 Log: Production update by buildbot for tapestry Modified: websites/production/tapestry/content/cache/main.pageCache websites/production/tapestry/content/injection.html Modified: websites/production/tapestry/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/tapestry/content/injection.html == --- websites/production/tapestry/content/injection.html (original) +++ websites/production/tapestry/content/injection.html Sat Oct 12 16:20:36 2013 @@ -193,16 +193,16 @@ private EmployeeService employeeService; pA large number of services are provided by Tapestry. See the following packages:/p -div class=navmenu style=float:left; width:12em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/package-summary.html;Core Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ajax/package-summary.html;AJAX Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/assets/package-summary.html;Assets Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/dynamic/package-summary.html;Dynamic Component Services/a/li/ul +div class=navmenu style=float:left; width:15em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/package-summary.html;Core Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ajax/package-summary.html;AJAX Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/assets/package-summary.html;Assets Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/dynamic/package-summary.html;Dynamic Component Services/a/li/ul /div -div class=navmenu style=float:left; width:12em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/package-summary.html;JavaScript Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/linktransform/package-summary.html;Link Transformation Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/messages/package-summary.html;Message Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/package-summary.html;Component Metadata Services/a/li/ul +div class=navmenu style=float:left; width:15em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/package-summary.html;JavaScript Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/linktransform/package-summary.html;Link Transformation Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/messages/package-summary.html;Message Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/package-summary.html;Component Metadata Services/a/li/ul /div -div class=navmenu style=float:left; width:12em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/pageload/package-summary.html;Page Loading Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/security/package-summary.html;Security Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/templates/package-summary.html;Template Services/a/lilia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/transform/package-summary.html;Class Transformation Services/a/li/ul +div class=navmenu style=float:left; width:15em; background:white; margin:3px; padding:3pxullia shape=rect class=external-link href=http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/pageload/package-summary.html;Page Loading