本文整理汇总了Java中org.seasar.struts.util.ResponseUtil.download方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseUtil.download方法的具体用法?Java ResponseUtil.download怎么用?Java ResponseUtil.download使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.seasar.struts.util.ResponseUtil
的用法示例。
在下文中一共展示了ResponseUtil.download方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: index
import org.seasar.struts.util.ResponseUtil; //导入方法依赖的package包/类
/**
* provide user's icon.
* @return null
* @throws IOException #{@link PublicStorage#open()}
*/
@Execute(validator = false, urlPattern = "{userCd}")
public String index() throws IOException {
if (!StringUtil.isEmpty(userIconForm.userCd)) {
final UserOperations uo = Services.get(UserOperations.class);
try {
final User user = uo.getUser(userIconForm.userCd);
if (user == null) return null;
final String path = user.getAttachPath();
final PublicStorage storage = new PublicStorage(path);
try (final InputStream is = storage.open()) {
ResponseUtil.download(user.getAttachId(), is);
}
} catch (final IMBoxException | IOException e) {
Logger.getLogger()
.debug("Error occured while fetching icon. userCd: " + userIconForm.userCd, e);
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
}
return null;
}
示例2: download
import org.seasar.struts.util.ResponseUtil; //导入方法依赖的package包/类
@Execute(validator = false)
public String download() {
try {
ResponseUtil.download(new String("memberUpload.csv".getBytes("Shift_JIS"), "Shift_JIS"),
"hname,mail,id,pw".getBytes());
} catch (IOException e) {
throw new IORuntimeException(e);
}
return null;
}
示例3: download
import org.seasar.struts.util.ResponseUtil; //导入方法依赖的package包/类
@Execute(validator = false)
public String download() {
try {
ResponseUtil.download(new String(
"サンプル.txt".getBytes("Shift_JIS"),
"ISO-8859-1"), "こんにちは".getBytes("Shift_JIS"));
} catch (IOException e) {
throw new IORuntimeException(e);
}
return null;
}