upgrade to jackson 1.7, also fix (really unused case) of getting compressed smile stored through REST with smile context type

This commit is contained in:
kimchy 2011-01-07 16:35:52 +02:00
parent b9be6d9ea7
commit 286a6fac76
2 changed files with 14 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.common.xcontent.json.JsonXContentGenerator; import org.elasticsearch.common.xcontent.json.JsonXContentGenerator;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
/** /**
@ -40,6 +41,17 @@ public class SmileXContentGenerator extends JsonXContentGenerator {
return XContentType.SMILE; return XContentType.SMILE;
} }
@Override public void writeRawField(String fieldName, InputStream content, OutputStream bos) throws IOException {
writeFieldName(fieldName);
SmileParser parser = SmileXContent.smileFactory.createJsonParser(content);
try {
parser.nextToken();
generator.copyCurrentStructure(parser);
} finally {
parser.close();
}
}
@Override public void writeRawField(String fieldName, byte[] content, OutputStream bos) throws IOException { @Override public void writeRawField(String fieldName, byte[] content, OutputStream bos) throws IOException {
writeFieldName(fieldName); writeFieldName(fieldName);
SmileParser parser = SmileXContent.smileFactory.createJsonParser(content); SmileParser parser = SmileXContent.smileFactory.createJsonParser(content);

View File

@ -15,8 +15,8 @@ dependencies {
runtime 'joda-time:joda-time:1.6.1' runtime 'joda-time:joda-time:1.6.1'
runtime 'org.mvel:mvel2:2.0.19' runtime 'org.mvel:mvel2:2.0.19'
runtime 'org.codehaus.jackson:jackson-core-asl:1.6.3' runtime 'org.codehaus.jackson:jackson-core-asl:1.7.0'
runtime 'org.codehaus.jackson:jackson-smile:1.6.3' runtime 'org.codehaus.jackson:jackson-smile:1.7.0'
runtime 'org.yaml:snakeyaml:1.6' runtime 'org.yaml:snakeyaml:1.6'
runtime('org.jboss.netty:netty:3.2.3.Final') { transitive = false } runtime('org.jboss.netty:netty:3.2.3.Final') { transitive = false }