Hi Brian,

Please find attached the test case that we use for Spring. It doesn't
produce a circular reference issue even if it looks similar to the one you
use.

Best regards,
Jerome  

> -----Message d'origine-----
> De : news [mailto:[EMAIL PROTECTED] De la part de Brian Donnovan
> Envoyé : samedi 8 mars 2008 14:23
> À : discuss@restlet.tigris.org
> Objet : Re: restlet + spring --- managed resources
> 
> Rhett Sutphin <rhett <at> detailedbalance.net> writes:
> 
> > The way I handle this is to do internal configuration of 
> the resource,  
> > including setting variants, in the init method.  For example:
> > 
> >      @Override
> >      public void init(Context context, Request request, Response  
> > response) {
> >          super.init(context, request, response);
> >          setReadable(true);
> >          setModifiable(false);
> >          getVariants().add(new Variant(MediaType.TEXT_XML));
> >      }
> > 
> > I only use Spring XML to inject beans (services, DAOs, 
> etc.) that are  
> > configured with Spring.
> 
> thanks for your help! everything seems to work fine now, 
> except for the circular
> reference issue, but i solved that the hacky way for now ...
> 
> brian
> 
> 
> 
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>

	<bean id="component"
		class="org.restlet.ext.spring.SpringComponent">
		<property name="clientsList">
			<list>
				<value>file</value>
			</list>
		</property>
		<property name="server" ref="server" />
		<property name="defaultTarget" ref="application" />
		<property name="hosts">
			<list>
				<ref bean="virtualHost" />
			</list>
		</property>
	</bean>

	<bean id="server" class="org.restlet.ext.spring.SpringServer">
		<constructor-arg value="http" />
		<constructor-arg value="8182" />
		<property name="parameters">
			<props>
				<prop key="key1">value1</prop>
				<prop key="key2">value2</prop>
			</props>
		</property>
	</bean>

	<bean id="virtualHost" class="org.restlet.ext.spring.SpringHost">
		<property name="hostDomain"
			value="mydomain.com|www.mydomain.com" />
		<property name="attachments">
			<map>
				<entry key="/">
					<ref bean="application" />
				</entry>
			</map>
		</property>
	</bean>

	<bean id="application"
		class="org.restlet.ext.spring.SpringApplication">
		<constructor-arg ref="component" />

		<property name="root">
			<bean class="org.restlet.ext.spring.SpringRouter">
				<constructor-arg ref="application" />

				<property name="attachments">
					<map>
						<entry key="/users/{user}"
							value="org.restlet.example.tutorial.UserResource" />

						<entry key="/users/{user}/orders"
							value="org.restlet.example.tutorial.OrdersResource" />

						<entry key="/users/{user}/orders/{order}"
							value="org.restlet.example.tutorial.OrderResource" />
					</map>
				</property>
			</bean>
		</property>
	</bean>

</beans>

Attachment: SpringTestCase.java
Description: Binary data

Reply via email to