![](/img/trans.png)
[英]How do I serve external css, jpg and gif files from Nanohttpd (Nanohttpd run on a normal pc not on Android)?
[英]How do I access the file I've uploaded to NanoHTTPD?
我已经将文件放在NanoHTTPD服务器上,如下所示:
private class WebServer extends NanoHTTPD {
public WebServer()
{
super("hostname", 8080);
}
@Override
public Response serve(String uri, Method method,
Map<String, String> header,
Map<String, String> parameters,
Map<String, String> files) {
String answer = "";
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(fileToUpload);
}catch(Exception e){}
return new NanoHTTPD.Response(Status.OK, mimeType, inputStream);
}
}
现在如何在Web浏览器中访问该文件?
地图文件= new HashMap();
session.parseBody(文件);
Log.d(TAG,files.toString());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.