Hello all,

Im trying to serve static content from the filesystem but I cant. I was
able to do it with a plain and simple Reslet application but not using
SpringBeanRouter.
Here is the code:


@Component("/v1/images/{imageId}")

@Scope("prototype")

public class ImagesResource extends DirectoryServerResource {

private String imageId;

@Override

public void doInit() throws ResourceException {

 Directory directory = new Directory(getContext(),

 "file:///path/images");

 getRequestAttributes().put("org.restlet.directory", directory);

 super.doInit();

}

}
And here the xml mapping:

 <bean id="restletComponent" class="org.restlet.ext.spring.SpringComponent">

 <property name="defaultTarget" ref="restletApplication" />

 <property name="clientsList">

 <list>

  <value>CLAP</value>

  <value>FILE</value>

 </list>

 </property>

</bean>

<bean id="restletApplication" class="org.restlet.ext.wadl.WadlApplication"

 scope="singleton">

 <property name="name" value="REST API" />

 <property name="inboundRoot" ref="ServerHeaderFilter" />

 <property name="encoderService.enabled" value="true" />

</bean>

 <bean name="springRouter" class="org.restlet.ext.spring.SpringBeanRouter"
/>


Im facing two issues:

1- the URL mapping. If i use "/v1/images", SpringBeanRouter does not match
it, so I went for "/v1/images/{imageId}"

2- If i dont put the Directory in the map, I get a NullPointerException. It
looks odd, is there any other/better way of doing it?

Thanks!
-- 
Jorge Gallardo
----------------------------------------
jorgeagalla...@gmail.com

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3079543

Reply via email to