Conventions related to request handling
UseParallelMultiGet
Instruct the client to do parallel MultiGet processing when handling lazy requests. It is enabled by default.
conventions.setUseParallelMultiGet(true);
HandleForbiddenResponse
The function that begins the handling of forbidden responses.
conventions.setHandleForbiddenResponse(new HttpResponseHandler() {
@Override
public Action1<HttpRequest> handle(HttpResponse httpResponse) {
return null;
}
});
HandleUnauthorizedResponse
It handles of unauthenticated responses, usually by authenticating against the oauth server.
conventions.setHandleUnauthorizedResponse(new HttpResponseWithMetaHandler() {
@Override
public Action1<HttpRequest> handle(HttpResponse httpResponse, OperationCredentials credentials) {
return null;
}
});
JsonContractResolver
The default JsonContractResolver
used by RavenDB will serialize all properties and all public fields. You can change it by providing own implementation of DeserializationProblemHandler
class:
conventions.setJsonContractResolver(new CustomJsonContractResolver());
public static class CustomJsonContractResolver extends DeserializationProblemHandler
{
@Override
public boolean handleUnknownProperty(DeserializationContext ctxt, JsonDeserializer<?> deserializer,
Object beanOrClass, String propertyName) throws IOException, JsonProcessingException {
return super.handleUnknownProperty(ctxt, deserializer, beanOrClass, propertyName);
}
}
PreserveDocumentPropertiesNotFoundOnModel
Controls whatever properties that were not de-serialized to an object properties will be preserved
during saving a document again. If false
, those properties will be removed when the document will be saved. Default: true
.
conventions.setPreserveDocumentPropertiesNotFoundOnModel(true);