import http.Http;
import java.util.*;
import java.io.*;
public class NewClass {
public static void main(String[] args) throws Exception {
String charset = "gbk";
Http http1 = new Http("http://xxxxxxx/login.php"?? charset);
/**
* ???
*/
http1.addPostData("username"?? "username????");
http1.addPostData("password"?? "password????");
http1.execute();
/**
* ??????????cookie??session?????ù?????????????????????cookie???????????????????????????????????
*/
Http http2 = new Http("http://xxxxxxx/xxxxxx.php"?? charset);
http2.addPostData("testfield"?? "testfieldvalue????1");
http2.addPostData("mycheckbox[]"?? "testfieldvalue????2");
http2.addPostData("mycheckbox[]"?? "testfieldvalue????3");
http2.addUploadFile("fieldName"?? "F:\NetBeansProjects\Wrapper\src\upfile.txt"
?? "rename.txt");
http2.execute();
/**
* ??????????????
*/
//???
System.out.println("-------response header-------");
Map<String?? List<String>> headersMap = http2.getHeaders();
for (Map.Entry<String?? List<String>> entry : headersMap.entrySet()) {
String string = entry.getKey();
List<String> list = entry.getValue();
System.out.println(string + ": " + list.get(0));
}
//????
//?????
if (http2.getHeader("Content-Encoding") != null) {
System.out.println("-------response content ??????????" + http2.getHeader("Content-Encoding"));
//???http2.getInputStream()??????????????????????????????????浽???????
return;
}
//???????
System.out.println("-------response content-------");
InputStreamReader isr = new InputStreamReader(http2.getInputStream()?? charset);
StringBuilder stringBuilder = new StringBuilder();
int len;
char[] cbuf = new char[1024];
while ((len = isr.read(cbuf)) >= 0) {
if (len == 1024) {
stringBuilder.append(cbuf);
} else {
stringBuilder.append(cbuf?? 0?? len);
}
}
System.out.println(stringBuilder.toString());
}
}

?????????
?????????????????????????????getInputStream()????????????????????
????????????Щ????????ε????????????body??????????????????????????????????????????????????н?????????????gzip??????????????????????????????????????getHeader("Content-Encoding")????ж?????????
??????????java?ж?????????в???????????????????????