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


##########
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:
   The JAX-RS path no longer disables HTTP caching. The old v2 endpoint 
delegated to `PropertiesRequestHandler.handleRequestBody`, which sets 
`rsp.setHttpCaching(false)`, while `SolrQueryResponse` defaults caching to 
enabled. Consequently these dynamic node properties lose the previous 
`no-cache, no-store` response headers and may be served stale by an 
intermediary. Please inject/access the request's `SolrQueryResponse` and 
disable caching for both methods, as `GetNodeSystemInfo` does.



##########
solr/api/src/java/org/apache/solr/client/api/endpoint/NodePropertiesApi.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.client.api.endpoint;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import org.apache.solr.client.api.model.NodePropertiesResponse;
+
+/** V2 API definition for listing JRE system properties on a Solr node. */
+@Path("/node/properties")
+public interface NodePropertiesApi {
+
+  @GET
+  @Operation(
+      summary = "List system properties for the target Solr node.",
+      tags = {"node"})
+  NodePropertiesResponse getNodeProperties();

Review Comment:
   This changes the existing v2 contract rather than only migrating it: 
`/node/properties?name=foo` previously forwarded `name` to 
`PropertiesRequestHandler` (and the removed mapping test verified that), but 
this no-argument method now ignores the query parameter and returns every 
property. Existing clients will silently receive a different, much larger 
response. Please retain an optional `@QueryParam("name")` on this endpoint 
while also supporting the new path form, and cover the compatibility route with 
an HTTP test.



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