org.springframework.web.context.request.async.WebAsyncManager Java Examples

The following examples show how to use org.springframework.web.context.request.async.WebAsyncManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResponseBodyEmitterReturnValueHandlerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test // gh-21972
public void responseBodyFluxWithError() throws Exception {

	this.request.addHeader("Accept", "text/event-stream");

	MethodParameter type = on(TestController.class).resolveReturnType(Flux.class, String.class);
	EmitterProcessor<String> processor = EmitterProcessor.create();
	this.handler.handleReturnValue(processor, type, this.mavContainer, this.webRequest);

	assertTrue(this.request.isAsyncStarted());

	IllegalStateException ex = new IllegalStateException("wah wah");
	processor.onError(ex);
	processor.onComplete();

	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.webRequest);
	assertSame(ex, asyncManager.getConcurrentResult());
	assertNull(this.response.getContentType());
}
 
Example #2
Source File: OpenSessionInViewInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Open a new Hibernate {@code Session} according to the settings of this
 * {@code HibernateAccessor} and bind it to the thread via the
 * {@link TransactionSynchronizationManager}.
 * @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession
 */
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String participateAttributeName = getParticipateAttributeName();

	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult()) {
		if (applySessionBindingInterceptor(asyncManager, participateAttributeName)) {
			return;
		}
	}

	if ((isSingleSession() && TransactionSynchronizationManager.hasResource(getSessionFactory())) ||
		SessionFactoryUtils.isDeferredCloseActive(getSessionFactory())) {
		// Do not modify the Session: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		if (isSingleSession()) {
			// single session mode
			logger.debug("Opening single Hibernate Session in OpenSessionInViewInterceptor");
			Session session = SessionFactoryUtils.getSession(
					getSessionFactory(), getEntityInterceptor(), getJdbcExceptionTranslator());
			applyFlushMode(session, false);
			SessionHolder sessionHolder = new SessionHolder(session);
			TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder);

			AsyncRequestInterceptor asyncRequestInterceptor =
					new AsyncRequestInterceptor(getSessionFactory(), sessionHolder);
			asyncManager.registerCallableInterceptor(participateAttributeName, asyncRequestInterceptor);
			asyncManager.registerDeferredResultInterceptor(participateAttributeName, asyncRequestInterceptor);
		}
		else {
			// deferred close mode
			SessionFactoryUtils.initDeferredClose(getSessionFactory());
		}
	}
}
 
Example #3
Source File: OpenEntityManagerInViewInterceptor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String key = getParticipateAttributeName();
	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult() && applyEntityManagerBindingInterceptor(asyncManager, key)) {
		return;
	}

	EntityManagerFactory emf = obtainEntityManagerFactory();
	if (TransactionSynchronizationManager.hasResource(emf)) {
		// Do not modify the EntityManager: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(key, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		logger.debug("Opening JPA EntityManager in OpenEntityManagerInViewInterceptor");
		try {
			EntityManager em = createEntityManager();
			EntityManagerHolder emHolder = new EntityManagerHolder(em);
			TransactionSynchronizationManager.bindResource(emf, emHolder);

			AsyncRequestInterceptor interceptor = new AsyncRequestInterceptor(emf, emHolder);
			asyncManager.registerCallableInterceptor(key, interceptor);
			asyncManager.registerDeferredResultInterceptor(key, interceptor);
		}
		catch (PersistenceException ex) {
			throw new DataAccessResourceFailureException("Could not create JPA EntityManager", ex);
		}
	}
}
 
Example #4
Source File: OpenSessionInViewInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Open a new Hibernate {@code Session} according and bind it to the thread via the
 * {@link TransactionSynchronizationManager}.
 */
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String participateAttributeName = getParticipateAttributeName();

	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult()) {
		if (applySessionBindingInterceptor(asyncManager, participateAttributeName)) {
			return;
		}
	}

	if (TransactionSynchronizationManager.hasResource(getSessionFactory())) {
		// Do not modify the Session: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		logger.debug("Opening Hibernate Session in OpenSessionInViewInterceptor");
		Session session = openSession();
		SessionHolder sessionHolder = new SessionHolder(session);
		TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder);

		AsyncRequestInterceptor asyncRequestInterceptor =
				new AsyncRequestInterceptor(getSessionFactory(), sessionHolder);
		asyncManager.registerCallableInterceptor(participateAttributeName, asyncRequestInterceptor);
		asyncManager.registerDeferredResultInterceptor(participateAttributeName, asyncRequestInterceptor);
	}
}
 
Example #5
Source File: OpenSessionInViewInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #6
Source File: OpenSessionInViewFilter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #7
Source File: OpenSessionInViewInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Open a new Hibernate {@code Session} according to the settings of this
 * {@code HibernateAccessor} and bind it to the thread via the
 * {@link TransactionSynchronizationManager}.
 * @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession
 */
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String participateAttributeName = getParticipateAttributeName();

	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult()) {
		if (applySessionBindingInterceptor(asyncManager, participateAttributeName)) {
			return;
		}
	}

	if ((isSingleSession() && TransactionSynchronizationManager.hasResource(getSessionFactory())) ||
			org.springframework.orm.hibernate3.SessionFactoryUtils.isDeferredCloseActive(getSessionFactory())) {
		// Do not modify the Session: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		if (isSingleSession()) {
			// single session mode
			logger.debug("Opening single Hibernate Session in OpenSessionInViewInterceptor");
			Session session = org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(
					getSessionFactory(), getEntityInterceptor(), getJdbcExceptionTranslator());
			applyFlushMode(session, false);
			org.springframework.orm.hibernate3.SessionHolder sessionHolder = new org.springframework.orm.hibernate3.SessionHolder(session);
			TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder);

			AsyncRequestInterceptor asyncRequestInterceptor =
					new AsyncRequestInterceptor(getSessionFactory(), sessionHolder);
			asyncManager.registerCallableInterceptor(participateAttributeName, asyncRequestInterceptor);
			asyncManager.registerDeferredResultInterceptor(participateAttributeName, asyncRequestInterceptor);
		}
		else {
			// deferred close mode
			org.springframework.orm.hibernate3.SessionFactoryUtils.initDeferredClose(getSessionFactory());
		}
	}
}
 
Example #8
Source File: OpenSessionInViewInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #9
Source File: OpenSessionInViewFilter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #10
Source File: OpenEntityManagerInViewInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String participateAttributeName = getParticipateAttributeName();

	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult()) {
		if (applyCallableInterceptor(asyncManager, participateAttributeName)) {
			return;
		}
	}

	if (TransactionSynchronizationManager.hasResource(getEntityManagerFactory())) {
		// Do not modify the EntityManager: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		logger.debug("Opening JPA EntityManager in OpenEntityManagerInViewInterceptor");
		try {
			EntityManager em = createEntityManager();
			EntityManagerHolder emHolder = new EntityManagerHolder(em);
			TransactionSynchronizationManager.bindResource(getEntityManagerFactory(), emHolder);

			AsyncRequestInterceptor interceptor = new AsyncRequestInterceptor(getEntityManagerFactory(), emHolder);
			asyncManager.registerCallableInterceptor(participateAttributeName, interceptor);
			asyncManager.registerDeferredResultInterceptor(participateAttributeName, interceptor);
		}
		catch (PersistenceException ex) {
			throw new DataAccessResourceFailureException("Could not create JPA EntityManager", ex);
		}
	}
}
 
Example #11
Source File: OpenEntityManagerInViewInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean applyCallableInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #12
Source File: OpenEntityManagerInViewFilter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean applyEntityManagerBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #13
Source File: OpenSessionInViewFilter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #14
Source File: OpenSessionInViewInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #15
Source File: OpenSessionInViewFilter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #16
Source File: OpenSessionInViewInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Open a new Hibernate {@code Session} according and bind it to the thread via the
 * {@link TransactionSynchronizationManager}.
 */
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String participateAttributeName = getParticipateAttributeName();

	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult()) {
		if (applySessionBindingInterceptor(asyncManager, participateAttributeName)) {
			return;
		}
	}

	if (TransactionSynchronizationManager.hasResource(getSessionFactory())) {
		// Do not modify the Session: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		logger.debug("Opening Hibernate Session in OpenSessionInViewInterceptor");
		Session session = openSession();
		SessionHolder sessionHolder = new SessionHolder(session);
		TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder);

		AsyncRequestInterceptor asyncRequestInterceptor =
				new AsyncRequestInterceptor(getSessionFactory(), sessionHolder);
		asyncManager.registerCallableInterceptor(participateAttributeName, asyncRequestInterceptor);
		asyncManager.registerDeferredResultInterceptor(participateAttributeName, asyncRequestInterceptor);
	}
}
 
Example #17
Source File: OpenSessionInViewInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #18
Source File: OpenSessionInViewFilter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #19
Source File: OpenSessionInViewInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Open a new Hibernate {@code Session} according and bind it to the thread via the
 * {@link org.springframework.transaction.support.TransactionSynchronizationManager}.
 */
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String participateAttributeName = getParticipateAttributeName();

	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult()) {
		if (applySessionBindingInterceptor(asyncManager, participateAttributeName)) {
			return;
		}
	}

	if (TransactionSynchronizationManager.hasResource(getSessionFactory())) {
		// Do not modify the Session: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		logger.debug("Opening Hibernate Session in OpenSessionInViewInterceptor");
		Session session = openSession();
		SessionHolder sessionHolder = new SessionHolder(session);
		TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder);

		AsyncRequestInterceptor asyncRequestInterceptor =
				new AsyncRequestInterceptor(getSessionFactory(), sessionHolder);
		asyncManager.registerCallableInterceptor(participateAttributeName, asyncRequestInterceptor);
		asyncManager.registerDeferredResultInterceptor(participateAttributeName, asyncRequestInterceptor);
	}
}
 
Example #20
Source File: OpenSessionInViewInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #21
Source File: OpenSessionInViewFilter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #22
Source File: OpenEntityManagerInViewInterceptor.java    From java-technology-stack with MIT License 5 votes vote down vote up
private boolean applyEntityManagerBindingInterceptor(WebAsyncManager asyncManager, String key) {
	CallableProcessingInterceptor cpi = asyncManager.getCallableInterceptor(key);
	if (cpi == null) {
		return false;
	}
	((AsyncRequestInterceptor) cpi).bindEntityManager();
	return true;
}
 
Example #23
Source File: OpenEntityManagerInViewInterceptor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private boolean applyEntityManagerBindingInterceptor(WebAsyncManager asyncManager, String key) {
	CallableProcessingInterceptor cpi = asyncManager.getCallableInterceptor(key);
	if (cpi == null) {
		return false;
	}
	((AsyncRequestInterceptor) cpi).bindEntityManager();
	return true;
}
 
Example #24
Source File: OpenEntityManagerInViewFilter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private boolean applyEntityManagerBindingInterceptor(WebAsyncManager asyncManager, String key) {
	CallableProcessingInterceptor cpi = asyncManager.getCallableInterceptor(key);
	if (cpi == null) {
		return false;
	}
	((AsyncRequestInterceptor) cpi).bindEntityManager();
	return true;
}
 
Example #25
Source File: OpenSessionInViewInterceptor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Open a new Hibernate {@code Session} according and bind it to the thread via the
 * {@link TransactionSynchronizationManager}.
 */
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String key = getParticipateAttributeName();
	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult() && applySessionBindingInterceptor(asyncManager, key)) {
		return;
	}

	if (TransactionSynchronizationManager.hasResource(obtainSessionFactory())) {
		// Do not modify the Session: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(key, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		logger.debug("Opening Hibernate Session in OpenSessionInViewInterceptor");
		Session session = openSession();
		SessionHolder sessionHolder = new SessionHolder(session);
		TransactionSynchronizationManager.bindResource(obtainSessionFactory(), sessionHolder);

		AsyncRequestInterceptor asyncRequestInterceptor =
				new AsyncRequestInterceptor(obtainSessionFactory(), sessionHolder);
		asyncManager.registerCallableInterceptor(key, asyncRequestInterceptor);
		asyncManager.registerDeferredResultInterceptor(key, asyncRequestInterceptor);
	}
}
 
Example #26
Source File: OpenSessionInViewInterceptor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	CallableProcessingInterceptor cpi = asyncManager.getCallableInterceptor(key);
	if (cpi == null) {
		return false;
	}
	((AsyncRequestInterceptor) cpi).bindSession();
	return true;
}
 
Example #27
Source File: OpenSessionInViewFilter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	CallableProcessingInterceptor cpi = asyncManager.getCallableInterceptor(key);
	if (cpi == null) {
		return false;
	}
	((AsyncRequestInterceptor) cpi).bindSession();
	return true;
}
 
Example #28
Source File: OpenEntityManagerInViewInterceptor.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void preHandle(WebRequest request) throws DataAccessException {
	String key = getParticipateAttributeName();
	WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
	if (asyncManager.hasConcurrentResult() && applyEntityManagerBindingInterceptor(asyncManager, key)) {
		return;
	}

	EntityManagerFactory emf = obtainEntityManagerFactory();
	if (TransactionSynchronizationManager.hasResource(emf)) {
		// Do not modify the EntityManager: just mark the request accordingly.
		Integer count = (Integer) request.getAttribute(key, WebRequest.SCOPE_REQUEST);
		int newCount = (count != null ? count + 1 : 1);
		request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
	}
	else {
		logger.debug("Opening JPA EntityManager in OpenEntityManagerInViewInterceptor");
		try {
			EntityManager em = createEntityManager();
			EntityManagerHolder emHolder = new EntityManagerHolder(em);
			TransactionSynchronizationManager.bindResource(emf, emHolder);

			AsyncRequestInterceptor interceptor = new AsyncRequestInterceptor(emf, emHolder);
			asyncManager.registerCallableInterceptor(key, interceptor);
			asyncManager.registerDeferredResultInterceptor(key, interceptor);
		}
		catch (PersistenceException ex) {
			throw new DataAccessResourceFailureException("Could not create JPA EntityManager", ex);
		}
	}
}
 
Example #29
Source File: OpenSessionInViewInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean applySessionBindingInterceptor(WebAsyncManager asyncManager, String key) {
	if (asyncManager.getCallableInterceptor(key) == null) {
		return false;
	}
	((AsyncRequestInterceptor) asyncManager.getCallableInterceptor(key)).bindSession();
	return true;
}
 
Example #30
Source File: OpenEntityManagerInViewFilter.java    From java-technology-stack with MIT License 5 votes vote down vote up
private boolean applyEntityManagerBindingInterceptor(WebAsyncManager asyncManager, String key) {
	CallableProcessingInterceptor cpi = asyncManager.getCallableInterceptor(key);
	if (cpi == null) {
		return false;
	}
	((AsyncRequestInterceptor) cpi).bindEntityManager();
	return true;
}