/**
* 下载位置文件模板
*/@RequestMapping("/downTxtFile")@ResponseBodypublicvoiddownTxtFile(HttpServletRequest request,HttpServletResponse response)throwsUnsupportedEncodingException{String text ="Designator Mid X Mid Y Ref X Ref Y Pad X Pad Y TB Rotation Comment";
response.setCharacterEncoding("utf-8");//设置响应的内容类型
response.setContentType("text/plain");//设置文件的名称和格式
response.addHeader("Content-Disposition","attachment;filename="+URLEncoder.encode("位置文件模板.txt","UTF-8"));BufferedOutputStream buff =null;ServletOutputStream outStr =null;try{
outStr = response.getOutputStream();
buff =newBufferedOutputStream(outStr);
buff.write(text.getBytes("UTF-8"));
buff.flush();
buff.close();}catch(Exception e){}finally{try{
buff.close();
outStr.close();}catch(Exception e){}}}