You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Endre Stølsvik <En...@Stolsvik.com> on 2004/02/04 17:54:46 UTC

Re: confusion on rendering

On Mon, 19 Jan 2004, Stephan Hesmer wrote:

| Hi Nick,
| 
| due to the confusion on the mailing list, I implemented the dynamic 
| title functionality over the weekend. If nobody has objections I will 
| check the code into the repository by end of the day or tomorrow.
| 
| This is what I did:
| 1. I created a stored servlet response to cache the content of the portlet
| 2. I call container.renderPortlet earlier and pass a stored response, so 
| that I can write the dynamic title into the title field of the portlet's 
| window.
| 3. I introduced a new container service which allows me to transfer the 
| title from the container to the portal. This is conceptually the best 
| way as a portal can choose to support the dynamic title simply by 
| providing an implementation for this new interface. It is no mandatory 
| container service.

I just came over this the other day: the docs don't talk about this.

Isn't this performance-degradatory? I mean, this -requires- that the
content is buffered in a StringBuffer (or wherever), when it could instead
be streamed directly to the outputstream.
  Problems: Yet another object creation, memory allocation,
array-enlargement (potentially many times), StringBuffer-to-writer
streaming.

Indeed, the title-thing is also a problem at the API level: there is no
requirement that the setTitle() in RenderResponse must be called -first
thing- before anything else is output - this requires the implementation
to -have to- buffer the content.
  This is a slight disaster, in my opinion - if I am correct! Direct
stream output (or into the already potentially buffered stream from the
servlet container) MUST be possible.

Either the setTitle must be changed so that this have to be done before
the stream or writer is gotten (or else IllegalStateException is thrown),
or, preferrably, the Portlet itself must have getTitle() - a much better
approach in my opinion (since it must be invoked before the portlet output
is output) (then the GenericPortlet could have a default impl) - the
method invocation order would then be processAction(..), getTitle(),
render(...).

Title is a significant element of a Portlet - it should be i18n'ed, and 
context sensitive.

Endre