2016年8月 的存档
20168 月19

Nginx:绑定域名代理tomcat

server {
	listen 80;
	listen 443 ssl;
	if ( $scheme = "http" ) {
            rewrite ^(.*) https://$host$1;
	}
	server_name nutzwk.wizzer.cn;
	root "/java/work/nutzwk";	
	ssl_certificate /java/work/1_nutzwk.wizzer.cn_bundle.crt;
	ssl_certificate_key /java/work/2_nutzwk.wizzer.cn.key;
	add_header "X-UA-Compatible" "IE=Edge, chrome=1";
	location / {
		proxy_pass http://127.0.0.1:9091;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
}
20168 月16

备份:HttpClient 4.x POST请求

            List<BasicNameValuePair> formParams = new ArrayList<>();
            formParams.add(new BasicNameValuePair("urlpp", ""));
            formParams.add(new BasicNameValuePair("urlkm", ""));
            formParams.add(new BasicNameValuePair("khjb", "2"));
            HttpEntity httpEntity = new UrlEncodedFormEntity(formParams, "UTF-8");
            HttpPost httpPost = new HttpPost(tesseract.njwztx_baseUrl + "fetchNextList.action");
            httpPost.setEntity(httpEntity);
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            httpPost.setHeader("X-Requested-With", "XMLHttpRequest");
            httpPost.setHeader("Cookie", "rememberPhone=1; phoneNumber=" + tesseract.getNjwztx_dhhm() + "; friendlyReminder=true;JSESSIONID=" + JSESSIONID + ";");
            HttpClient httpclient = HttpClients.createDefault();
            HttpResponse response = httpclient.execute(httpPost);
            HttpEntity entity = response.getEntity();
            Header[] headers = response.getAllHeaders();
            for (int i = 0; i < headers.length; i++) {
                log.debug("header" + i + ":::" + headers[i]);
            }
            if (entity != null) {
                log.debug("getContentEncoding:::" + entity.getContentEncoding());
                log.debug("getContentType:::" + entity.getContentType());
                String str = EntityUtils.toString(response.getEntity());
                log.debug(str);
                Files.write("2.html", str);
            }