Hi,
On 11/21/06, Jukka Zitting <[EMAIL PROTECTED]> wrote:
> What do you think about storing the jcr session in the servlet session
> and use a requestlistener to synchronize the access to the jcr session?.
> On each request a lock would be acquired on the jcr session and released
> only when the request is over. This wouldn't allow two request to access
> the session simultaneously.
Sounds good. A Filter like the following is in fact probably the
easiest way to achieve synchronization:
public void doFilter(
ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpSession httpSession = ((HttpServletRequest) request).getSession();
Session jcrSession = httpSession.getAttribute(SESSION_KEY);
synchronized (jcrSession) {
request.setAttribute(SESSION_KEY, jcrSession);
try {
chain.doFilter(request, response);
} finally {
request.removeAttribute(SESSION_KEY);
}
}
}
Perhaps this could be combined with the current LoginFilter functionality?
good idea!, I was thinking in a requestlistener, but a servlet filter
seems a better way. I'll try it asap.
br,
edgar
BR,
Jukka Zitting