【发布时间】:2015-08-07 12:41:51
【问题描述】:
我正在使用 Grails Rest 插件从服务器下载文件,但如何获取作为 http 标头字段“Content-disposition”一部分的建议文件名?
我的代码:
withHttp(uri:uri){
def logo = new Logo()
def status = get(path:path, query:[identity: identity]){ resp, body ->
if( resp.status == 200){
logo.contentType = resp.contentType
// logo.fileName = How?
logo.bytes = body.getBytes()
}
return resp.status
}
if(status == 200){
return logo
}
else{
log.warn("Failed to fetch logo ")
return null;
}
}
我可以读取内容类型,如何获得建议的文件名?
【问题讨论】: