Hello mastricker,

Inside your Resource, you can directly instantiate a FileRepresentation 
with the absolute path of the static file.

The directory Restlet is not intended to be used inside a Resource, it 
is a final handler of requests (such as a Resource), but for static files.
You instantiate the Directory Restlet with the URI of the local 
directory: "file:////home/user/path", or use the 
LocalReference#createFileReference* methods.

Best regards,
Thierry Boileau

> Hi,
>
> I am currently in the need of serving a single static file from a Resource.
> Lets say at / I want to return the file index.html located in WEB-INF that
> basically describes 
> my Service. 
> I found the examples on the restlet site but they attach a Directory to the
> /.
> If I specify in the Directory constructor "index.html" then it tries to acct
> as if it was a folder (obviously).
> As far as I have searched there is no File object in Restlet.
> How can I return the file instead of pasting the content of it inside a
> Resource and return it on GET request? Because that is harder to maintain
> then editing a html file.
>
> mastricker
>

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

Reply via email to