Bugs item #573653, was opened at 2002-06-25 10:44
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=104754&aid=573653&group_id=4754
Category: Tapestry
Group: bug
Status: Open
Resolution: None
Priority: 5
Submitted By: joe panico (jpanico)
Assigned to: Howard Lewis Ship (hship)
Summary: broken assets
Initial Comment:
Sometimes assets, like images and stylesheets, don't
show up in the browser.
The problem can be reproduced easily with a single page
Tapestry application that contains 25 Image components.
At least one Image is almost always broken per request.
(program attached at end).
Cause: Tapestry is not honoring the http/1.1 contract.
In http 1.1 TCP connections are persistent by default.
If one end of the http dialog wants to signal that a
connection is not persistent then it must use the
connection: close http header. The browsers become
slightly confused by Tapestry's behaviour. They send
multiple requests over a single connection, but
Tapestry closes the connection after responding to only
the first request. The browsers will make repeated
requests for the asset, but will eventually give up.
ResponseOutputStream.forceClose()
...
out.close();
...
Out is an OutputStream that ultimately nests to the
java.net.Socket outputStream. Calling close on a
socket's OutputStream is equivalent to calling
Socket.close().
Fix:
call out.flush() instead.
In fact, once you do that, forceClose is no longer
really needed. All you really need is to replace all
calls to forceClose with calls to forceFlush, and
ensure that the content-length gets set if not already.
------Home.html---------
<span jwcid="imageIterator">
<span jwcid="anImage"/>
</span>
------Home.jwc---------
<specification class="com.pixory.iconorama.Home">
<component id="imageIterator" type="Foreach">
<binding name="source" property-path="imageList"/>
</component>
<component id="anImage" type="Image">
<binding name="image"
property-path="components.imageIterator.value"/>
</component>
</specification>
------Home.java---------
public class Home extends BasePage
{
private static final int IMAGE_COUNT = 25;
private List _imageList;
public List getImageList()
{
if( _imageList == null)
{
_imageList = new ArrayList();
String aPackagePath = "/com/pixory/iconorama/";
for(int i=0;i<IMAGE_COUNT;i++)
{
String anImageName = "image" + i + ".jpg";
String aResourcePath = aPackagePath + anImageName;
_imageList.add( new PrivateAsset( aResourcePath) );
}
}
return _imageList;
}
}
...just dump 25 images in the directory that you run
this application from, named image[0-25].jpg, and you
should be able to see the problem.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=104754&aid=573653&group_id=4754
-------------------------------------------------------
This sf.net email is sponsored by: Jabber Inc.
Don't miss the IM event of the season | Special offer for OSDN members!
JabberConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer