Removed outdated references to Servlet 2.3/2.4

This commit is contained in:
Juergen Hoeller
2015-03-24 21:21:18 +01:00
parent 6892ad42d6
commit 673dac5620
16 changed files with 84 additions and 59 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.filter.OncePerRequestFilter;
/**
* Servlet 2.3 Filter that binds a Hibernate Session to the thread for the entire
* Servlet Filter that binds a Hibernate Session to the thread for the entire
* processing of the request. Intended for the "Open Session in View" pattern,
* i.e. to allow for lazy loading in web views despite the original transactions
* already being completed.
@@ -164,6 +164,7 @@ public class OpenSessionInViewFilter extends OncePerRequestFilter {
return this.flushMode;
}
/**
* Returns "false" so that the filter may re-bind the opened Hibernate
* {@code Session} to each asynchronously dispatched thread and postpone

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.filter.OncePerRequestFilter;
/**
* Servlet 2.3 Filter that binds a JDO PersistenceManager to the thread for the
* Servlet Filter that binds a JDO PersistenceManager to the thread for the
* entire processing of the request. Intended for the "Open PersistenceManager in
* View" pattern, i.e. to allow for lazy loading in web views despite the
* original transactions already being completed.
@@ -79,6 +79,25 @@ public class OpenPersistenceManagerInViewFilter extends OncePerRequestFilter {
}
/**
* Returns "false" so that the filter may re-bind the opened {@code PersistenceManager}
* to each asynchronously dispatched thread and postpone closing it until the very
* last asynchronous dispatch.
*/
@Override
protected boolean shouldNotFilterAsyncDispatch() {
return false;
}
/**
* Returns "false" so that the filter may provide an {@code PersistenceManager}
* to each error dispatches.
*/
@Override
protected boolean shouldNotFilterErrorDispatch() {
return false;
}
@Override
protected void doFilterInternal(
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.filter.OncePerRequestFilter;
/**
* Servlet 2.3 Filter that binds a JPA EntityManager to the thread for the
* Servlet Filter that binds a JPA EntityManager to the thread for the
* entire processing of the request. Intended for the "Open EntityManager in
* View" pattern, i.e. to allow for lazy loading in web views despite the
* original transactions already being completed.
@@ -71,6 +71,7 @@ public class OpenEntityManagerInViewFilter extends OncePerRequestFilter {
*/
public static final String DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME = "entityManagerFactory";
private String entityManagerFactoryBeanName;
private String persistenceUnitName;
@@ -119,10 +120,11 @@ public class OpenEntityManagerInViewFilter extends OncePerRequestFilter {
return this.persistenceUnitName;
}
/**
* Returns "false" so that the filter may re-bind the opened
* {@code EntityManager} to each asynchronously dispatched thread and postpone
* closing it until the very last asynchronous dispatch.
* Returns "false" so that the filter may re-bind the opened {@code EntityManager}
* to each asynchronously dispatched thread and postpone closing it until the very
* last asynchronous dispatch.
*/
@Override
protected boolean shouldNotFilterAsyncDispatch() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,9 +43,8 @@ import org.springframework.web.context.request.async.WebAsyncUtils;
* or {@link org.springframework.transaction.jta.JtaTransactionManager} as well
* as for non-transactional read-only execution.
*
* <p>In contrast to {@link OpenEntityManagerInViewFilter}, this interceptor
* is set up in a Spring application context and can thus take advantage of
* bean wiring.
* <p>In contrast to {@link OpenEntityManagerInViewFilter}, this interceptor is set
* up in a Spring application context and can thus take advantage of bean wiring.
*
* @author Juergen Hoeller
* @since 2.0
@@ -67,7 +66,6 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce
@Override
public void preHandle(WebRequest request) throws DataAccessException {
String participateAttributeName = getParticipateAttributeName();
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
@@ -78,7 +76,7 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce
}
if (TransactionSynchronizationManager.hasResource(getEntityManagerFactory())) {
// do not modify the EntityManager: just mark the request accordingly
// 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);