Migrate RealTimeGetAPI from @EndPoint to JAX-RS#4181
Conversation
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
…Writer; fix V2ApiIntegrationTest introspect tests Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Migrates the RealTimeGet V2 endpoint from the legacy @EndPoint / AnnotatedApi mechanism to a JAX-RS resource + OpenAPI interface, and ensures JSON responses go through Solr’s response-writer pipeline for dynamic fields.
Changes:
- Introduces a new JAX-RS
RealTimeGetApiinterface and a JerseyRealTimeGetAPIresource delegating toRealTimeGetHandler. - Adds a JSON
MessageBodyWriterto routeapplication/jsonthroughJSONResponseWriter(matching javabin/xml behavior). - Updates/extends integration testing around the new endpoint and adjusts introspection assertions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| solr/core/src/java/org/apache/solr/handler/admin/api/RealTimeGetAPI.java | New Jersey resource implementation for RTG backed by existing handler |
| solr/core/src/java/org/apache/solr/handler/RealTimeGetHandler.java | Switches from legacy V2 API exposure to Jersey resource exposure |
| solr/api/src/java/org/apache/solr/client/api/endpoint/RealTimeGetApi.java | Adds the JAX-RS/OpenAPI API contract for RTG |
| solr/core/src/java/org/apache/solr/jersey/MessageBodyWriters.java | Adds JSON writer that uses Solr’s JSONResponseWriter pipeline |
| solr/core/src/java/org/apache/solr/jersey/JerseyApplications.java | Registers the new JSON MessageBodyWriter |
| solr/core/src/test/org/apache/solr/handler/admin/api/RealTimeGetAPITest.java | Adds integration coverage for /get via both V2Request and generated SolrJ |
| solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.java | Updates introspect-related assertions to avoid JAX-RS endpoints |
| changelog/unreleased/migrate-realtimegetapi-to-jax-rs.yml | Adds changelog entry for the migration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Locallhy I am getting wrapping in the configSets list with breaks |
In digging more, it was the change to the json mapper stuff that was causing this side effect. I just merged a redo that gets us closer, thoguh parts I still don't love. |
|
This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the dev@solr.apache.org mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution! |
Migrates
RealTimeGetHandler's V2 API from the legacy@EndPoint/AnnotatedApipattern to standard JAX-RS annotations, consistent with other V2 APIs. RTG logic stays inRealTimeGetHandler; the new Jersey resource delegates to it. Also upgrades the generated SolrJ client to exposeid/idsquery params and fixes a gap in the Jersey JSON response path.API Interface (
solr/api)RealTimeGetApi:@Path(INDEX_PATH_PREFIX + "/get"),@GET getDocuments(@QueryParam("id"), @QueryParam("ids")), returnsFlexibleSolrJerseyResponseto capture dynamic RTG fields (doc,response)Implementation (
solr/core)RealTimeGetAPIextendsJerseyResource, implementsRealTimeGetApi, uses@Injectconstructor; delegates toRealTimeGetHandlerviasolrCore.getRequestHandler("/get")RealTimeGetHandler: replacedAnnotatedApi/getApis()withgetJerseyResources()returningRealTimeGetAPI.classJSON MessageBodyWriter
Previously JAX-RS
application/jsonresponses bypassed Solr'sQueryResponseWriterpipeline (using Jersey's default Jackson serializer directly), so dynamic fields added by V1 handlers toSolrQueryResponsewere invisible toJacksonDataBindResponseParser-based clients. AddedJsonMessageBodyWriter— routes JSON responses throughJSONResponseWriter+squashIntoSolrResponseWithHeader, consistent with the existing javabin/xml writers.Generated SolrJ Client
DocumentsApi.GetDocuments(generated from the updated OAS) now exposessetId(String)andsetIds(List<String>).Tests
RealTimeGetAPITest: integration test viaSolrJettyTestRule;testGetDocumentsByIdsuses the generatedDocumentsApi.GetDocumentsclass end-to-endV2ApiIntegrationTest: removed_introspectassertions on JAX-RS endpoints (/select/_introspect,/get/_introspect) —_introspectis not supported on JAX-RS resources;testWTParam/testInvalidWTParamReturnsErrornow use collection-level/_introspect