|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.web.servlet.handler.HandlerInterceptorAdapter
org.springframework.extensions.jcr.support.OpenSessionInViewInterceptor
public class OpenSessionInViewInterceptor
Spring web HandlerInterceptor that binds a JCR Session to the thread for the entire processing of the request. Intended for the "Open Session in View" pattern, i.e. to allow for lazy loading in web views despite the original transactions already being completed.
This filter works similar to the AOP JcrInterceptor: It just makes JCR Sessions available via the thread. It is suitable for non-transactional execution but also for middle tier transactions via JcrTransactionManager or JtaTransactionManager. In the latter case, Sessions pre-bound by this filter will automatically be used for the transactions.
In contrast to OpenSessionInViewFilter, this interceptor is set up in a Spring application context and can thus take advantage of bean wiring. It derives from JcrAccessor to inherit common JCR configuration properties.
| Field Summary | |
|---|---|
protected static org.slf4j.Logger |
LOG
|
static java.lang.String |
PARTICIPATE_SUFFIX
Suffix that gets appended to the SessionFactory toString representation for the "participate in existing persistence manager handling" request attribute. |
| Constructor Summary | |
|---|---|
OpenSessionInViewInterceptor()
|
|
| Method Summary | |
|---|---|
void |
afterCompletion(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler,
java.lang.Exception ex)
|
void |
afterPropertiesSet()
|
protected java.lang.String |
getParticipateAttributeName()
Return the name of the request attribute that identifies that a request is already filtered. |
SessionFactory |
getSessionFactory()
Return the JCR JcrSessionFactory that should be used to create Sessions. |
boolean |
preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler)
|
void |
setSessionFactory(SessionFactory sf)
Set the JCR JcrSessionFactory that should be used to create Sessions. |
| Methods inherited from class org.springframework.web.servlet.handler.HandlerInterceptorAdapter |
|---|
postHandle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PARTICIPATE_SUFFIX
getParticipateAttributeName(),
Constant Field Valuesprotected static final org.slf4j.Logger LOG
| Constructor Detail |
|---|
public OpenSessionInViewInterceptor()
| Method Detail |
|---|
public void setSessionFactory(SessionFactory sf)
public SessionFactory getSessionFactory()
public boolean preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler)
throws org.springframework.dao.DataAccessException
preHandle in interface org.springframework.web.servlet.HandlerInterceptorpreHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterorg.springframework.dao.DataAccessException
public void afterCompletion(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler,
java.lang.Exception ex)
throws org.springframework.dao.DataAccessException
afterCompletion in interface org.springframework.web.servlet.HandlerInterceptorafterCompletion in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterorg.springframework.dao.DataAccessExceptionprotected java.lang.String getParticipateAttributeName()
PARTICIPATE_SUFFIX
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.ExceptionInitializingBean.afterPropertiesSet()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||