2
我在我的应用程序Restlet服务器和如果我在浏览器中打开服务器地址,然后服务器应返回文件列表中的某些文件夹,如果用户点击文件,那么它应该下载文件。Android Restlet框架 - 获取文件列表并下载文件
我看着这个tutorial。第6部分提供静态文件。 It's此代码:
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();
,但如果我在URI使用例如file:///sdcard/
,那么如果我在浏览器中打开地址,我得到
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.
有什么不对?我如何使用Restlet返回文件列表?