NutzCN Logo
问答 nutz 如何接收 表单的原始内容(StringEntity)
发布于 3067天前 作者 TuWei1992 2376 次浏览 复制 上一个帖子 下一个帖子
标签: mvc

代码片段如下, nutz如何才能得到username, email呢? @wendal
``java String param = String.format("callCount=1\n" + "httpSessionId=%s\n" + "scriptSessionId=7965A0E6A09150186F7C719CE9B3A8F4508\n" + "c0-scriptName=CommonService\n" + "c0-methodName=resetPassword\n" + "c0-id=0\n" + "c0-param0=string:%s\n" + "c0-param1=string:%s\n" + "batchId=2", session,username,email`);
try {
StringEntity entity = new StringEntity(param, "UTF-8");
client.post(ctx, url, entity, "application/raw", new AsyncHttpResponseHandler() {
...

```

4 回复
String param = String.format("callCount=1\n" +
                "httpSessionId=%s\n" +
                "scriptSessionId=7965A0E6A09150186F7C719CE9B3A8F4508\n" +
                "c0-scriptName=CommonService\n" +
                "c0-methodName=resetPassword\n" +
                "c0-id=0\n" +
                "c0-param0=string:%s\n" +
                "c0-param1=string:%s\n" +
                "batchId=2", session, username, email);
        try {
            StringEntity entity = new StringEntity(param, "UTF-8");
            client.post(ctx, url, entity, "application/raw", new AsyncHttpResponseHandler() {
			...

声明个InputStream或Reader都可以

	public void inputRaw(InputStream ins) {
		
	}

传json是更好的方案

@wendal 这是老项目,后台之前用的dwr为了兼容api,没办法

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部