Hi,

This is my fix:

Reference ticket_ref = getRequest().getResourceRef().addSegment(ticketGrantingTicketId);
            getResponse().setLocationRef(ticket_ref);

setLocationRef is actually behaving according to the way it is documented: "If you pass a relative location URI, it will be resolved with the current base reference of the request's resource reference (see Request.getResourceRef() and Reference.getBaseRef()."

Also, the way restlet references work, if your reference does not end in a slash and you use it as a base reference it assumes the last segment is NOT part of the base reference. So Request.getResourceRef() will return something like "http://blah.com/cas/v1/tickets"; and if you use that to construct a reference with the ticketGrantingTicketId (which is exactly what setLocationRef does) you get "http://blah.com/cas/v1/TICKETID ", not "http://blah.com/cas/v1/tickets/TICKETID";

I hate myself for figuring that out and not just prepending "tickets/" to the ticketID. Not like I'm likely to work on another Spring/Restlet app anytime soon. It took me an hour to find and dig through the restlet code and the only benefit is perhaps a year from now some junior at my client won't spend an hour scratching his head because the restlet-servlet.xml gets out of sync with the hard coded string.

So effectively what I've done is reduce the perceived difference in productivity between myself and future junior developers. :)

Cheerio,

Michael Johnston
[EMAIL PROTECTED]




On 28-Aug-08, at 10:49 AM, Scott Battaglia wrote:

I just realized I never responded to this. So short term it looks like we're going to need to append that ticket identifier, which seems wrong.

Are you on the restlet mailing lists at all? If so can you ask them about this? Otherwise I'll join the list to ask.

Thanks
-Scott

-Scott Battaglia
PGP Public Key Id: 0x383733AA
LinkedIn: http://www.linkedin.com/in/scottbattaglia


On Mon, Aug 18, 2008 at 8:13 PM, dale77 <[EMAIL PROTECTED]> wrote:

I modified cas-server-integration-restlet/pom.xml to change from M4 to M5.

The resulting build still returns an abbreviated location missing the
"tickets":

[EMAIL PROTECTED] ~]$ ./casme.py
201 Created

https://test-cas.acme.com/cas/v1/TGT-2-yadayadayada


scott_battaglia wrote:
>
> I looked at the /tickets thing being returned in the URL and I can't tell
> if
> its Restlet bug or not. I even changed the servlet context to /v1/ tickets > and modified the restlet-servlet.xml appropriately and it still only did a
> /v1 and not /v1/tickets
>
> I'd rather not hardcode /tickets into the Java file just in case people
> want
> to change the URL endpoints. Are you set up to easily try it out with the > latest Milestone to see if it still does it? Otherwise I can try it Monday
> at work.
>
> -Scott
>

--
View this message in context: 
http://www.nabble.com/How-do-I-activate-the-new-RESTful-api--tp18885690p19042267.html
Sent from the CAS Users mailing list archive at Nabble.com.

_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

Reply via email to