<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">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 style>assuming you want to access: <a href="http://www.slackers.com/security/team">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">http://www.slackers.com/team</a> (getting rid of the security part in the URI)</div>
<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 style>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 style>
<br></div><div style>







<p class=""><span class="">    </span><span class="">NSURL</span><span class=""> *url = [</span><span class="">NSURL</span><span class=""> </span><span class="">URLWithString</span><span class="">:</span>@&quot;<a href="http://server.com/security">http://server.com/security</a>&quot;<span class="">];<br>
</span><span class="">    url = [url </span>URLByAppendingPathComponent<span class="">:</span><span class="">@&quot;/foo/bar&quot;</span><span class="">];</span></p>
<p class=""><span class="">===&gt;     http:</span>//<a href="http://server.com/security/foo/bar">server.com/security/foo/bar</a></p>
<p class=""><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 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><br></div><div>  Seb</div><div><br></div></div></div>
<br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">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><br></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>