Hi Thierry and Tamas, According to this paragraph: http://tools.ietf.org/html/rfc3986#section-5.2.3 we should indeed produce <http://localhost:8081/some/path> "http://localhost:8081/some/path" in this case. Thierry, could you fix this in SVN trunk and 1.1 branch? Best regards, Jérôme Louvel -- Restlet ~ Founder and Lead developer ~ <http://www.restlet.org/> http://www.restlet.org Noelios Technologies ~ Co-founder ~ <http://www.noelios.com/> http://www.noelios.com
_____ De : Thierry Boileau [mailto:[EMAIL PROTECTED] Envoyé : lundi 17 novembre 2008 08:28 À : [email protected] Objet : Re: getRootRef() returns null? Hello Tamás >I know that the value above does not have a path, but for some reason >i expected to have root ("/") returned instead of null. According to the URI specification (http://www.ietf.org/rfc/rfc3986.txt, chapter "3 Syntax Components), I see that the path is required but can be empty... In your case, I think it rather should be empty than null or "/". So you point something important. Jérôme, any thoughts? >Reference ref = new Reference( request.getRootRef(), relPart ); >ref.getTargetRef() returns "some/path", which is wrong in my opinion. >I would expect "http://localhost:8081/some/path" <http://localhost:8081/some/path> as resolved target >reference, right? That's what I get in a sample application (attached to this mail). Best regards, Thierry Boileau -- Restlet ~ Core developer ~ http://www.restlet.org <http://www.restlet.org/> Noelios Technologies ~ Co-founder ~ http://www.noelios.com <http://www.noelios.com/> Hi, After debugged the cause :) The situation I have is the following (just as reminder: restlet 1.1.1, runned in j2ee webapp using ServletServer): I am constructing a reference, that is made from base part and path. The base reference is got using the request.getRootRef(), and it -- in my case -- yields "http://localhost:8081" <http://localhost:8081> , since the webapp is mounted at root of web container, and the Application is at the root of webapp (handles "/*"). The resulting reference is constructed like this: Reference ref = new Reference( request.getRootRef(), relPart ); next, i have a check: !ref.getBaseRef().getPath().endsWith( "/" ), but it fails with NPE, since the getPath() of the base reference returns null. I know that the value above does not have a path, but for some reason i expected to have root ("/") returned instead of null. Furthermore, with values above, the following is happening: basePart (is of type Reference got using request.getRootRef()) = "http://localhost:8081" <http://localhost:8081> relPart = "some/path" And Reference ref = new Reference( request.getRootRef(), relPart ); ref.getTargetRef() returns "some/path", which is wrong in my opinion. I would expect "http://localhost:8081/some/path" <http://localhost:8081/some/path> as resolved target reference, right? So, my question is: is this the expected behaviour (and my check should look for null path too), or it is restlet bug? Thanks in advance, ~t~ On Thu, Nov 13, 2008 at 4:43 PM, Tamás Cservenák <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: Hi Thierry, yes, you are right. I have verified your "sample" code using Tomcat 6, Jetty 6 and our custom (jetty6 and plexus based) Plexus Webapp container, and it works. That means our integration has some bug out there.... Thanks, ~t~ On Wed, Nov 12, 2008 at 4:52 PM, Tamás Cservenák <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: Hi Thierry, This is Nexus, so: restlet version 1.1.1, integrated with Plexus (latest beta2) and Jetty as servlet container. But, the Application itself runs in slightly modified SerlvetServer (modified, since it does a lookup for Application as Component, and does not instantiates the Application manually, but falls back to "default" SerlvetServer behavior if component is not found. Is there any "critical" place (ie. ServletServer Application instantiation, or whatever) what could affect the RootRef calculation? Will look at your example, and will try to find where are we messing it within Nexus. ~t~ On Wed, Nov 12, 2008 at 11:10 AM, Thierry Boileau <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: Hello Tamás it seems weird. Could precise your version of Restlet? Are you working with the Spring extension? I send you a sample Eclipse project which seems to work fine (Restlet 1.1). It displays the rootRef from a resource. Best regards, Thierry Boileau -- Restlet ~ Core developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com Hi there, i just want to ask is it valid to have request.getRootRef() returning null? That is happening when Application is "mounted" at root of the j2ee webapp container (at "/"). When it runs in some of the "usual" context paths (ie. "/nexus"), it works fine, and returns the expected reference to the root of that context path. -- Thanks, ~t~ -- Thanks, ~t~

