Hmmm. No joy getting this to work, CAS seems to just return with a 302
redirect. Is the standard CAS webflow getting in the way?

I have tried manifold combinations of /tickets refs in web.xml with no joy.

My setup:

/WEB-INF/web.xml

        <servlet>
                <servlet-name>restlet</servlet-name>
               
<servlet-class>com.noelios.restlet.ext.spring.RestletFrameworkServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
                <servlet-name>restlet</servlet-name>
                <url-pattern>/tickets/*</url-pattern>
        </servlet-mapping>

/WEB-INF/restlet-servlet.xml (unmodified)

<?xml version="1.0" encoding="UTF-8"?>
<beans 
  xmlns="http://www.springframework.org/schema/beans";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:context="http://www.springframework.org/schema/context";
  xsi:schemaLocation="http://www.springframework.org/schema/beans   
                                         
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                                         
http://www.springframework.org/schema/context 
                                         
http://www.springframework.org/schema/context/spring-context-2.5.xsd";>

        <context:annotation-config/>

        <bean id="root" class="org.restlet.ext.spring.SpringRouter">
                <property name="attachments">
                        <map>
                                <entry key="/tickets">
                                        <bean
class="org.restlet.ext.spring.SpringFinder">
                                                <lookup-method
name="createResource" bean="ticketResource" />
                                        </bean>
                                </entry>
                                <entry
key="/tickets/{ticketGrantingTicketId}">
                                        <bean
class="org.restlet.ext.spring.SpringFinder">
                                                <lookup-method
name="createResource" bean="ticketGrantingTicketResource" />
                                        </bean>
                                </entry>
                        </map>
                </property>   
        </bean>

        <bean id="ticketResource"
class="org.jasig.cas.integration.restlet.TicketResource" scope="prototype"
/>

        <bean id="ticketGrantingTicketResource"
class="org.jasig.cas.integration.restlet.TicketGrantingTicketResource"
scope="prototype" />

</beans>

Client code:

#!/usr/bin/python
import httplib, urllib
params = urllib.urlencode({'username': 'moi%40acme.com', 'password':
'letmein'})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept":
"text/plain"}
conn = httplib.HTTPSConnection("test-cas.acme.com")
conn.request("POST", "/cas/tickets/", params, headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
conn.close()
print data

[EMAIL PROTECTED] ~]$ ./casme.py
302 Moved Temporarily

ssl.log:

10.3.2.13 - - [14/Aug/2008:17:06:10 +1200] "POST /cas/tickets/ HTTP/1.1" 302
-

cas.log:

2008-08-14 17:06:10,597 DEBUG
[org.springframework.web.context.support.XmlWebApplicationContext] -
<Publishing event in context
[EMAIL PROTECTED]:
ServletRequestHandledEvent: url=[/cas/tickets/]; client=[10.3.2.13];
method=[POST]; servlet=[restlet]; session=[null]; user=[null]; time=[45ms];
status=[OK]>
2008-08-14 17:06:10,599 DEBUG
[org.springframework.web.context.support.XmlWebApplicationContext] -
<Publishing event in context
[EMAIL PROTECTED]:
ServletRequestHandledEvent: url=[/cas/tickets/]; client=[10.3.2.13];
method=[POST]; servlet=[restlet]; session=[null]; user=[null]; time=[45ms];
status=[OK]>



scott_battaglia wrote:
> 
> I added some stuff to the bottom of this page if you want to try it out:
> http://www.ja-sig.org/wiki/display/CASUM/RESTful+API
> 
> -Scott
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-do-I-activate-the-new-RESTful-api--tp18885690p18975810.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

Reply via email to