<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 11, 2013 at 1:20 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Thu, Apr 11, 2013 at 12:14 PM, Sebastien Blanc <span dir="ltr">&lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div><div>Hi,</div><div><br></div><div>

Today when we set up a Pipe and call methods on it, we have a different ways on how we can pass the  stuff which are part of the URI and more particularly the leading or ending &quot;/&quot; :</div>
<div><br></div><div>```</div><div>baseURL: &quot;<a href="http://www.slackers.com" target="_blank">http://www.slackers.com</a>&quot; //no ending slash </div><div>endpoint: &quot;/security&quot; //we have to start with a slash</div>

<div>```</div>
<div>But we can also do it the otherr way around :</div><div><br></div><div>```</div><div>baseURL: &quot;<a href="http://www.slackers.com/" target="_blank">http://www.slackers.com/</a>&quot; //ending slash </div><div>endpoint: &quot;security&quot; //no starting slash</div>


<div>```</div><div><br></div><div>Both are valid because our library (at least JavaScript) don&#39;t do any manipulation for ```baseURL``` and ```endpoint```.</div><div><br></div><div>But if you take the parameter ```id``` on the ```read``` function, this one must not have a leading &quot;/&quot; because it&#39;s added by the library:</div>


<div>```</div><div>id: &quot;team1&quot; //works</div><div>id: &quot;/team&quot; //fails</div></div></div></blockquote><div><br></div></div><div>assuming you want to access: <a href="http://www.slackers.com/security/team" target="_blank">http://www.slackers.com/security/team</a>, I&#39;d expect that /team fails, since that would mean: <a href="http://www.slackers.com/team" target="_blank">http://www.slackers.com/team</a> (getting rid of the security part in the URI)</div>
<div class="im">
<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<div>
<div>```</div><div>Until now ```id``` was the last part of the URI but since we are planning to add nested resources, ```id``` won&#39;t be necessarily the last fragment. For example, we could have a new parameter called ```resource``` to be appended at the end :</div>


<div><br></div><div>```</div><div>baseURL = &quot;<a href="http://www.slackers.com/" target="_blank">http://www.slackers.com/</a>&quot; //ending slash </div><div>endpoint: &quot;security&quot; // no starting slash</div><div>

id: &quot;5&quot; // handled by lib</div>
<div>resource: &quot;/crypto&quot; //leading slash needed</div><div>```</div><div>As the spirit of Pipes (at least for REST) is to offer an abstraction around the Ajax and URL handling plumbing code, I think we should have a convention for passing URI fragments that is the same for all. My suggestion is to do the same as for ```id``` : no leading ``` / ``` or ending ``` / ```.</div>

</div></div></blockquote><div><br></div><div><br></div></div><div>sounds right - however I guess the &quot;resource&quot; can be simply appended to the underlying library, at least in iOS land this is easy:</div><div>
<br></div><div>







<p><span>    </span><span>NSURL</span><span> *url = [</span><span>NSURL</span><span> </span><span>URLWithString</span><span>:</span>@&quot;<a href="http://server.com/security" target="_blank">http://server.com/security</a>&quot;<span>];<br>

</span><span>    url = [url </span>URLByAppendingPathComponent<span>:</span><span>@&quot;/foo/bar&quot;</span><span>];</span></p>
<p><span>===&gt;     http:</span>//<a href="http://server.com/security/foo/bar" target="_blank">server.com/security/foo/bar</a></p>
<p><br></p></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><div dir="ltr">
<div>

<div><br></div><div>If the user passes  a leading or ending ``` / ```, the library will removed it because it will be added implicitly. This way we are safe.</div><div><br></div><div>Remarks ? Questions ? </div></div></div>
</div></blockquote></div></div></div></blockquote><div><br></div><div><br></div><div style>but, yeah, for consistency, I prefer not using /resource.... - at least now :D</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im"><div dir="ltr"><div><div>  </div>

<div><br></div><div>  Seb</div><div><br></div></div></div>
<br></div>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><span class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br>
<br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>

twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>