You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Klaus Hildner <kl...@hildner.de> on 2001/05/16 11:56:03 UTC

general question on portlet refresh

Hello,

I have got a general + basic question. I might violate the philosophy of
a portlet which could be considered to be an interface into a mostly
"read-only" web application. Please correct me.

My problem is: There are situations when the portal page is reloaded, i.
e.

- explicit browser refresh, or
- posting a form in a portlet towards the portal.

During this process, the service() methods of *all* the contained
portlets are reinvoked (be it necessary or not):

- So if I have a portlet with a service() method + a counter
  inside, this counter becomes incremented (state change).
- If this portlet invokes methods on other objects (e. g.
  methods not considered to be "redone"), those *are* in fact
  redone.
- PortletRequest.getParameterNames() are only available to
  the previously-posted-to-portlet on subsequent refreshes;
  all the other portlets cannot re-retrieve their parameters.

(Am I right?)

This causes problems with portlets that rely

- on always receiving some "useful" request parameters
  (well, this can be made robust) and
- on being able to redisplay the previous output
  without changing the internal state.



In my special case, I have a portlet which forwards all requests to a
servlet instance. It does so by simply instantiating the servlet +
providing special "faked" implementations of ServletConfig,
HttpServletRequest, HttpServletResponse, RequestDispatcher, and other
interfaces that do the mapping from servlet methods to portlet methods,
and then invoking:

myServlet.init(fakedConfig);                    [once]
[...]
myServlet.service(fakedRequest, fakedResponse); [upon every request]

This works fine so far.



My problem now is caching output:

- If I did not invoke the servlet's service() method,
  nothing would be displayed.
- If I kept a reference to the previous PortletResponse object,
  that would not help me, as it would not allow me to "replay"
  (like a tape being rewound + playing the same music stream again)
  the output to the PrintWriter.

Is there anybody out there with a large trout who can knock it on my
head to push me in the right direction? I would not want to implement a
"buffering" PrintWriter to solve the problem though I already have
overridden some of the code in javax.servlet.ServletResponse.getWriter()
that returns it during the task of mapping from a ServletResponse to a
PortletResponse. "Buffering" means that PrintWriter would record the
history of all the method invocations + data passed to it (i. e.
print(int), print(String), println(int), println(String), write(int),
write(String), etc.) + be able to "replay" it upon explicit request.

Are there other solutions someone can think of here?

Kind regards

Klaus
--
klaus@hildner.de
mobile: +49-173-310-6491
accept-language: en-us, de


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org