zoukankan      html  css  js  c++  java
  • 每日总结

    1. 今天继续学习android的http通过content-dispostion响应头,让浏览器下载文件

    public class ServletFive extends HttpServlet {
        
        @Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
                throws ServletException, IOException {
            resp.setHeader("content-disposition", "attachment;filename=Android.pdf");
            InputStream in = this.getServletContext().getResourceAsStream("/file/android编码规范.pdf");
            byte buffer[] = new byte[1024];
            int len = 0;
            OutputStream out = resp.getOutputStream();
            while((len = in.read(buffer)) > 0)
            {
                out.write(buffer,0,len);
            }
        }
        
        @Override
        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
                throws ServletException, IOException {
            doGet(req, resp);
        }
  • 相关阅读:
    谈谈焦虑
    Bridge
    Abstract Factory
    开篇辞
    缓存穿透和缓存雪崩
    缓存与数据库的一致性思考
    GDB
    代码格式化
    CSMA/CA协议
    18年秋招(19届)复习指导+面经总结,手把手教你进大厂——阿里、网易、京东、多益等
  • 原文地址:https://www.cnblogs.com/chenghaixiang/p/14911844.html
Copyright © 2011-2022 走看看