|
||||||||||
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.orm.jdo.support.OpenPersistenceManagerInViewInterceptor
public class OpenPersistenceManagerInViewInterceptor
Spring web HandlerInterceptor that binds a JDO PersistenceManager to the thread for the entire processing of the request. Intended for the "Open PersistenceManager 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 JdoInterceptor: It just makes JDO PersistenceManagers available via the thread. It is suitable for non-transactional execution but also for middle tier transactions via JdoTransactionManager or JtaTransactionManager. In the latter case, PersistenceManagers pre-bound by this filter will automatically be used for the transactions.
In contrast to OpenPersistenceManagerInViewFilter, this interceptor is set up in a Spring application context and can thus take advantage of bean wiring. It derives from JdoAccessor to inherit common JDO configuration properties.
OpenPersistenceManagerInViewFilter
,
JdoInterceptor
,
JdoTransactionManager
,
PersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
,
TransactionSynchronizationManager
Field Summary | |
---|---|
protected Log |
logger
|
static String |
PARTICIPATE_SUFFIX
Suffix that gets appended to the PersistenceManagerFactory toString representation for the "participate in existing persistence manager handling" request attribute. |
Constructor Summary | |
---|---|
OpenPersistenceManagerInViewInterceptor()
|
Method Summary | |
---|---|
void |
afterCompletion(HttpServletRequest request,
HttpServletResponse response,
Object handler,
Exception ex)
This implementation is empty. |
protected String |
getParticipateAttributeName()
Return the name of the request attribute that identifies that a request is already filtered. |
javax.jdo.PersistenceManagerFactory |
getPersistenceManagerFactory()
Return the JDO PersistenceManagerFactory that should be used to create PersistenceManagers. |
boolean |
preHandle(HttpServletRequest request,
HttpServletResponse response,
Object handler)
This implementation always returns true. |
void |
setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
Set the JDO PersistenceManagerFactory that should be used to create PersistenceManagers. |
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 String PARTICIPATE_SUFFIX
getParticipateAttributeName()
,
Constant Field Valuesprotected final Log logger
Constructor Detail |
---|
public OpenPersistenceManagerInViewInterceptor()
Method Detail |
---|
public void setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
public javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws DataAccessException
HandlerInterceptorAdapter
preHandle
in interface HandlerInterceptor
preHandle
in class HandlerInterceptorAdapter
request
- current HTTP requestresponse
- current HTTP responsehandler
- chosen handler to execute, for type and/or instance evaluation
true
if the execution chain should proceed with the
next interceptor or the handler itself. Else, DispatcherServlet assumes
that this interceptor has already dealt with the response itself.
DataAccessException
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws DataAccessException
HandlerInterceptorAdapter
afterCompletion
in interface HandlerInterceptor
afterCompletion
in class HandlerInterceptorAdapter
request
- current HTTP requestresponse
- current HTTP responsehandler
- chosen handler to execute, for type and/or instance examinationex
- exception thrown on handler execution, if any
DataAccessException
protected String getParticipateAttributeName()
PARTICIPATE_SUFFIX
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |