-
Bug
-
Resolution: Done
-
Minor
-
JDG 7.3 DR1
-
None
-
None
Using the cache configuration
<cache-container name="local" default-cache="default" statistics="true"> <modules> <module name="deployment.sample-interop-entities-1.0-SNAPSHOT.jar"/> </modules> <global-state/> <local-cache name="default"/> <local-cache name="namedCache"/> <local-cache name="my-cache"> <encoding> <key media-type="application/x-java-object"/> <value media-type="application/x-java-object"/> </encoding> </local-cache> </cache-container>
With the following client:
Executor requestExecutor = Executor.newInstance(); String json = "{\"_type\":\"org.infinispan.interop.CryptoCurrency\",\"description\":\"Monero-"+ UUID.randomUUID().toString() +"\",\"rank\":12}"; StatusLine status = requestExecutor.execute( Request.Put(String.format("http://%s:%d/rest/%s/%s", "localhost", 8080, cacheName, key)) .bodyString(json, ContentType.APPLICATION_JSON)) .returnResponse().getStatusLine(); if (status.getStatusCode() != 200) { throw new IllegalStateException(status.getReasonPhrase()); }
When calling the client twice it will fail due:
Exception in thread "main" java.lang.IllegalStateException: Precondition Failed
I search on the Internet and found the text about 412 (Precondition Failed)
Compares the requested variant’s last modification time and date with a supplied time and date value. If the requested resources have not been modified since the supplied date and time, the specified operation is performed. If the requested resource has been modified since the supplied date and time, the operation is not performed and a 412 (Precondition Failed) response is returned.
The demo code can be found in https://github.com/infinispan-demos/endpoint-interop
If it is an issue, I would like to change the Priority from Critical to Blocker