public class OpenSessionInViewInterceptor extends Object implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.web.context.request.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(org.springframework.web.context.request.WebRequest request,
Exception ex) |
void |
afterConcurrentHandlingStarted(org.springframework.web.context.request.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(org.springframework.web.context.request.WebRequest request,
org.springframework.ui.ModelMap model) |
void |
preHandle(org.springframework.web.context.request.WebRequest request) |
void |
setBeanFactory(org.springframework.beans.factory.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(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
org.springframework.beans.BeansException
public void preHandle(org.springframework.web.context.request.WebRequest request) throws org.springframework.dao.DataAccessException
preHandle
in interface org.springframework.web.context.request.WebRequestInterceptor
org.springframework.dao.DataAccessException
public void postHandle(org.springframework.web.context.request.WebRequest request, org.springframework.ui.ModelMap model)
postHandle
in interface org.springframework.web.context.request.WebRequestInterceptor
public void afterCompletion(org.springframework.web.context.request.WebRequest request, Exception ex) throws org.springframework.dao.DataAccessException
afterCompletion
in interface org.springframework.web.context.request.WebRequestInterceptor
org.springframework.dao.DataAccessException
public void afterConcurrentHandlingStarted(org.springframework.web.context.request.WebRequest request)
afterConcurrentHandlingStarted
in interface org.springframework.web.context.request.AsyncWebRequestInterceptor
protected String getParticipateAttributeName()
PARTICIPATE_SUFFIX
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.