public class OpenSessionInViewInterceptor extends Object implements BeanFactoryAware, AsyncWebRequestInterceptor
This interceptor makes Neo4j OGM Sessions available via the current thread,
which will be autodetected by transaction managers. It is suitable for service
layer transactions via Neo4jTransactionManager
.
In contrast to OpenSessionInViewFilter
, this interceptor is set
up in a Spring application context and can thus take advantage of bean wiring.
OpenSessionInViewFilter
,
Neo4jTransactionManager
,
TransactionSynchronizationManager
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger
Logger available to subclasses
|
static String |
PARTICIPATE_SUFFIX
Suffix that gets appended to the SessionFactory toString
representation for the "participate in existing session
handling" request attribute.
|
Constructor and Description |
---|
OpenSessionInViewInterceptor() |
Modifier and Type | Method and Description |
---|---|
void |
afterCompletion(WebRequest request,
Exception ex) |
void |
afterConcurrentHandlingStarted(WebRequest request) |
protected String |
getParticipateAttributeName()
Return the name of the request attribute that identifies that a request is
already filtered.
|
org.neo4j.ogm.session.SessionFactory |
getSessionFactory()
Return the Neo4j OGM SessionFactory that should be used to create
Sessions.
|
void |
postHandle(WebRequest request,
ModelMap model) |
void |
preHandle(WebRequest request) |
void |
setBeanFactory(BeanFactory beanFactory)
Retrieves the default SessionFactory bean.
|
void |
setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Set the Neo4j OGM SessionFactory that should be used to create
Sessions.
|
protected final org.slf4j.Logger logger
public static final String PARTICIPATE_SUFFIX
public void setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
SessionFactory.openSession()
public org.neo4j.ogm.session.SessionFactory getSessionFactory()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
public void preHandle(WebRequest request) throws DataAccessException
preHandle
in interface WebRequestInterceptor
DataAccessException
public void postHandle(WebRequest request, ModelMap model)
postHandle
in interface WebRequestInterceptor
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException
afterCompletion
in interface WebRequestInterceptor
DataAccessException
public void afterConcurrentHandlingStarted(WebRequest request)
afterConcurrentHandlingStarted
in interface AsyncWebRequestInterceptor
protected String getParticipateAttributeName()
PARTICIPATE_SUFFIX
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.