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返回文件列表?