I have in my app Restlet server and If I open the server address in the browser then the server should return list of files in some folder and If the user click on the file then it should download the file.
I looked at this tutorial. Part 6 Serving static file. It´s this code:
public static final String ROOT_URI = "file:///c:/restlet/docs/api/";
[...]
// Create a component
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getClients().add(Protocol.FILE);
// Create an application
Application application = new Application() {
@Override
public Restlet createInboundRoot() {
return new Directory(getContext(), ROOT_URI);
}
};
// Attach the application to the component and start it
component.getDefaultHost().attach(application);
component.start();
but if I use for example file:///sdcard/
in URI, then if I open the address in the browser I get
Not Found
The server has not found anything matching the request URI
You can get technical details here.
Please continue your visit at our home page.
What´s wrong? How can I return list of the files with Restlet?