[
https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549683
]
ehatcher edited comment on SOLR-402 at 12/8/07 3:00 AM:
------------------------------------------------------------
Here's a more general purpose ResponseParser implementation.
{code}
public class RawResponseParser implements ResponseParser {
private String writerType;
public RawResponseParser(String writerType) {
this.writerType = writerType;
}
public String getWriterType() {
return writerType;
}
public NamedList<Object> processResponse(Reader in) {
NamedList<Object> data = new NamedList<Object>();
try {
StringBuffer raw = new StringBuffer();
char[] b = new char[16384];
int n;
// Read a block. If it gets any chars, append them.
while ((n = in.read(b)) > 0) {
raw.append(b, 0, n);
}
data.add("raw", raw.toString());
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "parsing
error", e);
}
return data;
}
}
{code}
Perhaps instead of "raw" it could use writerType as the key value?
was (Author: ehatcher):
Here's a ore general purpose ResponseParser implementation.
{code}
public class RawResponseParser implements ResponseParser {
private String writerType;
public RawResponseParser(String writerType) {
this.writerType = writerType;
}
public String getWriterType() {
return writerType;
}
public NamedList<Object> processResponse(Reader in) {
NamedList<Object> data = new NamedList<Object>();
try {
StringBuffer raw = new StringBuffer();
char[] b = new char[16384];
int n;
// Read a block. If it gets any chars, append them.
while ((n = in.read(b)) > 0) {
raw.append(b, 0, n);
}
data.add("raw", raw.toString());
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "parsing
error", e);
}
return data;
}
}
{code}
Perhaps instead of "raw" it could use writerType as the key value?
> JSON response support
> ---------------------
>
> Key: SOLR-402
> URL: https://issues.apache.org/jira/browse/SOLR-402
> Project: Solr
> Issue Type: New Feature
> Components: clients - java
> Affects Versions: 1.3
> Environment: all
> Reporter: AABones
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: jsonPatch.patch
>
>
> The Solrj java client was missing response support for JSON. I added an
> JSONResponseParser class and the necessary changes elsewhere to support it.
> I'm attaching the patch file.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.