citrix API 调用案例

Citrix API 成功调用案例, 如有疑问请联系 QQ 232600624

package cn.ccvnc.http.service;

import io.lions.http.client.ResultEntity;
import io.lions.http.client.Transfer;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

/**
 *
 * @author ccvnc
 *
 */
public class Citrix {

	static BasicCookieStore cookieStore = null;
	static CloseableHttpClient httpClient = null;
	static Map<String, String> cookieMap = new HashMap<String, String>();
	static HttpClientContext context = null;
	private String host;
	private int port = 80;

	public Map<String, String> basicHeaders() {
		String h = host;
		if (port > -1 && port != 80) {
			h += ":" + port;
		}
		Map<String, String> headers = new HashMap<String, String>();
		headers.put("Host", host);
		headers.put("Accept", "application/xml, text/xml, */*; q=0.01");
		headers.put("Accept-Language", "en-us,en;q=0.7,fr;q=0.3");
		headers.put("Accept-Encoding", "gzip, deflate");
		headers.put("X-Requested-With", "XMLHttpRequest");
		headers.put("X-Citrix-IsUsingHTTPS", "No");
		if (cookieMap != null) {
			headers.put("Csrf-Token", cookieMap.get("CsrfToken"));
		}
		headers.put("Referer", "http://" + h + "/Citrix/StoreWeb/");
		headers.put("Connection", "keep-alive");
		headers.put("Pragma", "no-cache");
		headers.put("Cache-Control", "no-cache");
		return headers;
	}

	public void context() {
		context = HttpClientContext.create();
	}

	// 1. /Home/Configuration
	public ResultEntity homeConfiguration() throws MalformedURLException {
		URL url = Transfer.g
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值