Hello Paul,
I've tested this code below with both Restlet 1.1 (snapshot) and
Restlet 1.0.8 and it works.
Could you tell us more about your code?
best regards,
Thierry Boileau
public static void main(String[] args) throws Exception {
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getClients().add(Protocol.FILE);
Application application = new Application(component.getContext()) {
@Override
public Restlet createRoot() {
Router router = new Router(getContext());
File file = new File(
"C:\\Documents and Settings\\user\\My
Documents\\My Pictures");
Directory directory = new Directory(getContext(), file.toURI()
.toString());
router.attachDefault(directory);
return router;
}
};
component.getDefaultHost().attach("", application);
// Start the server
component.start();
}
On Sat, Mar 8, 2008 at 2:51 AM, Paul J. Lucas <[EMAIL PROTECTED]> wrote:
> On Mar 7, 2008, at 5:12 PM, cleverpig wrote:
>
> > public Restlet createRoot(){
>
> > final String
> >
> DIR_ROOT_URI="file:///E:/eclipse3.1RC3/workspace/RestletPractice/static_files/
> > ";
>
> Yes, I already know how to do the code. That's not my question. The
> differences between your example and mine are:
>
> + Yours has "file:///" whereas mine has "file:/"
> + Yours has no spaces encoded as %20.
>
> I hacked my code and made it use "file:///" and it made no
> difference. After some more experimentation, it seems the problem is
> the %20 characters. To make a simpler test-case, I used a path like:
>
> C:\tmp\sub_directory
>
> When converted via File.toURI().toString(), I get:
>
> file:/C:/tmp/sub_directory
>
> and that works. When I rename sub_directory so it has a space instead:
>
> C:\tmp\sub directory
>
> I get:
>
> file:/C:/tmp/sub%20directory
>
> And this causes Restlet not to work. It seems like a bug to me.
>
> - Paul
>