great! regards, Thierry Boileau
On Thu, Feb 28, 2008 at 7:53 PM, Jim Alateras <[EMAIL PROTECTED]> wrote: > Thierry, > > Thanks once again. The supplied code snippet worked with a slight > modification > > Reference reference = new Reference("http://localhost/exchange"); > > reference.setBaseRef("http://localhost"); > Request request = new Request(Method.POST, reference); > > > > cheers > </jima> > Thierry Boileau wrote: > > Hi Jim, > > > > The application must handle absolute URIs. You can update your code as > follow : > > > > Reference reference = new Reference("/exchange"); > > reference.setBaseRef("http://localhost"); > > Request request = new Request(Method.POST, reference); > > > > By doing so, the application still handles a reference with a relative > > part equals to "/exchange". > > > > best regards, > > Thierry Boileau > > > > On Wed, Feb 27, 2008 at 8:49 PM, Jim Alateras <[EMAIL PROTECTED]> wrote: > >> Thierry, > >> > >> Just some additional info. I am getting this error in a test case > >> scenario so I may not be priming the 'request' with all the correct info > >> > >> Here is the code that I am using > >> > >> Request request = new Request(Method.POST, "/exchange"); > >> Response response = application.handle(request); > >> assertTrue(response.getStatus() == Status.SUCCESS_CREATED); > >> assertTrue(response.getLocationRef().getPath() != null); > >> > >> Do i need to do anything extra to the request object before i pass it > >> across to application.handle. > >> > >> cheers > >> </jima> > >> > >> > >> > >> Thierry Boileau wrote: > >> > Hello Jim, > >> > > >> > when passing a relative URI, the location reference is resolved > >> > against the base reference of the request's resource > >> > reference ("getRequest().getResourceRef().getBaseRef()"). > >> > > >> > Could you check the values of "getRequest().getResourceRef()" and > >> > "getRequest().getResourceRef().getBaseRef()"? > >> > > >> > >> > > >> > best regards, > >> > Thierry Boileau > >> > > >> > On Wed, Feb 27, 2008 at 10:42 AM, Jim Alateras <[EMAIL PROTECTED]> > wrote: > >> >> Hi, > >> >> > >> >> I am trying to set the location header after a post to communicate > the > >> >> URL of the created resource. I basically use the following piece of > code > >> >> to set the location passing a relative uri > >> >> > >> >> getResponse().setLocationRef("sessionId"); > >> >> > >> >> but i get the following error > >> >> > >> >> java.lang.IllegalArgumentException: Relative references are only > usable > >> >> when a base reference is set. > >> >> > >> >> > >> >> Any ideas? > >> >> > >> >> cheers > >> >> </jima> > >> >> > >> > > >> > >> > > > >