gus-asf commented on code in PR #3997: URL: https://github.com/apache/solr/pull/3997#discussion_r2662805130
########## solr/core/src/java/org/apache/solr/servlet/EssentialSolrRequestFilter.java: ########## @@ -0,0 +1,97 @@ +/* + * 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 + * + * http://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.apache.solr.servlet; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.lang.invoke.MethodHandles; +import org.apache.solr.common.util.SuppressForbidden; +import org.apache.solr.logging.MDCLoggingContext; +import org.apache.solr.logging.MDCSnapshot; +import org.apache.solr.request.SolrRequestInfo; +import org.apache.solr.util.RTimerTree; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Servlet Filter to set up and tear down a various things that downstream code in solr relies on. + * It is expected that solr will fail to function as intended without the conditions initialized in + * this filter. Before adding anything to this filter ask yourself if a user could run without the + * feature you are adding (either with an alternative implementation or without it at all to reduce + * cpu/memory/dependencies). If it is not essential, it should have its own separate filter. Also, + * please include a comment indicating why the thing added is essential. + */ +public class EssentialSolrRequestFilter extends CoreContainerAwareHttpFilter { Review Comment: I've mentioned this sort of thing many times before on the list and in conversations for the last 3-4 years. Almost everyone seems to agree that simplifying SolrDispatchFilter is good. The only opposition ever cited was that perhaps we might someday abandon jetty altogether. I don't see anyone tackling that anytime soon, and honestly that effort will probably benefit from not having to pick apart a monster filter whenever it does show up since this direction would translate pretty nicely into a standard decorator pattern. We can call a halt and have another discussion if it seems desirable. Also, I feel that the filter breakout is good even if we never do the rest of my vision (and that's why my tickets stop there, further changes beyond what I have ticketed are more drastic and certainly deserve discussion), and unless I make a mistake, it should be entirely user transparent (except opening up new possibilities for customization by power users). In our recent conversation you suggested that you were looking to move things to Servlet so I was motivated to do this task that I've been thinking about and fiddling with repeatedly to help minimize what you would have to deal with. You did start some conversation on this back in October of 2024, Only dissent was @hossman noting that things used to be that way before SOLR-104, but it sounds like jsp based UI was a key motivator at the time and that's long gone. I also think that if we ever do ditch Jetty, having separate servlets for update/query/admin (not part of the current tickets) would make it that much easier to assign those to other ports or protocols or whatever. Right now it's all coupled and firmly tied to http via HttpSolrCall -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
