David,
I really think that the code adding Listeners to the ADMIN requests
is sweet - and no good deed goes unpunished. I really would like
similar code added both to the Render and Action code (i.e. check to
see if there is a listener registered with the container and hand the
request/response off to the listener *right before* the render and
action calls.
I need this to get some code to run inside the servlet to set a few
things in thread local so Sakai APIs work once portlets start. I am
guessing that many containers will want this same opportunity. It is
like a "light" Portlet filter. I am not suggesting a filter pattern
or a wrapping pattern - just give me a moment *right before* render
is called.
/Chuck
// The requested method is RENDER: call Portlet.render(..)
if (methodId == Constants.METHOD_RENDER) {
RenderRequestImpl renderRequest =
(RenderRequestImpl) portletRequest;
RenderResponseImpl renderResponse =
(RenderResponseImpl) portletResponse;
// check to see if there is a registered listener for
renders and call
portlet.render(renderRequest, renderResponse);
}
// The requested method is ACTION: call
Portlet.processAction(..)
else if (methodId == Constants.METHOD_ACTION) {
ActionRequestImpl actionRequest =
(ActionRequestImpl) portletRequest;
ActionResponseImpl actionResponse =
(ActionResponseImpl) portletResponse;
// check to see if there is a registered listener for
action and call
portlet.processAction(actionRequest, actionResponse);
}
// The requested method is ADMIN: call handlers.
else if (methodId == Constants.METHOD_ADMIN) {
ContainerInvocation inv =
ContainerInvocation.getInvocation();
PortalAdministrationService pas =
inv.getPortletContainer()
.getOptionalContainerServices()
.getPortalAdministrationService();
Iterator it = pas.getAdministrativeRequestListeners
().iterator();
while(it.hasNext()) {
AdministrativeRequestListener l =
(AdministrativeRequestListener)it.next();
l.administer(portletRequest, portletResponse);
}
}