jamesfredley commented on code in PR #15541: URL: https://github.com/apache/grails-core/pull/15541#discussion_r3018512057
########## grails-data-hibernate5/core/src/main/java/org/grails/orm/hibernate/support/hibernate5/support/OpenSessionInViewInterceptor.java: ########## @@ -0,0 +1,219 @@ +/* + * Copyright 2002-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.grails.orm.hibernate.support.hibernate5.support; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hibernate.FlushMode; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; + +import org.springframework.dao.DataAccessException; +import org.springframework.dao.DataAccessResourceFailureException; +import org.springframework.lang.Nullable; +import org.grails.orm.hibernate.support.hibernate5.SessionFactoryUtils; +import org.grails.orm.hibernate.support.hibernate5.SessionHolder; +import org.springframework.transaction.support.TransactionSynchronizationManager; +import org.springframework.ui.ModelMap; +import org.springframework.util.Assert; +import org.springframework.web.context.request.AsyncWebRequestInterceptor; +import org.springframework.web.context.request.WebRequest; +import org.springframework.web.context.request.async.CallableProcessingInterceptor; +import org.springframework.web.context.request.async.WebAsyncManager; +import org.springframework.web.context.request.async.WebAsyncUtils; + +/** + * Spring web request interceptor that binds a Hibernate {@code Session} to the + * thread for the entire processing of the request. + * + * <p>This class is a concrete expression of the "Open Session in View" pattern, which + * is a pattern that allows for the lazy loading of associations in web views despite + * the original transactions already being completed. + * + * <p>This interceptor makes Hibernate Sessions available via the current thread, + * which will be autodetected by transaction managers. It is suitable for service layer + * transactions via {@link org.springframework.orm.hibernate5.HibernateTransactionManager} + * as well as for non-transactional execution (if configured appropriately). + * Review Comment: Fixed - updated both the `@link` and `@see` references to point to the vendored `org.grails.orm.hibernate.support.hibernate5.HibernateTransactionManager` class. ########## grails-web-common/src/main/groovy/org/grails/web/config/http/GrailsFilterOrder.java: ########## @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.grails.web.config.http; + +/** + * Constants for filter ordering in Grails applications. + * <p> + * These constants were previously obtained from Spring Boot's {@code SecurityProperties} + * class, but were removed in Spring Boot 4.0. They are now defined here for use by + * Grails filter configuration. + * + * @since 8.0 + */ +public final class GrailsFilterOrder { + + private GrailsFilterOrder() { + // Utility class + } + + /** + * Default order of Spring Security's Filter in the servlet container (i.e. amongst + * other filters registered with the container). There is no connection between this + * and the {@code @Order} on a {@code SecurityFilterChain}. + * <p> + * Value is {@code REQUEST_WRAPPER_FILTER_MAX_ORDER - 100 = -100}. + * <p> + * This value matches what was previously defined in Spring Boot's + * {@code SecurityProperties.DEFAULT_FILTER_ORDER} before it was removed in Spring Boot 4.0. Review Comment: Fixed - rewrote the Javadoc to state the concrete value (`-100`) and cite the original `OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER` computation for provenance, without referencing the symbol as if it were locally defined. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
