1. Why does cocoon allow to declare only one request listener? I know I
could implement myself a delegating request listener that would follow
ChainOfResponsibility pattern but it would be much easier if cocoon just
picked up all request listeners declared.
2. Why is the listener looked up by name?
public RequestProcessor(ServletContext servletContext) {
this.servletContext = servletContext;
this.cocoonBeanFactory = (BeanFactory)
servletContext.getAttribute(ProcessingUtil.CONTAINER_CONTEXT_ATTR_NAME);
this.settings = (Settings)
this.cocoonBeanFactory.getBean(Settings.ROLE);
final String encoding = this.settings.getContainerEncoding();
if ( encoding == null ) {
this.containerEncoding = "ISO-8859-1";
} else {
this.containerEncoding = encoding;
}
this.log = (Logger)
this.cocoonBeanFactory.getBean(ProcessingUtil.LOGGER_ROLE);
this.processor =
(Processor)this.cocoonBeanFactory.getBean(Processor.ROLE);
this.environmentContext = new HttpContext(this.servletContext);
// get the optional request listener
if (this.cocoonBeanFactory.containsBean(RequestListener.ROLE)) {
^^^^^^^^^^^^^^^^^^^^
this.requestListener = (RequestListener)
this.cocoonBeanFactory.getBean(RequestListener.ROLE);
}
}
it would be much better to find all beans implementing RequestListener
interface. Spring's BeanFactoryUtils contain proper methods for this.
WDYT?
--
Leszek Gawron, IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65