开启两个tomat—mvn 用法—HttpURLConnection用法
2015-11-17 14:54
591 查看
开启两个tomat—mvn 用法—HttpURLConnection用法
1 开启两个tomcat方法
只需要改四个端口
8080 ==8081
8005 == 8006
8009==8010
8443==8444
2 maven
Mvn jar:jar Mvn打包
Mvn site mvn生成api ,不过只对了一次
3 HttpURLConnection 用法
HttpURLConnection httpConn = null;
OutputStream stream = null;
try {
String urlString = "http://" + abc
URL url = new URL(urlString);
httpConn = (HttpURLConnection)url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setDoOutput(true);
httpConn.setRequestProperty("Content-Type","multipart/form-data");
httpConn.setRequestProperty("Content-length",
String.valueOf(abc);
httpConn.setRequestProperty("FileGroup", ddd);
httpConn.setRequestProperty("FileType", tyssspe);
httpConn.setRequestProperty("UploadType", "UPDATE");
httpConn.setRequestProperty("FileName", name);
httpConn.setRequestProperty("UserName", ddd);
httpConn.setRequestProperty("SpecialFolderPath","");
stream = httpConn.getOutputStream();
stream.write(dd, 0, dd.length);
stream.flush();
int code = httpConn.getResponseCode();
stream.close();
httpConn.disconnect();
httpConn = null;
stream = null;
if (code != 200) {
throw newException("upload failded");
}
1 开启两个tomcat方法
只需要改四个端口
8080 ==8081
8005 == 8006
8009==8010
8443==8444
2 maven
Mvn jar:jar Mvn打包
Mvn site mvn生成api ,不过只对了一次
3 HttpURLConnection 用法
HttpURLConnection httpConn = null;
OutputStream stream = null;
try {
String urlString = "http://" + abc
URL url = new URL(urlString);
httpConn = (HttpURLConnection)url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setDoOutput(true);
httpConn.setRequestProperty("Content-Type","multipart/form-data");
httpConn.setRequestProperty("Content-length",
String.valueOf(abc);
httpConn.setRequestProperty("FileGroup", ddd);
httpConn.setRequestProperty("FileType", tyssspe);
httpConn.setRequestProperty("UploadType", "UPDATE");
httpConn.setRequestProperty("FileName", name);
httpConn.setRequestProperty("UserName", ddd);
httpConn.setRequestProperty("SpecialFolderPath","");
stream = httpConn.getOutputStream();
stream.write(dd, 0, dd.length);
stream.flush();
int code = httpConn.getResponseCode();
stream.close();
httpConn.disconnect();
httpConn = null;
stream = null;
if (code != 200) {
throw newException("upload failded");
}
相关文章推荐
- 【鸟哥的linux私房菜-学习笔记】计算机网络相关知识简要回顾
- 计算机网络面试题总结
- 学习okhttp wiki--HTTPS
- 详解this http://www.cnblogs.com/Wayou/p/all-this.html
- Android系列之网络(二)----获取HTTP请求头与响应头
- 交换机知识--网络安全介绍
- 总结几点无线Mesh网络的优点
- Android 判断用户2G/3G/4G移动数据网络
- 网络常用命令集锦
- 在RDO自动安装的OpenStack Liberty单机中搭建能够内外网互访的网络(一)-网络规划
- 内核线程 http://blog.chinaunix.net/uid-24467128-id-3246495.html
- 网络编程-TCP状态图详细说明 没有不懂的
- 《神经网络和深度学习》系列文章之目录
- 信息学奥林匹克竞赛-网络各层设备
- android https正确调用方案(防中间人劫持)
- FastJson和AsyncHttpCLient
- 安卓SDK下载国内镜像网站 http://gmirror.org/#android-sdk-tools-only
- 《神经网络和深度学习》系列文章十三:反向传播背后的四个基本等式
- 《神经网络和深度学习》系列文章十二:Hadamard积,s⊙t
- 《神经网络和深度学习》系列文章十一:关于损失函数的两个假设