There is an advantage of the Filter over the Dispatcher.
The filter is a nested chain, delegating to the next chain from within
the code. It's like a normal servlet filter.
My security filter stores the user of the session into a thread local
and after the request, cleans up the thread local again. This is
necessary as the the Thread is reused in an application server. Here is
the code of the service method
Best Regards
Sebastian Hennebrueder
public boolean service(Request request, Response response,
RequestHandler handler) throws IOException {
String pageName = extractPage(request);
if (pageName != null && !checkAccess(pageName, request,
response)) {
return true;
}
boolean result;
BibaSessionState state =
sessionStateManager.get(BibaSessionState.class);
try {
userStorage.storeUser(state);
result = handler.service(request, response);
} finally {
userStorage.cleanUp(state);
}
return result;
}
Ulrich Stärk schrieb:
In Tapestry, Request abstracts away from either a HttpServletRequest or
a PortletRequest (not implemented yet). So to make your application work
in both a Portlet and a Servlet context, you have to use the Request.
But since you have to get hold of the HttpServletRequest you are
nevertheless stuck to a Servlet context and it doesn't matter whether
you write a HttpServletRequestFilter, a RequestFilter (and inject the
HttpServletRequest) or a Dispatcher (and inject the HttpServletRequest).
Just choose one.
Uli
Andrey Larionov schrieb:
It's not a hack, but RequestFilters services Request not an
HttpServletRequest.
On Thu, Aug 20, 2009 at 19:15, Thiago H. de Paula
Figueiredo<thiag...@gmail.com> wrote:
Em Thu, 20 Aug 2009 11:54:02 -0300, Andrey Larionov
<anlario...@gmail.com>
escreveu:
Thanks. I decide to try HttpServletRequestFilter, couse injecting
HttpServletRequest in Dispatcher or RequestFilter looks like a hack.
I don't consider it a hack (injecting services into services is
absolutely
normal in Tapestry and Tapestry-IoC), but an HttpServletRequestFilter
is a
valid choice too.
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
--
Best Regards / Viele Grüße
Sebastian Hennebrueder
-----
Software Developer and Trainer for Hibernate / Java Persistence
http://www.laliluna.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org