gerlowskija commented on code in PR #4775:
URL: https://github.com/apache/solr/pull/4775#discussion_r3863467843


##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetNodeProperties.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.handler.admin.api;
+
+import jakarta.inject.Inject;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.solr.api.JerseyResource;
+import org.apache.solr.client.api.endpoint.NodePropertiesApi;
+import org.apache.solr.client.api.model.NodePropertiesResponse;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.NodeConfig;
+import org.apache.solr.jersey.PermissionName;
+import org.apache.solr.security.PermissionNameProvider;
+
+/**
+ * V2 API for listing system properties on the receiving node.
+ *
+ * <p>GET /api/node/properties lists all properties. GET 
/api/node/properties/{propertyName} returns
+ * a single property. Both are analogous to v1 /admin/info/properties, which 
still uses a {@code
+ * name} query parameter for the single-property form.
+ *
+ * <p>The v1 {@link org.apache.solr.handler.admin.PropertiesRequestHandler} 
delegates to this class.
+ */
+public class GetNodeProperties extends JerseyResource implements 
NodePropertiesApi {
+
+  private final CoreContainer coreContainer;
+
+  @Inject
+  public GetNodeProperties(CoreContainer coreContainer) {
+    this.coreContainer = coreContainer;
+  }
+
+  @Override
+  @PermissionName(PermissionNameProvider.Name.CONFIG_READ_PERM)
+  public NodePropertiesResponse getNodeProperties() {
+    return buildResponse(null);
+  }
+
+  @Override
+  @PermissionName(PermissionNameProvider.Name.CONFIG_READ_PERM)
+  public NodePropertiesResponse getNodeProperty(String propertyName) {
+    return buildResponse(propertyName);
+  }
+
+  private NodePropertiesResponse buildResponse(String name) {
+    final NodePropertiesResponse response = 
instantiateJerseyResponse(NodePropertiesResponse.class);
+    response.systemProperties = collectProperties(name);
+    return response;

Review Comment:
   This is something that ended up in some of our JAX-RS APIs because someone 
decided on it at some point on the v1 codepath.  For example, see us [disabling 
caching in the CollectionsHandler 
here](https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java#L298).
   
   So in general I think the AI is probably right here that giving hints about 
cacheability is valid and appropriate.  Whether that should be done in 
individual APIs or as some sort of "ContainerResponseFilter" (see 
PostRequestLoggingFilter), I'm not really sure.



-- 
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]

Reply via email to