public class OpenPersistenceManagerInViewFilter extends 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
,
JdoInterceptor
,
JdoTransactionManager
,
PersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
,
TransactionSynchronizationManager
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_PERSISTENCE_MANAGER_FACTORY_BEAN_NAME |
ALREADY_FILTERED_SUFFIX
logger
Constructor and Description |
---|
OpenPersistenceManagerInViewFilter() |
Modifier and Type | Method and Description |
---|---|
protected void |
doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain filterChain)
Same contract as for
doFilter , but guaranteed to be
just invoked once per request within a single request thread. |
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
addRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
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
OncePerRequestFilter
doFilter
, but guaranteed to be
just invoked once per request within a single request thread.
See OncePerRequestFilter.shouldNotFilterAsyncDispatch()
for details.
Provides HttpServletRequest and HttpServletResponse arguments instead of the default ServletRequest and ServletResponse ones.
doFilterInternal
in class 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()