use of com.dtflys.forest.converter.protobuf.ForestProtobufConverterManager in project forest by dromara.
the class ForestConfiguration method createConfiguration.
public static ForestConfiguration createConfiguration() {
ForestConfiguration configuration = new ForestConfiguration();
configuration.setId("forestConfiguration" + configuration.hashCode());
configuration.setJsonConverterSelector(new JSONConverterSelector());
ForestProtobufConverterManager protobufConverterFactory = ForestProtobufConverterManager.getInstance();
configuration.setProtobufConverter(protobufConverterFactory.getForestProtobufConverter());
configuration.setXmlConverter(new ForestJaxbConverter());
configuration.setTextConverter(new DefaultTextConverter());
DefaultAutoConverter autoConverter = new DefaultAutoConverter(configuration);
configuration.getConverterMap().put(ForestDataType.AUTO, autoConverter);
configuration.getConverterMap().put(ForestDataType.BINARY, new DefaultBinaryConverter(autoConverter));
configuration.getConverterMap().put(ForestDataType.FORM, new DefaultFormConvertor(configuration));
setupJSONConverter(configuration);
configuration.setTimeout(3000);
configuration.setMaxConnections(500);
configuration.setMaxRouteConnections(500);
configuration.setRetryer(BackOffRetryer.class);
configuration.setMaxRetryCount(0);
configuration.setMaxRetryInterval(0);
configuration.registerFilter("json", JSONFilter.class);
configuration.registerFilter("xml", XmlFilter.class);
configuration.setLogHandler(new DefaultLogHandler());
return configuration;
}
Aggregations