-
Notifications
You must be signed in to change notification settings - Fork 810
SOLR-18085: Review use of "wt=standard" and see if we can remove it. #4080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
99a5114
d976a1a
63d4284
90dd987
947464b
5753e33
c76ad67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -117,7 +117,8 @@ void initHandlersFromConfig(SolrConfig config) { | |||||||||||||||||
| modifiedInfos.add(applyInitParams(config, info)); | ||||||||||||||||||
| } | ||||||||||||||||||
| handlers.init(Collections.emptyMap(), core, modifiedInfos); | ||||||||||||||||||
| handlers.alias(handlers.getDefault(), ""); | ||||||||||||||||||
| // Curious if this is actually needed! | ||||||||||||||||||
| // handlers.alias(handlers.getDefault(), ""); | ||||||||||||||||||
|
Comment on lines
+120
to
+121
|
||||||||||||||||||
| // Curious if this is actually needed! | |
| // handlers.alias(handlers.getDefault(), ""); | |
| // Ensure the configured default handler (if any) is aliased to the empty path ("") | |
| String defaultHandler = handlers.getDefault(); | |
| if (defaultHandler != null) { | |
| handlers.alias(defaultHandler, ""); | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3133,12 +3133,12 @@ private void initWriters() { | |||||||||||
| responseWriters.init(defaultWriters, this); | ||||||||||||
|
|
||||||||||||
| // configure the default response writer; this one should never be null | ||||||||||||
| if (responseWriters.getDefault() == null) responseWriters.setDefault("standard"); | ||||||||||||
| // if (responseWriters.getDefault() == null) responseWriters.setDefault("standard"); | ||||||||||||
|
||||||||||||
| // if (responseWriters.getDefault() == null) responseWriters.setDefault("standard"); | |
| if (responseWriters.getDefault() == null) { | |
| // Use "json" as the default writer now that the legacy "standard" writer is being removed. | |
| responseWriters.setDefault("json"); | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,11 +68,11 @@ public class SolrRequestParsers { | |
| private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); | ||
|
|
||
| // Should these constants be in a more public place? | ||
| public static final String MULTIPART = "multipart"; | ||
| public static final String FORMDATA = "formdata"; | ||
| public static final String RAW = "raw"; | ||
| public static final String SIMPLE = "simple"; | ||
| public static final String STANDARD = "standard"; | ||
| // public static final String MULTIPART = "multipart"; | ||
| // public static final String FORMDATA = "formdata"; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so many unused statics! |
||
| // public static final String RAW = "raw"; | ||
| // public static final String SIMPLE = "simple"; | ||
| // public static final String STANDARD = "standard"; | ||
|
Comment on lines
70
to
+75
|
||
|
|
||
| private static final Charset CHARSET_US_ASCII = StandardCharsets.US_ASCII; | ||
|
|
||
|
|
@@ -81,7 +81,7 @@ public class SolrRequestParsers { | |
|
|
||
| public static final String REQUEST_TIMER_SERVLET_ATTRIBUTE = "org.apache.solr.RequestTimer"; | ||
|
|
||
| private final HashMap<String, SolrRequestParser> parsers = new HashMap<>(); | ||
| // private final HashMap<String, SolrRequestParser> parsers = new HashMap<>(); | ||
| private StandardRequestParser standard; | ||
|
|
||
| /** | ||
|
|
@@ -120,12 +120,12 @@ private void init(int multipartUploadLimitKB, int formUploadLimitKB) { | |
|
|
||
| // I don't see a need to have this publicly configured just yet | ||
| // adding it is trivial | ||
| parsers.put(MULTIPART, multi); | ||
| parsers.put(FORMDATA, formdata); | ||
| parsers.put(RAW, raw); | ||
| parsers.put(SIMPLE, new SimpleRequestParser()); | ||
| parsers.put(STANDARD, standard); | ||
| parsers.put("", standard); | ||
| // parsers.put(MULTIPART, multi); | ||
| // parsers.put(FORMDATA, formdata); | ||
| // parsers.put(RAW, raw); | ||
| // parsers.put(SIMPLE, new SimpleRequestParser()); | ||
| // parsers.put(STANDARD, standard); | ||
| // parsers.put("", standard); | ||
| } | ||
|
|
||
| private static RTimerTree getRequestTimer(HttpServletRequest req) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,26 +114,27 @@ public void testIntrospect() throws Exception { | |
| } | ||
|
|
||
| @Test | ||
| public void testWTParam() throws Exception { | ||
| public void testInvalidWTParamReturnsError() throws Exception { | ||
| V2Request request = new V2Request.Builder("/c/" + COLL_NAME + "/get/_introspect").build(); | ||
| // TODO: If possible do this in a better way | ||
| // Using an invalid wt parameter should return a 500 error | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the Big Change. |
||
| request.setResponseParser(new InputStreamResponseParser("bleh")); | ||
| NamedList<Object> res = cluster.getSolrClient().request(request); | ||
| String respString = InputStreamResponseParser.consumeResponseToString(res); | ||
|
|
||
| assertFalse(respString.contains("<body><h2>HTTP ERROR 500</h2>")); | ||
| assertFalse(respString.contains("500")); | ||
| assertFalse(respString.contains("NullPointerException")); | ||
| assertFalse( | ||
| respString.contains( | ||
| "<p>Problem accessing /solr/____v2/c/collection1/get/_introspect. Reason:")); | ||
| // since no-op response writer is used, doing contains match | ||
| assertTrue(respString.contains("/c/collection1/get")); | ||
| // Should get a 500 Server Error for unknown writer type | ||
| assertTrue( | ||
| "Expected error message about unknown writer type", | ||
| respString.contains("Unknown response writer type")); | ||
| assertTrue("Expected 500 error code", respString.contains("500")); | ||
| } | ||
|
|
||
| // no response parser | ||
| @Test | ||
| public void testWTParam() throws Exception { | ||
| // When no response parser is set, the default JSON writer should be used | ||
| V2Request request = new V2Request.Builder("/c/" + COLL_NAME + "/get/_introspect").build(); | ||
| request.setResponseParser(null); | ||
| Map<?, ?> resp = resAsMap(cluster.getSolrClient(), request); | ||
| respString = resp.toString(); | ||
| String respString = resp.toString(); | ||
|
|
||
| assertFalse(respString.contains("<body><h2>HTTP ERROR 500</h2>")); | ||
| assertFalse( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests all pass!