//取得所有参数及值; String url = request.getServletPath() + "?" + request.getQueryString(); String QueryPath = request.getServletPath() + "?" + request.getQueryString(); Enumeration enumOne=request.getParameterNames(); while(enumOne.hasMoreElements()){ String s = (String)enumOne.nextElement(); if(s.equals("method")) String queryStr += request.getParameter(s); System.out.println("Parameter\t" + s + "\t=\t" +queryStr); } /** * 将接收的参数转换编码 * @param parm * @return */ public String enCoderRequestParm(String parm){ String temp =""; try { temp= new String(parm.getBytes("ISO-8859-1"), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return temp; } /** * 下载模板文件, * @param filePath * @param response */ @SuppressWarnings("unused") protected void downTemplateFileTo(String filePath, HttpServletResponse response) { File file = new java.io.File(filePath); long long_len = file.length(); FileInputStream inputStream = null; try { inputStream = new FileInputStream(file); if (inputStream != null) { String fname = file.getName(); response.setContentType("application/x-msdownload"); String header = "attachment; filename=" + fname; response.setHeader("Content-Disposition", header); response.setContentLength((int) long_len); byte[] b = new byte[2048]; int len = 0; while ((len = inputStream.read(b)) != -1) { try { response.getOutputStream().write(b, 0, len); }catch(Exception ex){ } } } inputStream.close(); } catch (Exception ex) { System.out.println("Download error: "); ex.printStackTrace(); } } /** * 下载模板文件, * @param filePath * @param response */ @SuppressWarnings("unused") protected void downTemplateFileTo(String filePath, HttpServletResponse response,String fname) { try { fname = new String(fname.getBytes(), "iso8859-1"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } File file = new java.io.File(filePath); long long_len = file.length(); FileInputStream inputStream = null; try { inputStream = new FileInputStream(file); if (inputStream != null) { response.setContentType("application/x-msdownload"); String header = "attachment; filename=" + fname; response.setHeader("Content-Disposition", header); response.setContentLength((int) long_len); byte[] b = new byte[2048]; int len = 0; while ((len = inputStream.read(b)) != -1) { try { response.getOutputStream().write(b, 0, len); }catch(Exception ex){ } } } inputStream.close(); } catch (Exception ex) { System.out.println("Download error: "); ex.printStackTrace(); } finally{ File f = new java.io.File(filePath); if(f.exists()){ f.delete(); } } } /** * 下载模板文件, * @param filePath * @param response */ @SuppressWarnings("unused") protected void downTemplateFileTo(String filePath, HttpServletResponse response,String fname,String nouser) { try { fname = new String(fname.getBytes(), "iso8859-1"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } File file = new java.io.File(filePath); long long_len = file.length(); FileInputStream inputStream = null; try { inputStream = new FileInputStream(file); if (inputStream != null) { response.setContentType("application/x-msdownload"); String header = "attachment; filename=" + fname; response.setHeader("Content-Disposition", header); response.setContentLength((int) long_len); byte[] b = new byte[2048]; int len = 0; while ((len = inputStream.read(b)) != -1) { try { response.getOutputStream().write(b, 0, len); }catch(Exception ex){ } } } inputStream.close(); } catch (Exception ex) { System.out.println("Download error: "); ex.printStackTrace(); } finally{ } } /** * 创建文件 * @param filePath 文件的全路径 * @return */ public File createUploadLogWriter(String filePath) { File file = null; try { file = new File(filePath); if (file.exists()) { log.info("文件存在"); } else { log.info("文件不存在,正在创建..."); if (file.createNewFile()) { log.info("文件创建成功!"); } else { log.info("文件创建失败!"); } } } catch (Exception e) { e.printStackTrace(); } return file; } /** * 验证文件的类型是否为传入的类型 * @param fileName * @param type * @return */ public boolean checkThisFileType(String fileName, String type) { String types[] = fileName.split("\\."); String ttype = types[types.length - 1]; if (ttype.equalsIgnoreCase(type) || ttype.equalsIgnoreCase(type)) { return true; } else { return false; } } /** * 创建日志文件 * fpath = "\\模块目录\\log\\类型Log.txt"; * @param request * @param fpath * @return */ public BufferedWriter createLogWriter(HttpServletRequest request, String fpath) { String basePath = request.getSession().getServletContext().getRealPath(""); String fullPath = basePath + fpath; BufferedWriter output = null; try { File f = this.createUploadLogWriter(fullPath); output = new BufferedWriter(new FileWriter(f)); } catch (Exception e) { e.printStackTrace(); } return output; }
发表评论
-
java中List<Map>形的数据转JSON形的树
2014-02-21 11:13 6773本段代码主要是一个工具。费话不多说, 注:代码中的一些常量 ... -
对象转XML
2013-02-19 10:47 918代码如下: import java.util.List; ... -
对象转JSON
2013-02-19 10:43 936使用到的JAR包 ezmorph.jar xom ... -
java操作数据的部分代码
2013-01-31 14:45 01、根据上级取下级:所有的子集某值 String sql ... -
许多段代码
2013-01-31 14:25 8921、项目地址与类的包名路径 String pro ... -
Java反射Bean
2013-01-31 14:11 747import java.lang.reflect.Fiel ... -
将java编译后的Class转成exe
2014-02-21 11:32 956从www.towerj.com获得一个T ... -
身份证验证
2012-11-29 09:53 700/****************************** ... -
java中的乱码解决方案
2012-10-27 11:16 792java后台转换编码str= new String(str.g ... -
Page Sql
2011-08-10 13:20 735/** * 数量统计 * @param sql ... -
导入导出
2011-08-10 13:15 8511、保存到文件 public File queryToF ... -
警告:Parameters: Invalid chunk ignored.
2011-05-24 12:22 832警告:Parameters:Invalid chunk ign ... -
Myeclipse 优化
2011-04-18 14:38 639关闭MyEclipse7.0自动更新 ... -
编码转换
2011-01-21 14:47 754编码转换! /** * @author yshli ... -
常用代码:java日期处理
2011-01-21 14:40 816个人整理的关于java中日期处理会应用到的程序。 /* ...
相关推荐
Process Monitor 是windows下高级实时监听工具,用于监视文件系统、注册表、进程和线程的活动。它兼并了两个Sysinternals实用工具Filemon和Regmon的特点,并且增加了一系列的扩展包括丰富而无干扰的过滤全面的事件...
Aspen Process Explorer 简介 Aspen Process Explorer 是一个功能强大且灵活的过程信息管理系统,旨在帮助管理人员、工程师和操作人员快速而准确地做出决策。它通过组织和显示过程信息来改善操作性能,集成了多种...
Process是一款用于spss软件中的调节效应插件,专门进行分析中介效应和调节效应,Process主要应用于SPSS、SAS等传统数据统计分析软件,在SPSS中除了可以可视化操作外,还可以通过Syntax语法等方式操作,扩展功能更为...
spss、sas process包,PROCESS的第3版在中介,调节和条件过程分析简介第二版中进行了描述和记录。单击下面的按钮下载版本3.4(2019年8月12日发行)。这样做时,将根据您的浏览器设置下载.zip存档。PROCESS的安装和...
Process Monitor是Windows的高级监视工具,可显示实时文件系统,注册表和进程/线程活动。它结合了两个旧的Sysinternals实用程序Filemon和 Regmon的功能,并添加了广泛的增强功能列表,包括丰富的和非破坏性的过滤,...
// Process p = new Process(); // p.StartInfo.FileName = "cmd.exe"; // p.StartInfo.UseShellExecute = false; // p.StartInfo.RedirectStandardInput = true; // p.StartInfo.RedirectStandardOutput = ...
Process Hacker是一款针对高级用户的安全分析工具,它可以帮助研究人员检测和解决软件或进程在特定操作系统环境下遇到的问题。除此之外,它还可以检测恶意进程,并告知我们这些恶意进程想要实现的功能。 Process ...
ProcessExcel ProcessExcel ProcessExcel ProcessExcel ProcessExcel
Unlikeother books that promote a specific process and performance improvement discipline, this book shows organizations how to achieve success by fixing basic operational issues and problems using a ...
SPSS使用PROCESS插件检验调节效应及简单斜率分析 SPSS是一种广泛应用于社会科学研究的统计分析软件,PROCESS插件是SPSS的一个插件,主要用于检验调节效应和简单斜率分析。在本文中,我们将详细介绍如何使用PROCESS...
SAP Process Orchestration The Comprehensive Guide, 2nd Edition SAP流程编制综合指南 1 Introduction to SAP Process Orchestration 1.1 Historical Overview and Evolution 1.1.1 SAP Process Integration ...
Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity. It combines the features of two legacy Sysinternals utilities, ...
Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity. It combines the features of two legacy Sysinternals utilities, ...
Process Explorer让使用者能了解看不到的在后台执行的处理程序,能显示目前已经载入哪些模块,分别是正在被哪些程序使用着,还可显示这些程序所调用的 DLL进程,以及他们所打开的句柄。Process Explorer最大的特色...
C:\Downloads\ProcessMonitor.C:\Downloads\ProcessMonitor.zipzip
最近做一个编程,用C#调用类似ssh,...网上说使用Process.StartInfo,Process.StandardInput,Process.StandOutput之类的,但是每次都在StandardOutput.Read/ReadToEnd卡死,原因复杂,最主要原因是微乳没有做好.下面是个分析 ...
Process Monitor 1.35 汉化版 这是一个高级的 Windows 系统和应用程序监视工具,由优秀的 Sysinternals 开发,并且目前已并入微软旗下,可靠性自不用说。 此版本的 Process Monitor 增加了多项重要增强功能,包括...
Process 启动进程Process 启动进程Process 启动进程
spss_process最新版v4.1
C语言头文件 PROCESSC语言头文件 PROCESSC语言头文件 PROCESSC语言头文件 PROCESSC语言头文件 PROCESSC语言头文件 PROCESSC语言头文件 PROCESSC语言头文件 PROCESSC语言头文件 PROCESSC语言头文件 PROCESSC语言...