public class OpenPersistenceManagerInViewFilter
extends org.springframework.web.filter.OncePerRequestFilter
This filter makes JDO PersistenceManagers available via the current thread,
which will be autodetected by transaction managers. It is suitable for service
layer transactions via JdoTransactionManager
or JtaTransactionManager
as well
as for non-transactional read-only execution.
Looks up the PersistenceManagerFactory in Spring's root web application context.
Supports a "persistenceManagerFactoryBeanName" filter init-param in web.xml
;
the default bean name is "persistenceManagerFactory".
OpenPersistenceManagerInViewInterceptor
,
JdoTransactionManager
,
PersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
,
TransactionSynchronizationManager
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_PERSISTENCE_MANAGER_FACTORY_BEAN_NAME |
Constructor and Description |
---|
OpenPersistenceManagerInViewFilter() |
Modifier and Type | Method and Description |
---|---|
protected void |
doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain filterChain) |
protected String |
getPersistenceManagerFactoryBeanName()
Return the bean name of the PersistenceManagerFactory to fetch from Spring's
root application context.
|
protected javax.jdo.PersistenceManagerFactory |
lookupPersistenceManagerFactory()
Look up the PersistenceManagerFactory that this filter should use.
|
protected javax.jdo.PersistenceManagerFactory |
lookupPersistenceManagerFactory(HttpServletRequest request)
Look up the PersistenceManagerFactory that this filter should use,
taking the current HTTP request as argument.
|
void |
setPersistenceManagerFactoryBeanName(String persistenceManagerFactoryBeanName)
Set the bean name of the PersistenceManagerFactory to fetch from Spring's
root application context.
|
doFilter, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatch
public static final String DEFAULT_PERSISTENCE_MANAGER_FACTORY_BEAN_NAME
public void setPersistenceManagerFactoryBeanName(String persistenceManagerFactoryBeanName)
protected String getPersistenceManagerFactoryBeanName()
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException
doFilterInternal
in class org.springframework.web.filter.OncePerRequestFilter
ServletException
IOException
protected javax.jdo.PersistenceManagerFactory lookupPersistenceManagerFactory(HttpServletRequest request)
Default implementation delegates to the lookupPersistenceManagerFactory
without arguments.
lookupPersistenceManagerFactory()
protected javax.jdo.PersistenceManagerFactory lookupPersistenceManagerFactory()
getPersistenceManagerFactoryBeanName()