Modified: websites/production/tapestry/content/error-page-recipe.html
==============================================================================
--- websites/production/tapestry/content/error-page-recipe.html (original)
+++ websites/production/tapestry/content/error-page-recipe.html Sat Feb 3
18:21:36 2018
@@ -27,6 +27,16 @@
</title>
<link type="text/css" rel="stylesheet" href="/resources/space.css" />
+ <link href='/resources/highlighter/styles/shCoreCXF.css'
rel='stylesheet' type='text/css' />
+ <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet'
type='text/css' />
+ <script src='/resources/highlighter/scripts/shCore.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
+ <script>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -67,7 +77,50 @@
</div>
<div id="content">
- <div
id="ConfluenceContent"><p><plain-text-body>{scrollbar}</plain-text-body></p><parameter
ac:name="hidden">true</parameter><parameter
ac:name="atlassian-macro-output-type">BLOCK</parameter><rich-text-body><p>Serving
up a Tapestry page as your site's custom 404 response
page</p></rich-text-body><h1
id="ErrorPageRecipe-ServingTapestryPagesasServletErrorPages">Serving Tapestry
Pages as Servlet Error Pages</h1><p>Do you want to dress up your site and use a
snazzy Tapestry page instead of the default 404 error page? Using modern
servlet containers, this is a snap!</p><parameter
ac:name="style">float:right</parameter><parameter ac:name="title">Related
Articles</parameter><parameter
ac:name="class">aui-label</parameter><rich-text-body><parameter
ac:name="showLabels">false</parameter><parameter
ac:name="showSpace">false</parameter><parameter ac:name="title">Related
Articles</parameter><parameter ac:name="cql">label = "errors" and space =
currentSpace()</parameter></rich-te
xt-body><p>Simply upgrade your application web.xml to the 2.4 version, and
make a couple of changes:</p><parameter
ac:name="language">xml</parameter><parameter
ac:name="title">web.xml</parameter><plain-text-body><?xml version="1.0"
encoding="UTF-8"?>
+ <div id="ConfluenceContent"><h1
id="ErrorPageRecipe-ServingTapestryPagesasServletErrorPages">Serving Tapestry
Pages as Servlet Error Pages</h1><p>Do you want to dress up your site and use a
snazzy Tapestry page instead of the default 404 error page? Using modern
servlet containers, this is a snap!</p><div class="aui-label"
style="float:right" title="Related Articles">
+
+
+
+
+
+
+
+
+<h3>Related Articles</h3>
+
+<ul class="content-by-label"><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="error-page-recipe.html">Error Page Recipe</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="specific-errors-faq.html">Specific Errors
FAQ</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a
href="overriding-exception-reporting.html">Overriding Exception Reporting</a>
+
+
+ </div>
+ </li></ul>
+</div>
+
+
+<p>Simply upgrade your application web.xml to the 2.4 version, and make a
couple of changes:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>web.xml</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
@@ -96,7 +149,9 @@
</error-page>
</web-app>
-</plain-text-body><p>Tapestry's filter must be marked as a handler for both
standard requests and errors. That's accomplished with the
<code><dispatcher></code> elements inside the
<code><filter-mapping></code> section.</p><p>You must then map error
codes to Tapestry URLs. In this case, the 404 error is send to the
<code>/error404</code> resource, which is really the "Error404" Tapestry
page.</p><p>We'll create a simple Error404 page, one that displays a message
and (in development mode) displays the details about the incoming
request.</p><parameter ac:name="language">xml</parameter><parameter
ac:name="title">Error404.tml</parameter><plain-text-body><html
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
+</pre>
+</div></div><p>Tapestry's filter must be marked as a handler for both standard
requests and errors. That's accomplished with the
<code><dispatcher></code> elements inside the
<code><filter-mapping></code> section.</p><p>You must then map error
codes to Tapestry URLs. In this case, the 404 error is send to the
<code>/error404</code> resource, which is really the "Error404" Tapestry
page.</p><p>We'll create a simple Error404 page, one that displays a message
and (in development mode) displays the details about the incoming
request.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>Error404.tml</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><html
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
<head>
<title>Resource not found.</title>
@@ -113,7 +168,9 @@
</div>
</body>
-</html></plain-text-body><p>The page simply makes the request and
productionMode properties available:</p><parameter
ac:name="language">java</parameter><parameter
ac:name="title">Error404.java</parameter><plain-text-body>package
com.example.newapp.pages;
+</html></pre>
+</div></div><p>The page simply makes the request and productionMode properties
available:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>Error404.java</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">package com.example.newapp.pages;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.annotations.Property;
@@ -134,7 +191,8 @@ public class Error404
}
-</plain-text-body><p>The end-result, in when <em>not</em> in production mode,
looks like this:</p><p><span class="confluence-embedded-file-wrapper
image-center-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image confluence-content-image-border image-center"
width="500"
src="error-page-recipe.data/Resource_not_found_.png"></span></p><rich-text-body><p>An
issue with an application that has a root Index page is that any invalid path,
which would normally generate a 404 error, is instead routed to the Index page
(because the invalid path looks like page's activation context). See <a
class="external-link"
href="https://issues.apache.org/jira/browse/TAP5-2070">Issue
TAP5-2070</a>.</p></rich-text-body></div>
+</pre>
+</div></div><p>The end-result, in when <em>not</em> in production mode, looks
like this:</p><p> </p><p><span class="confluence-embedded-file-wrapper
image-center-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image confluence-content-image-border image-center"
width="500"
src="error-page-recipe.data/Resource_not_found_.png"></span></p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>An issue with an application that
has a root Index page is that any invalid path, which would normally generate a
404 error, is instead routed to the Index page (because the invalid path looks
like page's activation context). See <a class="external-link"
href="https://issues.apache.org/jira/browse/TAP5-2070">Issue
TAP5-2070</a>.</p></div></div></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/extending-the-if-component.html
==============================================================================
--- websites/production/tapestry/content/extending-the-if-component.html
(original)
+++ websites/production/tapestry/content/extending-the-if-component.html Sat
Feb 3 18:21:36 2018
@@ -27,6 +27,16 @@
</title>
<link type="text/css" rel="stylesheet" href="/resources/space.css" />
+ <link href='/resources/highlighter/styles/shCoreCXF.css'
rel='stylesheet' type='text/css' />
+ <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet'
type='text/css' />
+ <script src='/resources/highlighter/scripts/shCore.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
+ <script>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -67,7 +77,8 @@
</div>
<div id="content">
- <div
id="ConfluenceContent"><plain-text-body>{scrollbar}</plain-text-body><parameter
ac:name="hidden">true</parameter><parameter
ac:name="atlassian-macro-output-type">BLOCK</parameter><rich-text-body><p>Adding
a type coercion to enable the If component to test for
anything</p></rich-text-body><h1
id="ExtendingtheIfComponent-ExtendingtheIfComponent">Extending the If
Component</h1><p>The <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/If.html">If</a>
component can be made very flexible; its main parameter, <code>test</code>,
does not <em>have</em> to be bound to a boolean value, it merely has to be
bound to a value that can be <a href="type-coercion.html">coerced</a> to
boolean.</p><p>For example, you may be working on an application that does a
lot of <a class="external-link"
href="http://lucene.apache.org/java/docs/index.html">Lucene</a> searches, and
you represent the results as a SearchResult obje
ct:</p><parameter ac:name="language">java</parameter><parameter
ac:name="title">SearchResult.java</parameter><plain-text-body>public class
SearchResult<T> {
+ <div id="ConfluenceContent"><h1
id="ExtendingtheIfComponent-ExtendingtheIfComponent">Extending the If
Component</h1><p>The <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/If.html">If</a>
component can be made very flexible; its main parameter, <code>test</code>,
does not <em>have</em> to be bound to a boolean value, it merely has to be
bound to a value that can be <a
href="extending-the-if-component.html">coerced</a> to boolean.</p><p>For
example, you may be working on an application that does a lot of <a
class="external-link"
href="http://lucene.apache.org/java/docs/index.html">Lucene</a> searches, and
you represent the results as a SearchResult object:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>SearchResult.java</b></div><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public class SearchResult<T> {
public final Class<T> itemType;
public final List<T> items;
public final int size;
@@ -89,12 +100,16 @@
return size == 0;
}
}
-</plain-text-body><p>In a SearchResult, the <code>size</code> property is the
overall number of results from the search. The <code>items</code> list is a
single "page" of those results to present to the user, consisting of items from
<code>firstIndex</code> to <code>lastIndex</code> within the overall
set.</p><p>In your templates, you have to check to see if the SearchResult
exists, then see if it is empty, before you can get to the part that displays
the content:</p><parameter
ac:name="language">xml</parameter><plain-text-body><t:if
test="searchResult">
+</pre>
+</div></div><p>In a SearchResult, the <code>size</code> property is the
overall number of results from the search. The <code>items</code> list is a
single "page" of those results to present to the user, consisting of items from
<code>firstIndex</code> to <code>lastIndex</code> within the overall
set.</p><p>In your templates, you have to check to see if the SearchResult
exists, then see if it is empty, before you can get to the part that displays
the content:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><t:if test="searchResult">
<t:if test="! searchResult.empty">
. . .
</t:if>
</t:if>
-</plain-text-body><p>The first test checks to see if <code>searchResult</code>
is not null (null is treated as false). The second checks to see if the search
result is empty.</p><p>What we'd like is for the test to look at the
<code>searchResult</code> directly and treat an empty search result as false,
and a non-empty search result as true. This is similar to what Tapestry already
does for Collections.</p><p>This is just a matter of extending the TypeCoercer
service:</p><parameter ac:name="language">java</parameter><parameter
ac:name="title">AppModule.java (partial)</parameter><plain-text-body>public
static void contributeTypeCoercer(Configuration<CoercionTuple>
configuration) {
+</pre>
+</div></div><p>The first test checks to see if <code>searchResult</code> is
not null (null is treated as false). The second checks to see if the search
result is empty.</p><p>What we'd like is for the test to look at the
<code>searchResult</code> directly and treat an empty search result as false,
and a non-empty search result as true. This is similar to what Tapestry already
does for Collections.</p><p>This is just a matter of extending the TypeCoercer
service:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>AppModule.java (partial)</b></div><div class="codeContent panelContent
pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public static void
contributeTypeCoercer(Configuration<CoercionTuple> configuration) {
add(configuration, SearchResult.class, Boolean.class,
new Coercion<SearchResult, Boolean>() {
@@ -111,10 +126,13 @@ private static <S, T> void add(Con
configuration.add(tuple);
}
-</plain-text-body><p>Inside this thicket of generics and brackets is the code
that treats a SearchResult as a boolean: <code>return
!input.isEmpty();</code>.</p><p>With this in place, the previous template can
be simplified:</p><parameter
ac:name="language">xml</parameter><plain-text-body><t:if
test="searchResult">
+</pre>
+</div></div><p>Inside this thicket of generics and brackets is the code that
treats a SearchResult as a boolean: <code>return
!input.isEmpty();</code>.</p><p>With this in place, the previous template can
be simplified:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><t:if test="searchResult">
. . .
</t:if>
-</plain-text-body><p>The single test now implies that
<code>searchResult</code> is not null and not empty.</p></div>
+</pre>
+</div></div><p>The single test now implies that <code>searchResult</code> is
not null and not empty.</p></div>
</div>
<div class="clearer"></div>
Modified:
websites/production/tapestry/content/forms-and-form-components-faq.html
==============================================================================
--- websites/production/tapestry/content/forms-and-form-components-faq.html
(original)
+++ websites/production/tapestry/content/forms-and-form-components-faq.html Sat
Feb 3 18:21:36 2018
@@ -27,6 +27,16 @@
</title>
<link type="text/css" rel="stylesheet" href="/resources/space.css" />
+ <link href='/resources/highlighter/styles/shCoreCXF.css'
rel='stylesheet' type='text/css' />
+ <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet'
type='text/css' />
+ <script src='/resources/highlighter/scripts/shCore.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
+ <script>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -67,7 +77,8 @@
</div>
<div id="content">
- <div
id="ConfluenceContent"><plain-text-body>{scrollbar}</plain-text-body><h2
id="FormsandFormComponentsFAQ-FormsandFormComponents">Forms and Form
Components</h2><p>Main article: <a href="forms-and-validation.html">Forms and
Validation</a></p><h3
id="FormsandFormComponentsFAQ-Whatisthet:formdatahiddenfieldfor?">What is the
<code>t:formdata</code> hidden field for?</h3><p>In Tapestry, rendering a form
can be a complicated process; inside the body of the Form component are many of
field components: TextField, Select, TextArea, and so forth. Each of these must
pull data out of your data model and convert it to the string form used inside
the client web browser. In addition, JavaScript to support client-side
validation must be generated. This can be further complicated by the use of
Loop and If components, or made really complicated by the use of Block (to
render portions of other pages: this is what the BeanEditForm component
does).</p><p>Along the way, the Form is gen
erating unique form control names for each field component, as it
renders.</p><p>When the client-side Form is submitted, an event is triggered on
the server-side Form component. It now needs to locate each component, in turn,
inform the component of its control name, and allow the component to read the
corresponding query parameter. The component then converts the client-side
string back into a server-side value and performs validations before updating
the data model.</p><p>That's where <code>t:formdata</code> comes in. While
components are rendering, they are using the FormSupport environmental object
to record callbacks:</p><parameter
ac:name="controls">true</parameter><parameter ac:name="title">FormSupport.java
(partial)</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body>public interface
FormSupport extends ClientElement
+ <div id="ConfluenceContent"><h2
id="FormsandFormComponentsFAQ-FormsandFormComponents">Forms and Form
Components</h2><p>Main article: <a
href="forms-and-form-components-faq.html">Forms and Form Components
FAQ</a></p><h3
id="FormsandFormComponentsFAQ-Whatisthet:formdatahiddenfieldfor?">What is the
<code>t:formdata</code> hidden field for?</h3><p>In Tapestry, rendering a form
can be a complicated process; inside the body of the Form component are many of
field components: TextField, Select, TextArea, and so forth. Each of these must
pull data out of your data model and convert it to the string form used inside
the client web browser. In addition, JavaScript to support client-side
validation must be generated. This can be further complicated by the use of
Loop and If components, or made really complicated by the use of Block (to
render portions of other pages: this is what the BeanEditForm component
does).</p><p>Along the way, the Form is generating unique form control
names for each field component, as it renders.</p><p>When the client-side Form
is submitted, an event is triggered on the server-side Form component. It now
needs to locate each component, in turn, inform the component of its control
name, and allow the component to read the corresponding query parameter. The
component then converts the client-side string back into a server-side value
and performs validations before updating the data model.</p><p>That's where
<code>t:formdata</code> comes in. While components are rendering, they are
using the FormSupport environmental object to record callbacks:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>FormSupport.java
(partial)</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;">public interface FormSupport extends ClientElement
{
/**
* Stores an action for execution during a later request. If the action
contains any mutable state, it should be in
@@ -84,16 +95,25 @@
* @param action the action that will be triggered (and passed the
component)
*/
<T> void storeAndExecute(T component, ComponentAction<T>
action);
-</plain-text-body><p>The <code>ComponentAction</code> objects are the
callbacks. <code>t:formdata</code> is simply an object stream of these
callbacks, compressed and encoded in Base64. When using Ajax, you may see
multiple <code>t:formdata</code> hidden fields (they are processed one after
another).</p><h3
id="FormsandFormComponentsFAQ-HowdoIchangethelabelforafieldonthefly?">How do I
change the label for a field on the fly?</h3><p>Tapestry tries to be smart
about generating the label string for a field. It has some smart default logic,
first checking for the <em>component-id</em><code>-label</code> in the
container's message catalog, then ultimately converting the component's id into
a user-presentable label.</p><p>You can override the label in two
ways:</p><p>First, you can supply a body to the <code>Label</code>
component:</p><parameter ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> <t:label
for="username">${usernameLa
bel}</t:label>
+</pre>
+</div></div><p>The <code>ComponentAction</code> objects are the callbacks.
<code>t:formdata</code> is simply an object stream of these callbacks,
compressed and encoded in Base64. When using Ajax, you may see multiple
<code>t:formdata</code> hidden fields (they are processed one after
another).</p><h3
id="FormsandFormComponentsFAQ-HowdoIchangethelabelforafieldonthefly?">How do I
change the label for a field on the fly?</h3><p>Tapestry tries to be smart
about generating the label string for a field. It has some smart default logic,
first checking for the <em>component-id</em><code>-label</code> in the
container's message catalog, then ultimately converting the component's id into
a user-presentable label.</p><p>You can override the label in two
ways:</p><p>First, you can supply a body to the <code>Label</code>
component:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> <t:label
for="username">${usernameLabel}</t:label>
<t:textfield t:id="username"/>
-</plain-text-body><p>Here, the component class must provide a
<code>usernameLabel</code> property. That property becomes the text of the
label. An implementation of the property might look something
like:</p><parameter ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> public String
getUsernameLabel()
+</pre>
+</div></div><p>Here, the component class must provide a
<code>usernameLabel</code> property. That property becomes the text of the
label. An implementation of the property might look something like:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> public String getUsernameLabel()
{
return systemPreferences.useEmailAddressForUserName() ? "Email address" :
"User name";
}
-</plain-text-body><p>However, if there are any validations on the field, the
error message will include the default label (as discussed above).</p><p>To
uniformly update the label both on the page, and in any validation messages,
bind the TextField's <code>label</code> parameter:</p><parameter
ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> <t:label
for="username"/>
+</pre>
+</div></div><p>However, if there are any validations on the field, the error
message will include the default label (as discussed above).</p><p>To uniformly
update the label both on the page, and in any validation messages, bind the
TextField's <code>label</code> parameter:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> <t:label for="username"/>
<t:textfield t:id="username" label="prop:usernameLabel"/>
-</plain-text-body><p>The "prop:" prefix identifies that "usernameLabel" is to
be interpreted as a property expression (normally, the binding for the
<code>label</code> parameter is interpreted as a string literal). The Label
component gets the text it displays from the TextField component, and the
TextField component uses the same text when generating server-side and
client-side validation messages.</p><h3
id="FormsandFormComponentsFAQ-Tapestryfocusesonthewrongfieldinmyform,howdoIfixthat?">Tapestry
focuses on the wrong field in my form, how do I fix that?</h3><p>Tapestry
normally figures out the correct field in your form to initially receive focus;
this is based on assigning a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/FieldFocusPriority.html">FieldFocusPriority</a>
to each field as it renders, which works out to the following
logic:</p><ul><li>The first field which has an error</li><li>Or, the first
field which is required</li><
li>Or, the first field</li></ul><p>Occasionally, due a wide range of factors
beyond Tapestry's control, it's selection will not be quite what you want, and
it is necessary to supply an override. The information is tracked inside the <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a>
environmental. It's just a matter of injecting the component so that you can
determine its client id, then informing JavaScriptSupport about your
override.</p><p>Here's an example</p><plain-text-body> <t:textfield
t:id="email" t:mixins="OverrideFieldFocus" .../>
-</plain-text-body><p>The <a class="external-link"
href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/mixins/OverrideFieldFocus.html">OverrideFieldFocus</a>
mixin forces the email field to be the focus field,
regardless.</p><plain-text-body>{scrollbar}</plain-text-body></div>
+</pre>
+</div></div><p>The "prop:" prefix identifies that "usernameLabel" is to be
interpreted as a property expression (normally, the binding for the
<code>label</code> parameter is interpreted as a string literal). The Label
component gets the text it displays from the TextField component, and the
TextField component uses the same text when generating server-side and
client-side validation messages.</p><h3
id="FormsandFormComponentsFAQ-Tapestryfocusesonthewrongfieldinmyform,howdoIfixthat?">Tapestry
focuses on the wrong field in my form, how do I fix that?</h3><p>Tapestry
normally figures out the correct field in your form to initially receive focus;
this is based on assigning a <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/FieldFocusPriority.html">FieldFocusPriority</a>
to each field as it renders, which works out to the following
logic:</p><ul><li>The first field which has an error</li><li>Or, the first
field which is required</li><li>Or,
the first field</li></ul><p>Occasionally, due a wide range of factors beyond
Tapestry's control, it's selection will not be quite what you want, and it is
necessary to supply an override. The information is tracked inside the <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a>
environmental. It's just a matter of injecting the component so that you can
determine its client id, then informing JavaScriptSupport about your
override.</p><p>Here's an example</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"> <t:textfield t:id="email"
t:mixins="OverrideFieldFocus" .../>
+</pre>
+</div></div><p>The <a class="external-link"
href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/mixins/OverrideFieldFocus.html">OverrideFieldFocus</a>
mixin forces the email field to be the focus field, regardless.</p></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/general-questions.html
==============================================================================
--- websites/production/tapestry/content/general-questions.html (original)
+++ websites/production/tapestry/content/general-questions.html Sat Feb 3
18:21:36 2018
@@ -27,6 +27,16 @@
</title>
<link type="text/css" rel="stylesheet" href="/resources/space.css" />
+ <link href='/resources/highlighter/styles/shCoreCXF.css'
rel='stylesheet' type='text/css' />
+ <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet'
type='text/css' />
+ <script src='/resources/highlighter/scripts/shCore.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
+ <script>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -67,7 +77,16 @@
</div>
<div id="content">
- <div
id="ConfluenceContent"><plain-text-body>{scrollbar}</plain-text-body><h2
id="GeneralQuestions-GeneralQuestions">General Questions</h2><p></p><h3
id="GeneralQuestions-HowdoIgetstartedwithTapestry?">How do I get started with
Tapestry?</h3><p>The easiest way to get started is to use <a
class="external-link" href="http://maven.apache.org">Apache Maven</a> to create
your initial project; Maven can use an <em>archetype</em> (a kind of project
template) to create a bare-bones Tapestry application for you. See the <a
href="getting-started.html">Getting Started</a> page for more
details.</p><p>Even without Maven, Tapestry is quite easy to set up. You just
need to <a href="download.html">download</a> the binaries and setup your build
to place them inside your WAR's WEB-INF/lib folder. The rest is just some
one-time <a href="configuration.html">configuration of the web.xml deployment
descriptor</a>.</p><h3
id="GeneralQuestions-WhydoesTapestryusePrototype?Whynotinsertfa
voriteJavaScriptlibraryhere?">Why does Tapestry use Prototype? Why not
<em>insert favorite JavaScript library here</em>?</h3><p>An important goal for
Tapestry is seamless DHTML and Ajax integration. To serve that goal, it was
important that the built in components be capable of Ajax operations, such as
dynamically re-rendering parts of the page. Because of that, it made sense to
bundle a well-known JavaScript library as part of Tapestry.</p><p>At the time
(this would be 2006-ish), Prototype and Scriptaculous were well known and well
documented, and jQuery was just getting started.</p><p>The intent has always
been to make this aspect of Tapestry pluggable. Tapestry 5.4 includes the
option of either Prototype or jQuery Tapestry 5.5 will remove Prototype as an
option..</p><h3
id="GeneralQuestions-WhydoesTapestryhaveitsownInversionofControlContainer?WhynotSpringorGuice?">Why
does Tapestry have its own Inversion of Control Container? Why not Spring or
Guice?</h3><p>An Inversion of Contro
l Container is <em>the</em> key piece of Tapestry's infrastructure. It is
absolutely necessary to create software as robust, performant ,and extensible
as Tapestry.</p><p>Tapestry IoC includes a number of features that distinguish
itself from other containers:</p><ul><li>Configured in code, not
XML</li><li>Built-in extension mechanism for services: configurations and
contributions</li><li>Built-in aspect oriented programming model (service
decorations and advice)</li><li>Easy modularization</li><li>Best-of-breed
exception reporting</li></ul><p>Because Tapestry is implemented on top of its
IoC container, and because the container makes it easy to extend or replace any
service inside the container, it is possible to make the small changes to
Tapestry needed to customize it to any project's needs.</p><h3
id="GeneralQuestions-HowdoIupgradefromTapestry4toTapestry5?">How do I upgrade
from Tapestry 4 to Tapestry 5?</h3><p>There is no existing tool that supports
upgrading from Tapestry 4 to
Tapestry 5; Tapestry 5 is a complete rewrite.</p><p>Many of the basic
concepts in Tapestry 4 are still present in Tapestry 5, but refactored,
improved, streamlined, and simplified. The basic concept of pages, templates
and components are largely the same. Other aspects, such as server-side event
handling, is markedly different.</p><h3
id="GeneralQuestions-HowdoIupgradefromoneversionofTapestry5toanother?">How do I
upgrade from one version of Tapestry 5 to another?</h3><p>A lot of effort goes
into making an upgrade from one Tapestry 5 release to another go smoothly. In
the general case, it is just a matter of updating the version number in your
Maven <code>build.xml</code> or Gradle <code>build.gradle</code> file and
executing the appropriate commands (e.g., <code>gradle idea</code> or <code>mvn
eclipse:eclipse</code>) to bring your local workspace up to date with the
latest binaries.</p><p>After changing dependencies, you should always perform a
clean recompile of your application.<
/p><p>We make every effort to ensure backwards-compatibility. Tapestry is
mostly coded in terms of interfaces; those interfaces are stable to a point:
interfaces your code is expected to implement are usually completely frozen;
interfaces your code is expected to invoke, such as the interfaces to IoC
services, are stable, but may have new methods added in a release; existing
methods are not changed.</p><p>In <em>rare</em> cases a choice is necessary
between fixing bugs (or adding essential functionality) and maintaining
complete backwards compatibility; in those cases, an incompatible change may be
introduced. These are always discussed in detail in the <a
href="release-notes.html">Release Notes</a> for the specific release. You
should always read the release notes before attempting an upgrade, and always
(really, <em>always</em>) be prepared to retest your application
afterwards.</p><p>Note that you should be careful any time you make use of
<strong>internal</strong> APIs (you can
tell an API is internal by the package name,
<code>org.apache.tapestry5.internal...</code>. Internal APIs may change <em>at
any time</em>; there's no guarantee of backwards compatibility. Please always
check on the documentation, or consult the user mailing list, to see if there's
a stable, public alternative. If you do make use of internal APIs, be sure to
get a discussion going so that your needs can be met in the future by a stable,
public API.</p><p><span style="color: rgb(83,145,38);font-size:
16.0px;line-height: 1.5625;">Why are there both Request and
HttpServletRequest?</span></p><p>Tapestry's Request interface is <em>very</em>
close to the standard HttpServletRequest interface. It differs in a few ways,
omitting some unneeded methods, and adding a couple of new methods (such as
<code>isXHR()</code>), as well as changing how some existing methods operate.
For example, <code>getParameterNames()</code> returns a sorted List of Strings;
HttpServletRequest returns an Enumeration
, which is a very dated approach.</p><p>However, the stronger reason for
Request (and the related interfaces Response and Session) is to enable the
support for Portlets at some point in the future. By writing code in terms of
Tapestry's Request, and not HttpServletRequest, you can be assured that the
same code will operate in both Servlet Tapestry and Portlet
Tapestry.</p><plain-text-body>{scrollbar}</plain-text-body></div>
+ <div id="ConfluenceContent"><h2
id="GeneralQuestions-GeneralQuestions">General Questions</h2><p><style
type="text/css">/*<![CDATA[*/
+div.rbtoc1517682034135 {padding: 0px;}
+div.rbtoc1517682034135 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1517682034135 li {margin-left: 0px;padding-left: 0px;}
+
+/*]]>*/</style></p><div class="toc-macro rbtoc1517682034135">
+<ul class="toc-indentation"><li><a
href="#GeneralQuestions-GeneralQuestions">General Questions</a>
+<ul class="toc-indentation"><li><a
href="#GeneralQuestions-HowdoIgetstartedwithTapestry?">How do I get started
with Tapestry?</a></li><li><a
href="#GeneralQuestions-WhydoesTapestryusePrototype?WhynotinsertfavoriteJavaScriptlibraryhere?">Why
does Tapestry use Prototype? Why not insert favorite JavaScript library
here?</a></li><li><a
href="#GeneralQuestions-WhydoesTapestryhaveitsownInversionofControlContainer?WhynotSpringorGuice?">Why
does Tapestry have its own Inversion of Control Container? Why not Spring or
Guice?</a></li><li><a
href="#GeneralQuestions-HowdoIupgradefromTapestry4toTapestry5?">How do I
upgrade from Tapestry 4 to Tapestry 5?</a></li><li><a
href="#GeneralQuestions-HowdoIupgradefromoneversionofTapestry5toanother?">How
do I upgrade from one version of Tapestry 5 to another?</a></li></ul>
+</li></ul>
+</div><h3 id="GeneralQuestions-HowdoIgetstartedwithTapestry?">How do I get
started with Tapestry?</h3><p>The easiest way to get started is to use <a
class="external-link" href="http://maven.apache.org">Apache Maven</a> to create
your initial project; Maven can use an <em>archetype</em> (a kind of project
template) to create a bare-bones Tapestry application for you. See the <a
href="general-questions.html">General Questions</a> page for more
details.</p><p>Even without Maven, Tapestry is quite easy to set up. You just
need to <a href="general-questions.html">download</a> the binaries and setup
your build to place them inside your WAR's WEB-INF/lib folder. The rest is just
some one-time <a href="general-questions.html">configuration of the web.xml
deployment descriptor</a>.</p><h3
id="GeneralQuestions-WhydoesTapestryusePrototype?WhynotinsertfavoriteJavaScriptlibraryhere?">Why
does Tapestry use Prototype? Why not <em>insert favorite JavaScript library
here</em>?</h3><p>An importan
t goal for Tapestry is seamless DHTML and Ajax integration. To serve that
goal, it was important that the built in components be capable of Ajax
operations, such as dynamically re-rendering parts of the page. Because of
that, it made sense to bundle a well-known JavaScript library as part of
Tapestry.</p><p>At the time (this would be 2006-ish), Prototype and
Scriptaculous were well known and well documented, and jQuery was just getting
started.</p><p>The intent has always been to make this aspect of Tapestry
pluggable. Tapestry 5.4 includes the option of either Prototype or jQuery
Tapestry 5.5 will remove Prototype as an option..</p><h3
id="GeneralQuestions-WhydoesTapestryhaveitsownInversionofControlContainer?WhynotSpringorGuice?">Why
does Tapestry have its own Inversion of Control Container? Why not Spring or
Guice?</h3><p>An Inversion of Control Container is <em>the</em> key piece of
Tapestry's infrastructure. It is absolutely necessary to create software as
robust, performant ,an
d extensible as Tapestry.</p><p>Tapestry IoC includes a number of features
that distinguish itself from other containers:</p><ul><li>Configured in code,
not XML</li><li>Built-in extension mechanism for services: configurations and
contributions</li><li>Built-in aspect oriented programming model (service
decorations and advice)</li><li>Easy modularization</li><li>Best-of-breed
exception reporting</li></ul><p>Because Tapestry is implemented on top of its
IoC container, and because the container makes it easy to extend or replace any
service inside the container, it is possible to make the small changes to
Tapestry needed to customize it to any project's needs.</p><h3
id="GeneralQuestions-HowdoIupgradefromTapestry4toTapestry5?">How do I upgrade
from Tapestry 4 to Tapestry 5?</h3><p>There is no existing tool that supports
upgrading from Tapestry 4 to Tapestry 5; Tapestry 5 is a complete
rewrite.</p><p>Many of the basic concepts in Tapestry 4 are still present in
Tapestry 5, but refactor
ed, improved, streamlined, and simplified. The basic concept of pages,
templates and components are largely the same. Other aspects, such as
server-side event handling, is markedly different.</p><h3
id="GeneralQuestions-HowdoIupgradefromoneversionofTapestry5toanother?">How do I
upgrade from one version of Tapestry 5 to another?</h3><p>A lot of effort goes
into making an upgrade from one Tapestry 5 release to another go smoothly. In
the general case, it is just a matter of updating the version number in your
Maven <code>build.xml</code> or Gradle <code>build.gradle</code> file and
executing the appropriate commands (e.g., <code>gradle idea</code> or <code>mvn
eclipse:eclipse</code>) to bring your local workspace up to date with the
latest binaries.</p><p>After changing dependencies, you should always perform a
clean recompile of your application.</p><p>We make every effort to ensure
backwards-compatibility. Tapestry is mostly coded in terms of interfaces; those
interfaces are stable
to a point: interfaces your code is expected to implement are usually
completely frozen; interfaces your code is expected to invoke, such as the
interfaces to IoC services, are stable, but may have new methods added in a
release; existing methods are not changed.</p><p>In <em>rare</em> cases a
choice is necessary between fixing bugs (or adding essential functionality) and
maintaining complete backwards compatibility; in those cases, an incompatible
change may be introduced. These are always discussed in detail in the <a
href="general-questions.html">General Questions</a> for the specific release.
You should always read the release notes before attempting an upgrade, and
always (really, <em>always</em>) be prepared to retest your application
afterwards.</p><p>Note that you should be careful any time you make use of
<strong>internal</strong> APIs (you can tell an API is internal by the package
name, <code>org.apache.tapestry5.internal...</code>. Internal APIs may change
<em>at any ti
me</em>; there's no guarantee of backwards compatibility. Please always check
on the documentation, or consult the user mailing list, to see if there's a
stable, public alternative. If you do make use of internal APIs, be sure to get
a discussion going so that your needs can be met in the future by a stable,
public API.</p><p><span style="color: rgb(83,145,38);">Why are there both
Request and HttpServletRequest?</span></p><p>Tapestry's Request interface is
<em>very</em> close to the standard HttpServletRequest interface. It differs in
a few ways, omitting some unneeded methods, and adding a couple of new methods
(such as <code>isXHR()</code>), as well as changing how some existing methods
operate. For example, <code>getParameterNames()</code> returns a sorted List of
Strings; HttpServletRequest returns an Enumeration, which is a very dated
approach.</p><p>However, the stronger reason for Request (and the related
interfaces Response and Session) is to enable the support for Portlets
at some point in the future. By writing code in terms of Tapestry's Request,
and not HttpServletRequest, you can be assured that the same code will operate
in both Servlet Tapestry and Portlet Tapestry.</p></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/google-app-engine.html
==============================================================================
--- websites/production/tapestry/content/google-app-engine.html (original)
+++ websites/production/tapestry/content/google-app-engine.html Sat Feb 3
18:21:36 2018
@@ -44,13 +44,26 @@
<div class="wrapper bs">
- <div id="navigation"><div class="nav"><ul class="alternate"><li><a
href="index.html">Home</a></li><li><a href="getting-started.html">Getting
Started</a></li><li><a href="documentation.html">Documentation</a></li><li><a
href="download.html">Download</a></li><li><a
href="about.html">About</a></li><li><a class="external-link"
href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a
href="community.html">Community</a></li><li><a class="external-link"
href="http://www.apache.org/security/">Security</a></li><li><a
class="external-link" href="http://www.apache.org/">Apache</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div></div>
+ <div id="navigation"><div class="nav"><ul class="alternate"><li><a
href="index.html">Home</a></li><li><a href="getting-started.html">Getting
Started</a></li><li><a href="documentation.html">Documentation</a></li><li><a
href="download.html">Download</a></li><li><a
href="about.html">About</a></li><li><a class="external-link"
href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a
href="community.html">Community</a></li><li><a class="external-link"
href="http://www.apache.org/security/">Security</a></li><li><a
class="external-link" href="http://www.apache.org/">Apache</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div>
+
+</div>
<div id="top">
- <div id="smallbanner"><div class="searchbox"
style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999;
font-size: 90%">Tapestry docs, issues, wikis & blogs:</span><form
enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
- <input type="text" name="q">
- <input type="submit" value="Search">
-</form></div><div class="emblem" style="float:left"><p><a
href="index.html"><span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div><div
class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Google App Engine</h1></div></div>
+ <div id="smallbanner"><div class="searchbox"
style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999;
font-size: 90%">Tapestry docs, issues, wikis & blogs:</span>
+<form enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
+ <input type="text" name="q">
+ <input type="submit" value="Search">
+</form>
+
+</div>
+
+
+<div class="emblem" style="float:left"><p><a href="index.html"><span
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image
confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div>
+
+
+<div class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Google App Engine</h1></div>
+
+</div>
<div class="clearer"></div>
</div>
@@ -73,7 +86,7 @@
configuration.add(IOCSymbols.THREAD_POOL_ENABLED, "false");
...
     }</pre>
-</div></div><p>NOTE: Setting production mode to true is generally only
desirable in production and QA/testing environments, but you can override that
symbol with a JVM system property
(<code>-Dtapestry.production-mode=false</code>) in those environments.</p><h2
id="GoogleAppEngine-SerializableObjects">Serializable Objects</h2><ul><li>Make
sure all objects that you store in the servlet session -- particularly those
annotated with @SessionState and @SessionAttribute – are
actually serializable types. Otherwise you may see strange behavior in which
objects seem to lose their session values.</li></ul><h2
id="GoogleAppEngine-FileUploads">File Uploads</h2><ul><li>If you use the
Tapestry-upload module (or any file upload mechanism, for that matter), you'll
need to be sure that it is configured to <em>not</em> store temporary uploaded
files on the file system.  See <a href="uploading-files.html">Uploading
Files</a> – particularly the <code>upload.repository-
threshold</code> symbol, which should be set to a large value.</li></ul><h2
id="GoogleAppEngine-OtherConsiderations">Other Considerations</h2><p>Other than
the above settings, Tapestry should provide no impediment to running your app
under Google App Engine. However, you still need to adhere to all of GAE's
usual constraints (as with any app, Tapestry or otherwise). Please carefully
read Google's documentation for general guidelines for creating an app that is
compatible with GAE.</p></div>
+</div></div><p>NOTE: Setting production mode to true is generally only
desirable in production and QA/testing environments, but you can override that
symbol with a JVM system property
(<code>-Dtapestry.production-mode=false</code>) in those environments.</p><h2
id="GoogleAppEngine-SerializableObjects">Serializable Objects</h2><ul><li>Make
sure all objects that you store in the servlet session -- particularly those
annotated with @SessionState and @SessionAttribute – are
actually serializable types. Otherwise you may see strange behavior in which
objects seem to lose their session values.</li></ul><h2
id="GoogleAppEngine-FileUploads">File Uploads</h2><ul><li>If you use the
Tapestry-upload module (or any file upload mechanism, for that matter), you'll
need to be sure that it is configured to <em>not</em> store temporary uploaded
files on the file system.  See <a href="google-app-engine.html">Google
App Engine</a> – particularly the <code>upload.reposit
ory-threshold</code> symbol, which should be set to a large
value.</li></ul><h2 id="GoogleAppEngine-OtherConsiderations">Other
Considerations</h2><p>Other than the above settings, Tapestry should provide no
impediment to running your app under Google App Engine. However, you still need
to adhere to all of GAE's usual constraints (as with any app, Tapestry or
otherwise). Please carefully read Google's documentation for general guidelines
for creating an app that is compatible with GAE.</p></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/hibernate-support-faq.html
==============================================================================
--- websites/production/tapestry/content/hibernate-support-faq.html (original)
+++ websites/production/tapestry/content/hibernate-support-faq.html Sat Feb 3
18:21:36 2018
@@ -77,7 +77,7 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><h2
id="HibernateSupportFAQ-HibernateSupport">Hibernate Support</h2><p>Main
article: <a href="hibernate.html">Hibernate</a></p><h3
id="HibernateSupportFAQ-HowdoIgetHibernatetostartupupwhentheapplicationstartsup,ratherthanlazilywiththefirstrequestfortheapplication?">How
do I get Hibernate to startup up when the application starts up, rather than
lazily with the first request for the application?</h3><p>This was a minor
problem in 5.0; by 5.1 it is just a matter of overriding the configuration
system <code>tapestry.hibernate-early-startup</code> to "true".</p></div>
+ <div id="ConfluenceContent"><h2
id="HibernateSupportFAQ-HibernateSupport">Hibernate Support</h2><p>Main
article: <a href="hibernate-support-faq.html">Hibernate Support FAQ</a></p><h3
id="HibernateSupportFAQ-HowdoIgetHibernatetostartupupwhentheapplicationstartsup,ratherthanlazilywiththefirstrequestfortheapplication?">How
do I get Hibernate to startup up when the application starts up, rather than
lazily with the first request for the application?</h3><p>This was a minor
problem in 5.0; by 5.1 it is just a matter of overriding the configuration
system <code>tapestry.hibernate-early-startup</code> to "true".</p></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/how-to-upgrade.html
==============================================================================
--- websites/production/tapestry/content/how-to-upgrade.html (original)
+++ websites/production/tapestry/content/how-to-upgrade.html Sat Feb 3
18:21:36 2018
@@ -67,7 +67,7 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><p>Upgrading from one Tapestry
version to the next is usually quite easy. Backward compatibility is one of
Tapestry's <a href="principles.html">core principles</a>. Even so, sometimes a
checklist comes in handy to be sure you consider all of the implications of an
upgrade.</p><h2 id="HowtoUpgrade-BeforeYouUpgrade">Before You
Upgrade</h2><ol><li>Check the <a
href="supported-environments-and-versions.html"><strong>Supported Environments
and Versions</strong></a> matrix for Java and app server
compatibility.</li><li><strong>Check 3rd Party compatibility:</strong> Find out
whether your 3rd party modules are compatible with the new version of Tapestry.
Although the Tapestry developers try very hard to maintain backward
compatibility across versions, sometimes an older version of a 3rd party module
(particularly if it uses internal APIs) won't work with a newly-released
version of Tapestry, and in that case you may have to wait until that 3rd
party module is updated by its developers.</li><li><strong>Find and replace
all calls to deprecated APIs.</strong> Those are the places most likely to be
broken after the upgrade. Most IDEs make it easy to find all deprecated items.
In Eclipse, for example, the "Problems" view will show warnings for the use of
deprecated APIs if you set it to show "All Errors/Warnings on
Project".</li><li><strong>Read the Release Notes:</strong> Each Tapestry
version has a <a href="release-notes.html">Release Notes</a> document that
lists all of the changes, including some that may cause compatibility issues
with your current code. You will save yourself a lot of frustration if you
carefully read this material before proceeding.</li></ol><h2
id="HowtoUpgrade-Upgrading">Upgrading</h2><ol><li><strong>Upgrade one step at a
time:</strong> It is usually best to upgrade to each intermediate version of
Tapestry rather than skipping ahead multiple versions. Skipping versions
(except for minor bug fix relea
ses) makes it harder to find all calls to deprecated APIs (see
above).</li><li><strong>Update your POM (or download the JARs
manually):</strong> If you're using Maven (or Gradle), update the version of
the Tapestry dependencies in your pom.xml (or build.gradle) file. Remember to
keep all of the Tapestry-supplied modules in sync. For example, don't forget to
update the version of Tapestry-hibernate, Tapestry-spring, Tapestry-upload,
etc.</li><li><strong>Remove old Tapestry JARs:</strong> If you're not using
Maven or Gradle (e.g. if you have the Tapestry JARs in your lib directory), be
sure you remove older versions of Tapestry JARs (including JARs for any
Tapestry-supplied modules).</li></ol><h2
id="HowtoUpgrade-AfterYouUpgrade">After You Upgrade</h2><ol><li><strong>Remove
cached JavaScript:</strong> Tapestry's internal JavaScript may change between
releases, and your web browser may have cached the older version. If you have
set a specific <a href="configuration.html">application v
ersion</a> in your application's module class (usually AppModule.java), you
should increment it to ensure that the URLs to the JavaScript files will have a
new version number in their paths. Doing so will cause the browser to download
the latest versions from your server. Alternatively, you can just clear your
browser's cache (and have all your developers and testers do the same).
<em>This issue is usually not a problem on production servers, since you will
likely increment the application version with each new production
release.</em></li></ol></div>
+ <div id="ConfluenceContent"><p>Upgrading from one Tapestry
version to the next is usually quite easy. Backward compatibility is one of
Tapestry's <a href="how-to-upgrade.html">core principles</a>. Even so,
sometimes a checklist comes in handy to be sure you consider all of the
implications of an upgrade.</p><h2 id="HowtoUpgrade-BeforeYouUpgrade">Before
You Upgrade</h2><ol><li><strong>Check 3rd Party compatibility:</strong> Find
out whether your 3rd party modules are compatible with the new version of
Tapestry. Although the Tapestry developers try very hard to maintain backward
compatibility across versions, sometimes an older version of a 3rd party module
(particularly if it uses internal APIs) won't work with a newly-released
version of Tapestry, and in that case you may have to wait until that 3rd party
module is updated by its developers.</li><li><strong>Find and replace all calls
to deprecated APIs.</strong> Those are the places most likely to be broken
after th
e upgrade. Most IDEs make it easy to find all deprecated items. In Eclipse,
for example, the "Problems" view will show warnings for the use of deprecated
APIs if you set it to show "All Errors/Warnings on
Project".</li><li><strong>Read the Release Notes:</strong> Each Tapestry
version has a <a href="how-to-upgrade.html">How to Upgrade</a> document that
lists all of the changes, including some that may cause compatibility issues
with your current code. You will save yourself a lot of frustration if you
carefully read this material before proceeding.</li></ol><h2
id="HowtoUpgrade-Upgrading">Upgrading</h2><ol><li><strong>Upgrade one step at a
time:</strong> It is usually best to upgrade to each intermediate version of
Tapestry rather than skipping ahead multiple versions. Skipping versions
(except for minor bug fix releases) makes it harder to find all calls to
deprecated APIs (see above).</li><li><strong>Update your POM (or download the
JARs manually):</strong> If you're using Maven
(or Gradle), update the version of the Tapestry dependencies in your pom.xml
(or build.gradle) file. Remember to keep all of the Tapestry-supplied modules
in sync. For example, don't forget to update the version of Tapestry-hibernate,
Tapestry-spring, Tapestry-upload, etc.</li><li><strong>Remove old Tapestry
JARs:</strong> If you're not using Maven or Gradle (e.g. if you have the
Tapestry JARs in your lib directory), be sure you remove older versions of
Tapestry JARs (including JARs for any Tapestry-supplied modules).</li></ol><h2
id="HowtoUpgrade-AfterYouUpgrade">After You Upgrade</h2><ol><li><strong>Remove
cached JavaScript:</strong> Tapestry's internal JavaScript may change between
releases, and your web browser may have cached the older version. If you have
set a specific <a href="how-to-upgrade.html">application version</a> in your
application's module class (usually AppModule.java), you should increment it to
ensure that the URLs to the JavaScript files will have a new versio
n number in their paths. Doing so will cause the browser to download the
latest versions from your server. Alternatively, you can just clear your
browser's cache (and have all your developers and testers do the same).
<em>This issue is usually not a problem on production servers, since you will
likely increment the application version with each new production
release.</em></li></ol><p></p></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/injection-faq.html
==============================================================================
--- websites/production/tapestry/content/injection-faq.html (original)
+++ websites/production/tapestry/content/injection-faq.html Sat Feb 3 18:21:36
2018
@@ -27,6 +27,16 @@
</title>
<link type="text/css" rel="stylesheet" href="/resources/space.css" />
+ <link href='/resources/highlighter/styles/shCoreCXF.css'
rel='stylesheet' type='text/css' />
+ <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet'
type='text/css' />
+ <script src='/resources/highlighter/scripts/shCore.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
+ <script>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -67,13 +77,22 @@
</div>
<div id="content">
- <div
id="ConfluenceContent"><plain-text-body>{scrollbar}</plain-text-body><h2
id="InjectionFAQ-Injection">Injection</h2><p>Main article: <a
href="injection.html">Injection</a></p><h3
id="InjectionFAQ-What'sthedifferencebetweenthe@Componentand@InjectComponentannotations?">What's
the difference between the <code>@Component</code> and
<code>@InjectComponent</code> annotations?</h3><p>The <code>@Component</code>
annotation is used to define the <em>type</em> of component, and its parameter
bindings. When using <code>@Component</code>, the template must not define the
type, and any parameter bindings are merged in:</p><parameter
ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> <a t:id="home"
class="nav">Back to home</a>
-</plain-text-body><parameter ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body>
@Component(parameters={ "page=index" })
+ <div id="ConfluenceContent"><h2
id="InjectionFAQ-Injection">Injection</h2><p>Main article: <a
href="injection-faq.html">Injection FAQ</a></p><h3
id="InjectionFAQ-What'sthedifferencebetweenthe@Componentand@InjectComponentannotations?">What's
the difference between the <code>@Component</code> and
<code>@InjectComponent</code> annotations?</h3><p>The <code>@Component</code>
annotation is used to define the <em>type</em> of component, and its parameter
bindings. When using <code>@Component</code>, the template must not define the
type, and any parameter bindings are merged in:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> <a t:id="home" class="nav">Back to
home</a>
+</pre>
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> @Component(parameters={ "page=index" })
private PageLink home;
-</plain-text-body><p>Here the type of component is defined by the field type.
The field name is matched against the <code>t:id</code> in the template. The
<code>page</code> parameter is set in the Java class, and the informal
<code>class</code> parameter is set in the template. If the tag in the template
was <code><t:pagelink></code>, or if the template tag included the
attribute <code>t:type="pagelink"</code>, then you would see an
exception.</p><p>By contrast, <code>@InjectComponent</code> expects the
component to be already defined, and doesn't allow any configuration of
it:</p><parameter ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> <t:form
t:id="login"> .... </t:form>
-</plain-text-body><parameter ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> @InjectComponent
+</pre>
+</div></div><p>Here the type of component is defined by the field type. The
field name is matched against the <code>t:id</code> in the template. The
<code>page</code> parameter is set in the Java class, and the informal
<code>class</code> parameter is set in the template. If the tag in the template
was <code><t:pagelink></code>, or if the template tag included the
attribute <code>t:type="pagelink"</code>, then you would see an
exception.</p><p>By contrast, <code>@InjectComponent</code> expects the
component to be already defined, and doesn't allow any configuration of
it:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> <t:form t:id="login"> .... </t:form>
+</pre>
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> @InjectComponent
private Form login;
-</plain-text-body><p>Again, we're matching the field name to the component id,
and you would get an error if the component is not defined in the
template.</p><h3
id="InjectionFAQ-What'sthedifferencebetweenthe@InjectPageand@InjectContainerannotations?">What's
the difference between the <code>@InjectPage</code> and
<code>@InjectContainer</code> annotations?</h3><p>The <code>@InjectPage</code>
annotation is used to inject some page in the application into a field of some
other page. You often see it used from event handler methods:</p><parameter
ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> @InjectPage
+</pre>
+</div></div><p>Again, we're matching the field name to the component id, and
you would get an error if the component is not defined in the template.</p><h3
id="InjectionFAQ-What'sthedifferencebetweenthe@InjectPageand@InjectContainerannotations?">What's
the difference between the <code>@InjectPage</code> and
<code>@InjectContainer</code> annotations?</h3><p>The <code>@InjectPage</code>
annotation is used to inject some page in the application into a field of some
other page. You often see it used from event handler methods:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> @InjectPage
private ConfirmRegistration confirmRegistration;
Object onSuccessFromRegistrationForm()
@@ -83,21 +102,31 @@
return confirmRegistration;
}
-</plain-text-body><p>This code pattern is used to configure peristent
properties of a page before returning it; Tapestry will send a client redirect
to the page to present the data.</p><p><code>@InjectContainer</code> can be
used inside a component or a mixin. In a component, it injects the immediate
container of the component; this is often the top-level page object.</p><p>In a
mixin, it injects the component to which the mixin is attached.</p><h3
id="InjectionFAQ-IgetanexceptionbecauseIhavetwoserviceswiththesameinterface,howdoIhandlethis?">I
get an exception because I have two services with the same interface, how do I
handle this?</h3><p>It's not uncommon to have two or more services that
implement the exact same interface. When you inject, you might start by just
identifying the type of service to inject:</p><parameter
ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> @Inject
+</pre>
+</div></div><p>This code pattern is used to configure peristent properties of
a page before returning it; Tapestry will send a client redirect to the page to
present the data.</p><p><code>@InjectContainer</code> can be used inside a
component or a mixin. In a component, it injects the immediate container of the
component; this is often the top-level page object.</p><p>In a mixin, it
injects the component to which the mixin is attached.</p><h3
id="InjectionFAQ-IgetanexceptionbecauseIhavetwoserviceswiththesameinterface,howdoIhandlethis?">I
get an exception because I have two services with the same interface, how do I
handle this?</h3><p>It's not uncommon to have two or more services that
implement the exact same interface. When you inject, you might start by just
identifying the type of service to inject:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> @Inject
private ComponentEventResultProcessor processor;
-</plain-text-body><p>Which results in the error: <strong>Service interface
org.apache.tapestry5.services.ComponentEventResultProcessor is matched by 3
services: AjaxComponentEventResultProcessor, ComponentEventResultProcessor,
ComponentInstanceResultProcessor. Automatic dependency resolution requires that
exactly one service implement the interface.</strong></p><p>We need more
information than just the service interface type in order to identify which of
the three services to inject. One possibility is to inject with the correct
service id:</p><parameter ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body>
@InjectService("ComponentEventResultProcessor")
+</pre>
+</div></div><p>Which results in the error: <strong>Service interface
org.apache.tapestry5.services.ComponentEventResultProcessor is matched by 3
services: AjaxComponentEventResultProcessor, ComponentEventResultProcessor,
ComponentInstanceResultProcessor. Automatic dependency resolution requires that
exactly one service implement the interface.</strong></p><p>We need more
information than just the service interface type in order to identify which of
the three services to inject. One possibility is to inject with the correct
service id:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> @InjectService("ComponentEventResultProcessor")
private ComponentEventResultProcessor processor;
-</plain-text-body><p>This works ... but it is clumsy. If the service id,
"ComponentEventResultProcessor", ever changes, this code will break. It's not
<em>refactoring safe</em>.</p><p>Instead, we should use marker annotations. If
we look at <code>TapestryModule</code>, where the ComponentEventResultProcessor
service is defined, we'll see it identifies the necessary
markers:</p><parameter ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> @Marker(
+</pre>
+</div></div><p>This works ... but it is clumsy. If the service id,
"ComponentEventResultProcessor", ever changes, this code will break. It's not
<em>refactoring safe</em>.</p><p>Instead, we should use marker annotations. If
we look at <code>TapestryModule</code>, where the ComponentEventResultProcessor
service is defined, we'll see it identifies the necessary markers:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> @Marker(
{ Primary.class, Traditional.class })
public ComponentEventResultProcessor buildComponentEventResultProcessor(
Map<Class, ComponentEventResultProcessor> configuration)
{
return constructComponentEventResultProcessor(configuration);
}
-</plain-text-body><p>When a service has marker annotations, the annotations
present at the <em>point of injection</em> (the field, method parameter, or
constructor parameter) are used to select a matching service. The list of
services that match by type is then filtered to only include services that have
all of the marker annotations present at the point of injection.</p><parameter
ac:name="controls">true</parameter><parameter
ac:name="linenumbers">true</parameter><plain-text-body> @Inject
+</pre>
+</div></div><p>When a service has marker annotations, the annotations present
at the <em>point of injection</em> (the field, method parameter, or constructor
parameter) are used to select a matching service. The list of services that
match by type is then filtered to only include services that have all of the
marker annotations present at the point of injection.</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: true; theme: Default"
style="font-size:12px;"> @Inject
@Traditional @Primary
private ComponentEventResultProcessor processor;
-</plain-text-body><p>The two marker annotations, <code>@Traditional</code> and
<code>@Primary</code>, ensure that only a single service matches.</p><h3
id="InjectionFAQ-What'sthedifferencebetween@Injectand@Environmental?">What's
the difference between <code>@Inject</code> and
<code>@Environmental</code>?</h3><p><code>@Inject</code> is relatively general;
it can be used to inject resources specific to a page or component (such as
ComponentResources, Logger, or Messages), or it can inject services or other
objects obtained from the Tapestry IoC container. Once the page is loaded, the
values for these injections never change.</p><p><code>@Environmental</code> is
different; it exposes a request-scoped, dynamically bound
value:</p><ul><li>"Request scoped": different threads (processing different
requests) will see different values when reading the
field.</li><li>"Dynamically bound": the value is explicitly placed into the
Environment, and can be overridden at any time.</li></ul><p>Enviro
nmentals are a form of loosely connected communication between an outer
component (or even a service) and an inner component. Example: the Form
component places a <code>FormSupport</code> object into the environment. Other
components, such as TextField, use the <code>FormSupport</code> when rendering
to perform functions such as allocate unique control names or register
client-side validations. The TextField doesn't require that the Form component
be the immediate container component, or even an ancestor: a Form on one page
may, indirectly, communicate with a TextField on some entirely different page.
Neither component directly links to the other, the <code>FormSupport</code> is
the conduit that connects them.</p><p>The term "Environmental" was chosen as
the value "comes from the environment".</p><h3
id="InjectionFAQ-Butwait...IseeIusedthe@Injectannotationanditstillworked.Whatgives?">But
wait ... I see I used the <code>@Inject</code> annotation and it still worked.
What gives?</h3><
p>In certain cases, Tapestry exposes a service (which can be injected) that is
a proxy to the environmental; this is primarily for common environmentals, such
as <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a>,
that may be needed outside of component classes. You can see this in
TapestryModule:</p><parameter ac:name="">Java</parameter><parameter
ac:name="title">TapestryModule.java (partial)</parameter><plain-text-body>
/**
+</pre>
+</div></div><p>The two marker annotations, <code>@Traditional</code> and
<code>@Primary</code>, ensure that only a single service matches.</p><h3
id="InjectionFAQ-What'sthedifferencebetween@Injectand@Environmental?">What's
the difference between <code>@Inject</code> and
<code>@Environmental</code>?</h3><p><code>@Inject</code> is relatively general;
it can be used to inject resources specific to a page or component (such as
ComponentResources, Logger, or Messages), or it can inject services or other
objects obtained from the Tapestry IoC container. Once the page is loaded, the
values for these injections never change.</p><p><code>@Environmental</code> is
different; it exposes a request-scoped, dynamically bound
value:</p><ul><li>"Request scoped": different threads (processing different
requests) will see different values when reading the
field.</li><li>"Dynamically bound": the value is explicitly placed into the
Environment, and can be overridden at any time.</li></ul><p>Environmenta
ls are a form of loosely connected communication between an outer component
(or even a service) and an inner component. Example: the Form component places
a <code>FormSupport</code> object into the environment. Other components, such
as TextField, use the <code>FormSupport</code> when rendering to perform
functions such as allocate unique control names or register client-side
validations. The TextField doesn't require that the Form component be the
immediate container component, or even an ancestor: a Form on one page may,
indirectly, communicate with a TextField on some entirely different page.
Neither component directly links to the other, the <code>FormSupport</code> is
the conduit that connects them.</p><p>The term "Environmental" was chosen as
the value "comes from the environment".</p><h3
id="InjectionFAQ-Butwait...IseeIusedthe@Injectannotationanditstillworked.Whatgives?">But
wait ... I see I used the <code>@Inject</code> annotation and it still worked.
What gives?</h3><p>In c
ertain cases, Tapestry exposes a service (which can be injected) that is a
proxy to the environmental; this is primarily for common environmentals, such
as <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a>,
that may be needed outside of component classes. You can see this in
TapestryModule:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>TapestryModule.java (partial)</b></div><div class="codeContent
panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"> /**
* Builds a proxy to the current {@link JavaScriptSupport} inside this
thread's {@link Environment}.
*
* @since 5.2.0
@@ -106,11 +135,14 @@
{
return environmentalBuilder.build(JavaScriptSupport.class);
}
-</plain-text-body><p>This kind of logic is based on the <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/EnvironmentalShadowBuilder.html">EnvironmentalShadowBuilder</a>
service.</p><h3
id="InjectionFAQ-Ok,butRequestisasingletonservice,notanenvironmental,andIcaninjectthat.IsTapestryreallythreadsafe?">Ok,
but Request is a singleton service, not an environmental, and I can inject
that. Is Tapestry really thread safe?</h3><p>Yes, of course Tapestry is thread
safe. The Request service is another special case, as seen in
TapestryModule:</p><parameter ac:name="">Java</parameter><parameter
ac:name="title">TapestryModule.java (partial)</parameter><plain-text-body>
public Request buildRequest()
+</pre>
+</div></div><p>This kind of logic is based on the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/EnvironmentalShadowBuilder.html">EnvironmentalShadowBuilder</a>
service.</p><h3
id="InjectionFAQ-Ok,butRequestisasingletonservice,notanenvironmental,andIcaninjectthat.IsTapestryreallythreadsafe?">Ok,
but Request is a singleton service, not an environmental, and I can inject
that. Is Tapestry really thread safe?</h3><p>Yes, of course Tapestry is thread
safe. The Request service is another special case, as seen in
TapestryModule:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>TapestryModule.java (partial)</b></div><div class="codeContent
panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"> public Request buildRequest()
{
return shadowBuilder.build(requestGlobals, "request", Request.class);
}
-</plain-text-body><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/RequestGlobals.html">RequestGlobals</a>
is a per-thread service. The Request service is a global singleton created by
the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/PropertyShadowBuilder.html">PropertyShadowBuilder</a>
service, but is just a proxy. It has no internal state; invoking a method on
the Request service just turns around and extracts the Request object from the
per-thread RequestGlobals and invokes the same method there.</p><h3
id="InjectionFAQ-Iuse@Injectonafieldtoinjectaservice,butthefieldisstillnull,whathappened?">I
use <code>@Inject</code> on a field to inject a service, but the field is
still null, what happened?</h3><p>This can happen when you use the wrong
<code>@Inject</code> annotation; for example, com.google.inject.Inject instead
of org.apache.tapestry5.ioc.annotations.Inj
ect. This can occur when you have TestNG on the classpath, for example, and
your IDE is too helpful. Double check your imports when things seem
weird.</p><p>Also remember that <code>@Inject</code> on fields works for
components and for service implementations or other objects that Tapestry
instantiates, but not on arbitrary objects (that are created via Java's new
keyword).</p><plain-text-body>{scrollbar}</plain-text-body></div>
+</pre>
+</div></div><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/RequestGlobals.html">RequestGlobals</a>
is a per-thread service. The Request service is a global singleton created by
the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/PropertyShadowBuilder.html">PropertyShadowBuilder</a>
service, but is just a proxy. It has no internal state; invoking a method on
the Request service just turns around and extracts the Request object from the
per-thread RequestGlobals and invokes the same method there.</p><h3
id="InjectionFAQ-Iuse@Injectonafieldtoinjectaservice,butthefieldisstillnull,whathappened?">I
use <code>@Inject</code> on a field to inject a service, but the field is
still null, what happened?</h3><p>This can happen when you use the wrong
<code>@Inject</code> annotation; for example, com.google.inject.Inject instead
of org.apache.tapestry5.ioc.annotations.Inject. T
his can occur when you have TestNG on the classpath, for example, and your IDE
is too helpful. Double check your imports when things seem weird.</p><p>Also
remember that <code>@Inject</code> on fields works for components and for
service implementations or other objects that Tapestry instantiates, but not on
arbitrary objects (that are created via Java's new keyword).</p></div>
</div>
<div class="clearer"></div>