cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <>
Subject [RT] Accessing environment information in 2.2
Date Mon, 11 Dec 2006 14:12:19 GMT
During development you sometimes face the problem that you need access
to specific information, like the current request object (or its
parameters), the Spring application context, the servlet context etc.

In an ideal world where everything is a component, this is no issue as
the container provides a way for this. But as we all know, the world is
not ideal and this means, you sometimes need access to those objects
when you don't have anything else to use.

So, I think we need a way to provide those information. The best choice
seems to be to use thread local variables.
I think we need a way to access the servlet context, the original http
request/response object and the current application context. (If you
have access to the current request object, you can get the application
context from the request).

The provide access to those things from everywhere the best way is to
have a general servlet filter putting the information into thread local
variables and cleaning them after the request is finished.

This approach has the drawback that users have to put this filter into
their web.xml. So I think we should make this a little bit more user
friendly and add the logic/code of this filter to all servlets we
provide by default (which means the servlet performs the code). So as
long as users are using our servlets, they get the information "for
free". In addition, we provide the servlet filter for users who might
want to use different servlets but need the same information.

Carsten Ziegeler - Chief Architect

View raw message