[ https://issues.apache.org/jira/browse/SOLR-3387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13258399#comment-13258399 ]
Ryan McKinley commented on SOLR-3387: ------------------------------------- as a quick sketch, I'm looking at something like: {code:java} return new ContentStreamLoader() { XMLLoader xml = null; JavabinLoader javabin = null; JsonLoader json = null; CSVLoader csv = null; @Override public void load(SolrQueryRequest req, SolrQueryResponse rsp, ContentStream stream) throws Exception { ContentStreamLoader loader = null; String type = stream.getContentType(); if (type.contains("javabin")) { if (javabin == null) { javabin = new JavabinLoader(processor); setDefaultWT("javabin", req); } loader = javabin; } else if (type.contains("xml")) { if (xml == null) { xml = new XMLLoader(processor, inputFactory); setDefaultWT("xml", req); } loader = xml; } else if (type.contains("json")) { if (json == null) { json = new JsonLoader(req, processor); setDefaultWT("json", req); } loader = json; } else if (type.contains("csv")) { if (csv == null) { csv = new SingleThreadedCSVLoader(req, processor); // setDefaultWT("csv", req); Should this default? } loader = csv; } if (loader == null) { throw new SolrException(ErrorCode.BAD_REQUEST, "Unsupported Content-Type: '" + type + "'"); } loader.load(req, rsp, stream); } private void setDefaultWT(String wt, SolrQueryRequest req) { SolrParams params = req.getParams(); if( params.get(CommonParams.WT) == null ) { Map<String,String> map = new HashMap<String,String>(1); map.put(CommonParams.WT, wt); req.setParams(SolrParams.wrapDefaults(params, new MapSolrParams(map))); } } }; {code} Any red flags? We could have more strict content-type rules If we like the general idea/approach I'll clean things up with tests etc. For back compatibility any opinions? * @Deprecated JsonUpdateRequestHandler could simply extend the general UpdateRequestHandler (now requiring proper content-type) * @Deprecated JsonUpdateRequestHandler could could call JsonLoader explicitly (same as 3.x) * remove it completely > UpdateRequestHandler should support XML,CSV,JSON, and javabin > ------------------------------------------------------------- > > Key: SOLR-3387 > URL: https://issues.apache.org/jira/browse/SOLR-3387 > Project: Solr > Issue Type: Improvement > Reporter: Ryan McKinley > Fix For: 4.0 > > > Rather then have 4 handlers to support 4 content types, we should use a > single endpoint and pick the ContentStreamLoader based on the ContentType > This will simplify configuration problems for clients that want to swtich > format (see SOLR-3038) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org