用HttpClient接收得到你的xml文件,将文件保存本地
解析xml文件,Dom,Sax都行,也可借助第三方XStrame解决,
解析对比,将得到的xml与本地xml比较,找出不同,生成文档
发送给你想发送的人
你用的servlet 还是别的框架?
选POST
选form-data
选body
选File
选文件
Send
// commons fileupload组件的情况下,servlet接收的数据只能是type=file表单元素类型,那么获取type=text类型,就可以使用parseRequest(request)来获取list,fileitem,判断isFormField,为true非file类型的。就可以处理了。下面是处理的部分代码:DiskFileItemFactory factory = new DiskFileItemFactory()factory.setSizeThreshold(1024*1024)
String dirtemp = "c:"
File filedir = new File(dirtemp + "filetemp")
String str = nullif(!filedir.exists())filedir.mkdir()factory.setRepository(filedir)
ServletFileUpload upload = new ServletFileUpload(factory)
List list = upload.parseRequest(request)for(
int i = 0i<list.size()i++)
{
FileItem item = (FileItem) list.get(i)
if (item.isFormField()) {
System.out.println(item.getString())
} else {
String filename = item.getName()
item.write(new File(request.getRealPath(dir), filename))
}
}
时间有限。自己看1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var connect = require('connect')
var http = require('http')
var app = connect()
var multipart = require('connect-multiparty')
// parse urlencoded request bodies into req.body
var bodyParser = require('body-parser')
app.use(bodyParser.urlencoded())
app.use(multipart())
// respond to all requests
app.post('/upload', function(req, resp) {
console.log(req.body, req.files)
// don't forget to delete all req.files when done
})
//create node.<a href="https://www.baidu.com/s?wd=js&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3PAuWP1T4rH9-nyRzPADk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1DvrH0YPWmsrjRdnWR3Pjn4rj6" target="_blank" class="baidu-highlight">js</a>http server and listen on port
http.createServer(app).listen(3000)
参考 : https://github.com/senchalabs/connect
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)