tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Tapestry > Limitations
Date Wed, 01 Dec 2010 19:48:00 GMT
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/12/_/styles/combined.css?spaceKey=TAPESTRY&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/TAPESTRY/Limitations">Limitations</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~hlship">Howard
M. Lewis Ship</a>
                         <h4>Changes (1)</h4>
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >* The service implementation must
be on the file system (not inside a JAR). <br>* The implementation must be instantiated
by Tapestry, not inside code (even code inside a module class). <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">*
The service must use the default [scope|TAPESTRY:IoC - service] (reloading of perthread scopes
is not supported). <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Consider the following
example module: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Limitations-Limitations"></a>Limitations</h2>

<h3><a name="Limitations-HowdoIaddnewcomponentstoanexistingpagedynamically%3F"></a>How
do I add new components to an existing page dynamically?</h3>

<p>The short answer here is: <b>you don't</b>. The long answer here is <b>you
don't have to, to get the behavior you desire</b>.</p>

<p>One of Tapestry basic values is high scalability: this is expressed in a number of
ways, reflecting scalability concerns within a single server, and within a cluster of servers.</p>

<p>Although you code Tapestry pages and components as if they were ordinary POJOs<style
.FootnoteMarker, .FootnoteNum a {
  background: transparent url(/confluence/download/resources/com.adaptavist.confluence.footnoteMacros:footnote/gfx/footnote.png)
no-repeat top right;
  padding: 1px 2px 0px 1px;
  border-left: 1px solid #8898B8;
  border-bottom: 1px solid #6B7C9B;
  margin: 1px;
  text-decoration: none;
.FootnoteNum a {
  margin-top: 2px;
  margin-right: 0px;
.FootnoteNum {
  font-size: x-small;
  text-align: right;
  padding-bottom: 4px;
.footnote-th1 {
  text-align: right;
.Footnote {
  padding-left: 7px;
  margin-bottom: 4px;
  border: 1px none #DDDDDD;
  writingMode: tb-rl;
.accessibility {
     display: none;
     visibility: hidden;
@media aural,braille,embossed {
        .FootnoteMarker, .FootnoteNum a {
         border: 1px solid #000000;
         background: #ffffff none;
    .accessibility {
         display: run-in;
         visibility: visible;
<script type='text/javascript' language='JavaScript'>
var effectInProgress = {};
var despamEffect = function (id,effectType,duration) {
  if ((effectInProgress[id]) || (typeof(Effect)=="undefined") || (typeof(Effect[effectType])=="undefined"))
  new Effect[effectType](id);
var oldFootnoteId = '';
var footnoteHighlight = function(id,pulsateNum) {
  if (oldFootnoteId!='') document.getElementById('Footnote'+oldFootnoteId).style['borderStyle']
= 'none';
  oldFootnoteId = id;
  document.getElementById('Footnote'+id).style['borderStyle'] = 'solid';
  if (pulsateNum) despamEffect('FootnoteNum'+id,'Pulsate',3)
var footnoteMarkerHighlight = function(id) {
  if (oldFootnoteId!='') document.getElementById('Footnote'+oldFootnoteId).style['borderStyle']
= 'none';
  oldFootnoteId = '';

<sup id='FootnoteMarker1'>
    <a name='FootnoteMarker1'
        alt='Footnote: Click here to display the footnote'
        title='Footnote: Click here to display the footnote'
, as deployed by Tapestry they are closer to a traditional servlet: a single instance of each
page services requests from multiple threads. Behind the scenes, Tapestry transforms you code,
rewriting it on the fly.</p>

<p>What this means is that <em>any</em> incoming request must be handled
by a <em>single page instance</em>. Therefore, Tapestry enforces the concept of
<b>static structure, dynamic behavior</b>.</p>

<p>Tapestry provides quite a number of ways to vary what content is rendered, well beyond
simple conditionals and loops. It is possible to "drag in" components from other pages when
rendering a page (other FAQs will expand on this concept). The point is, that although a Tapestry
page's structure is very rigid, the order in which the components of the page render does
not have to be top to bottom.</p>

<h3><a name="Limitations-Whydoesn%27tmyserviceimplementationreloadwhenIchangeit%3F"></a>Why
doesn't my service implementation reload when I change it?</h3>

<p>Live service reloading has some limitations:</p>
	<li>The service must define a service interface.</li>
	<li>The service implementation must be on the file system (not inside a JAR).</li>
	<li>The implementation must be instantiated by Tapestry, not inside code (even code
inside a module class).</li>
	<li>The service must use the default <a href="/confluence/pages/createpage.action?spaceKey=TAPESTRY&amp;title=IoC+-+service&amp;linkCreation=true&amp;fromPageId=23334928"
class="createlink">scope</a> (reloading of perthread scopes is not supported).</li>

<p>Consider the following example module:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">public</span> <span class="code-keyword">static</span>
void bind(ServiceBinder binder)
  binder.bind(ArchiveService.class, ArchiveServiceImpl.class);

<span class="code-keyword">public</span> <span class="code-keyword">static</span>
JobQueue buildJobQueue(MessageService messageService, Map&lt;<span class="code-object">String</span>,Job&gt;
  JobQueueImpl service = <span class="code-keyword">new</span> JobQueueImpl(configuration);

  <span class="code-keyword">return</span> service;

<p>ArchiveService is reloadable, because Tapestry instantiates <tt>ArchiveServiceImpl</tt>
itself.  On the other hand, Tapestry invokes <tt>buildJobQueue()</tt> and it is
your code inside the method that instantiates <tt>JobQueueImpl</tt>, so the JobQueue
service will not be reloadable.</p>

<p>Finally, only classes whose class files are stored directly on the file system, and
not packaged inside JARs, are ever reloadable ... generally, only the services of the application
being built (and not services from libraries) will be stored on the file system. This reflects
the intent of reloading: as an agile development tool, but not something to be used in deployment.</p>

<hr />
<p><table class='Footnotes' style='width: 100%; border:none;' cellspacing='0' cellpadding='0'
summary='This table contains one or more notes for references made elsewhere on the page.'>
  <caption class='accessibility'>Footnotes</caption>
  <thead class='accessibility'>
    <tr class='accessibility'>
      <th class='accessibility' id='footnote-th1'>Reference</th>
      <th class='accessibility' id='footnote-th2'>Notes</th>
    <tr name='Footnote1'>
      <td valign='top' class='FootnoteNum' headings='footnote-th1'>
        <a href='#FootnoteMarker1'
          alt='Footnote: Click to return to reference in text'
          title='Footnote: Click to return to reference in text'
      <td id='Footnote1'
          Plain Old Java Object. Tapestry does not require you to extend any base classes
or implement any special interfaces.
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        <a href="https://cwiki.apache.org/confluence/display/TAPESTRY/Limitations">View
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=23334928&revisedVersion=12&originalVersion=11">View

View raw message