<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, May 23, 2017 at 5:06 PM Radim Vansa &lt;<a href="mailto:rvansa@redhat.com">rvansa@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 05/16/2017 11:05 AM, Sebastian Laskawiec wrote:<br>
&gt; Hey guys!<br>
&gt;<br>
&gt; I&#39;m working on REST Server refactoring and I changed some of the<br>
&gt; previous behavior. Having in mind that we are implementing this in a<br>
&gt; minor release, I tried to make those changes really cosmetic:<br>
&gt;<br>
&gt;   * RestEASY as well as Servlet API have been removed from modules and<br>
&gt;     BOM. If your app relied on it, you&#39;ll need to specify them<br>
&gt;     separately in your pom.<br>
&gt;   * Previous implementation picked application/text as a default<br>
&gt;     content type. I replaced it with text/plain with charset which is<br>
&gt;     more precise and seems to be more widely adopted.<br>
&gt;   * Putting an entry without any TTL nor Idle Time made it living<br>
&gt;     forever (which was BTW aligned with the docs). I switched to<br>
&gt;     server configured defaults in this case. If you want to have an<br>
&gt;     entry that lives forever, just specify 0 or -1 there.<br>
&gt;   * Requesting an entry with wrong mime type (imagine it was stored<br>
&gt;     using application/octet-stream and now you&#39;re requesting<br>
&gt;     text/plain) cased Bad Request. Now I switched it to Not Acceptable<br>
&gt;     which was designed specially to cover this type of use case.<br>
&gt;   * In compatibility mode the server often tried to &quot;guess&quot; the<br>
&gt;     mimetype (the decision was often between text/plain and<br>
&gt;     application/octet-stream). I honestly think it was a wrong move<br>
&gt;     and made the server side code very hard to read and predict what<br>
&gt;     would be the result. Now the server always returns text/plain by<br>
&gt;     default. If you want to get a byte stream back, just add `Accept:<br>
&gt;     application/octet-stream`.<br>
&gt;   * The server can be started with port 0. This way you are 100% sure<br>
&gt;     that it will start using a unique port without colliding with any<br>
&gt;     other service.<br>
&gt;<br>
How can the client now the port number, then? Is the actual port exposed<br>
through JMX?<br>
<br>
&gt;   * The REST server hosts HTML page if queried using GET on default<br>
&gt;     context. I think it was a bug that it didn&#39;t work correctly before.<br>
&gt;<br>
Did it return 404? What&#39;s on that page? Do we expose keys/values/entries<br>
anywhere in the REST endpoint?<br></blockquote><div><br></div><div>Exactly. You may try it using our Docker image and invoking something like this: curl -v -u user:changeme <a href="http://172.17.0.6:8080/rest">http://172.17.0.6:8080/rest</a></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
&gt;   * UTF-8 charset is now the default. You may always ask the server to<br>
&gt;     return different encoding using Accept header. The charset is not<br>
&gt;     returned with binary mime types.<br>
&gt;   * If a HEAD request results in an error, a message will be returned<br>
&gt;     to the client. Even though this behavior breaks Commons HTTP<br>
&gt;     Client (HEAD requests are handled slightly differently and causes<br>
&gt;     the client to hang if a payload is returned), I think it&#39;s<br>
&gt;     beneficial to tell the user what went wrong. It&#39;s worth to mention<br>
&gt;     that Jetty/Netty HTTP clients work correctly.<br>
&gt;   * RestServer doesn&#39;t implement Lifecycle now. The protocol server<br>
&gt;     doesn&#39;t support start() method without any arguments. You always<br>
&gt;     need to specify configuration + Embedded Cache Manager.<br>
&gt;<br>
&gt; Even though it&#39;s a long list, I think all those changes were worth it.<br>
&gt; Please let me know if you don&#39;t agree.<br>
<br>
Couple of other questions:<br>
<br>
* do we accept GET with Range header on keys? What about delta-updating<br>
entries with Content-Range on PUTs?<br></blockquote><div><br></div><div>No and AFAK there are no plans to do it (but perhaps Tristan could shed some more light onto this). We could use HTTP PATCH for delta updates...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* For PUTs/POSTs, do we return 200/201/204 according to the spec?<br>
(modified/created/modified)<br></blockquote><div><br></div><div>No, I decided to leave it as 200 for compatibility reasons. But I agree, we could change this as well.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* Do we have any way to execute a replace (or the other prev-value<br>
returning ops) through REST using single request? For example let DELETE<br>
return the prev entity (it should return 200 &amp; entity or 204 and no<br>
response)<br></blockquote><div><br></div><div>Yes, PUT replaces previous value [1] if such exists (whereas POST would return a conflict). If for some reason you can not replace current value, you will get a preconditions failed error.</div><div><br></div><div>[1] <a href="https://github.com/infinispan/infinispan/pull/5094/files#diff-58f67698080cc0242320614c921559a8R301">https://github.com/infinispan/infinispan/pull/5094/files#diff-58f67698080cc0242320614c921559a8R301</a></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* Do we handle OPTIONS in any way?<br></blockquote><div><br></div><div>No. Do we need it? I haven&#39;t seen any real implementation that uses that for discovering REST operations.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Radim<br>
<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Sebastian<br>
&gt;<br>
&gt; --<br>
&gt;<br>
&gt; SEBASTIANŁASKAWIEC<br>
&gt;<br>
&gt; INFINISPAN DEVELOPER<br>
&gt;<br>
&gt; Red HatEMEA &lt;<a href="https://www.redhat.com/" rel="noreferrer" target="_blank">https://www.redhat.com/</a>&gt;<br>
&gt;<br>
&gt; &lt;<a href="https://red.ht/sig" rel="noreferrer" target="_blank">https://red.ht/sig</a>&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; infinispan-dev mailing list<br>
&gt; <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
<br>
<br>
--<br>
Radim Vansa &lt;<a href="mailto:rvansa@redhat.com" target="_blank">rvansa@redhat.com</a>&gt;<br>
JBoss Performance Team<br>
<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></blockquote></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><p class="inbox-inbox-fullname-container" style="box-sizing:border-box;color:rgb(0,0,0);font-family:overpass,sans-serif;font-weight:bold;margin:0px;padding:0px;font-size:14px;text-transform:uppercase"><span class="inbox-inbox-firstname-container" style="box-sizing:border-box">SEBASTIAN</span><span class="inbox-inbox-Apple-converted-space"> </span><span class="inbox-inbox-lastname-container" style="box-sizing:border-box">ŁASKAWIEC</span></p><p class="inbox-inbox-position-container" style="box-sizing:border-box;color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:10px;margin:0px 0px 4px;text-transform:uppercase"><span class="inbox-inbox-position" style="box-sizing:border-box">INFINISPAN DEVELOPER</span></p><p class="inbox-inbox-legal-container" style="box-sizing:border-box;font-family:overpass,sans-serif;margin:0px;font-size:10px;color:rgb(153,153,153)"><a class="inbox-inbox-redhat-anchor" href="https://www.redhat.com/" target="_blank" style="box-sizing:border-box;color:rgb(0,136,206);margin:0px;text-decoration:none">Red Hat<span class="inbox-inbox-Apple-converted-space"> </span><span style="box-sizing:border-box">EMEA</span></a></p><table border="0" style="box-sizing:border-box;color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:medium"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td width="100px" style="box-sizing:border-box"><a href="https://red.ht/sig" style="box-sizing:border-box"><img width="90" height="auto" style="box-sizing: border-box;" src="https://www.redhat.com/files/brand/email/sig-redhat.png"></a></td></tr></tbody></table></div></div>