gus-asf commented on a change in pull request #265:
URL: https://github.com/apache/solr/pull/265#discussion_r694797222



##########
File path: solr/core/src/java/org/apache/solr/servlet/AdminServlet.java
##########
@@ -0,0 +1,71 @@
+/*
+ * 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 javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+
+import static org.apache.solr.servlet.ServletUtils.closeShield;
+import static org.apache.solr.servlet.ServletUtils.configExcludes;
+import static org.apache.solr.servlet.ServletUtils.excludedPath;
+
+@WebServlet
+public class AdminServlet extends HttpServlet implements PathExcluder{
+  private ArrayList<Pattern> excludes;
+
+  @Override
+  public void init() throws ServletException {
+    configExcludes(this, getInitParameter("excludePatterns"));
+  }
+
+  @Override
+  protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
throws ServletException, IOException {
+    req = closeShield(req, false);
+    resp = closeShield(resp, false);
+    if (excludedPath(excludes,req,resp,null)) {
+      return;
+    }
+    ServletUtils.rateLimitRequest(req,resp,() -> {

Review comment:
       Probably not. This class as noted in the linked issue, is just a foil 
for development at the moment, and need not be included at all in the final 
version of *this* commit at all. As I was working the specific goal was exact 
parity, so that I could demonstrate solutions to problems caused by breaking 
things out. While rate limit probably isn't needed here we would want it if 
update and query each had their own paths some day, so this just demonstrates 
that I have a way to apply it to *some* servlet.




-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to