本文整理了Java中javax.net.ssl.HttpsURLConnection.setUseCaches()
方法的一些代码示例,展示了HttpsURLConnection.setUseCaches()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpsURLConnection.setUseCaches()
方法的具体详情如下:
包路径:javax.net.ssl.HttpsURLConnection
类名称:HttpsURLConnection
方法名:setUseCaches
暂无
代码示例来源:origin: jmdhappy/xxpay-master
conn.setUseCaches(false);
conn.setRequestMethod(requestMethod);
if (null != outputStr) {
代码示例来源:origin: jmdhappy/xxpay-master
conn.setUseCaches(false);
conn.setRequestMethod(requestMethod);
if (null != outputStr) {
代码示例来源:origin: jmdhappy/xxpay-master
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setConnectTimeout(30 * 1000);
con.setReadTimeout(60 * 1000);
代码示例来源:origin: jmdhappy/xxpay-master
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setConnectTimeout(10 * 1000);
con.setReadTimeout(5 * 1000);
代码示例来源:origin: jmdhappy/xxpay-master
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setConnectTimeout(10 * 1000);
con.setReadTimeout(5 * 1000);
代码示例来源:origin: ihaolin/antares
/**
* 设置UseCaches
* @param useCache use cache or not
* @return this
*/
public Https useCache(boolean useCache){
connection.setUseCaches(useCache);
return this;
}
代码示例来源:origin: me.hao0/common
/**
* 设置UseCaches
* @param useCache use cache or not
* @return this
*/
public Https useCache(boolean useCache){
connection.setUseCaches(useCache);
return this;
}
代码示例来源:origin: ihaolin/common
/**
* 设置UseCaches
* @param useCache use cache or not
* @return this
*/
public Https useCache(boolean useCache){
connection.setUseCaches(useCache);
return this;
}
代码示例来源:origin: gradle.plugin.com.rosberry.android.gradle/rawf
private void initConnection(HttpsURLConnection connection) {
connection.setConnectTimeout(5000);
connection.setUseCaches(false);
connection.setDoInput(true);
}
代码示例来源:origin: ATLauncher/ATLauncher
public static String sendGetAPICall(String path) throws IOException {
StringBuilder response = null;
URL url = new URL(Constants.API_BASE_URL + path);
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("User-Agent", App.settings.getUserAgent());
connection.setRequestProperty("Content-Type", "application/json; charset=utf-8");
connection.setRequestProperty("Cache-Control", "no-store,max-age=0,no-cache");
connection.setRequestProperty("Expires", "0");
connection.setRequestProperty("Pragma", "no-cache");
connection.setUseCaches(false);
connection.setDoOutput(true);
// Read the result
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
response = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
response.append(line);
response.append('\r');
}
reader.close();
return response.toString();
}
代码示例来源:origin: net.oschina.suyeer/basic
private static JSONObject sendSSLRequest(String url, String params, String methodType) {
JSONObject retJson = null;
try {
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) (new URL(url).openConnection());
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setDoInput(true);
httpsURLConnection.setUseCaches(false);
httpsURLConnection.setRequestMethod(methodType);
httpsURLConnection.setHostnameVerifier(BasicUtil.createHostnameVerifier(true));
httpsURLConnection.setSSLSocketFactory(BasicUtil.createSSLSocketFactory("SSL", "SunJSSE"));
if (methodType.equals(BConstUtil.GET)) {
httpsURLConnection.connect();
}
if (StringUtils.isNotBlank(params)) {
OutputStream outputStream = httpsURLConnection.getOutputStream();
outputStream.write(params.getBytes(BConstUtil.DEFAULT_ENCODE));
outputStream.close();
}
String retStr = IOUtils.toString(httpsURLConnection.getInputStream(), BConstUtil.DEFAULT_ENCODE);
retJson = JSONObject.parseObject(retStr);
httpsURLConnection.disconnect();
} catch (Exception e) {
logger.error("发送请求异常: {}", e.getMessage());
} finally {
return retJson;
}
}
代码示例来源:origin: microg/AppleWifiNlpBackend
private static void prepareConnection(HttpsURLConnection connection,
int length) throws ProtocolException {
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setRequestProperty(HTTP_FIELD_CONTENT_TYPE, CONTENT_TYPE_URLENCODED);
connection.setRequestProperty(HTTP_FIELD_CONTENT_LENGTH, String.valueOf(length));
}
代码示例来源:origin: io.takari/jdkget
public static JdkReleases readFromGithub() throws IOException {
HttpsURLConnection conn = (HttpsURLConnection) new URL(REMOTE_XML).openConnection();
conn.setAllowUserInteraction(false);
conn.setDoInput(true);
conn.setDoOutput(false);
conn.setUseCaches(true);
conn.setRequestMethod("GET");
conn.setConnectTimeout(TIMEOUT_VALUE);
conn.setReadTimeout(TIMEOUT_VALUE);
conn.connect();
return read(conn.getInputStream());
}
代码示例来源:origin: iyzico/iyzipay-java
private String send(String url, HttpMethod httpMethod, InputStream content, Map<String, String> headers) {
URLConnection raw;
HttpsURLConnection conn = null;
try {
raw = new URL(url).openConnection();
conn = HttpsURLConnection.class.cast(raw);
conn.setSSLSocketFactory(socketFactory);
conn.setRequestMethod(httpMethod.name());
conn.setConnectTimeout(TIMEOUT);
conn.setReadTimeout(TIMEOUT);
conn.setUseCaches(false);
conn.setInstanceFollowRedirects(false);
prepareHeaders(headers, conn);
if (content != null) {
prepareRequestBody(httpMethod, content, conn);
}
return new String(body(conn), Charset.forName("UTF-8"));
} catch (Exception e) {
throw new HttpClientException(e.getMessage(), e);
} finally {
if (conn != null) {
conn.disconnect();
}
}
}
代码示例来源:origin: poreid/poreid
private void httpPostResetScriptCounterResponse(ResetScriptCounterResponse rscr) throws POReIDException{
try {
HttpsURLConnection con = (HttpsURLConnection) new URL(OTP_SCRIPT_COUNTER_RESPONSE_URL).openConnection(this.proxy);
con.setSSLSocketFactory(sslSocketFactory);
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "text/plain");
con.setRequestProperty("charset", "utf-8");
con.setRequestProperty("Content-Length", String.valueOf(rscr.toString().getBytes(StandardCharsets.UTF_8).length));
con.setRequestProperty("Cookie", cookie);
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
try (DataOutputStream out = new DataOutputStream(con.getOutputStream())) {
out.writeBytes(rscr.toString());
out.flush();
}
if (HttpsURLConnection.HTTP_OK == con.getResponseCode() || errorExpected) {
otpDialogCtl.updateState();
return;
}
warnCitizen(new POReIDException("Não foi possivel continuar o processo de alteração do pin OTP"));
} catch (IOException ex) {
warnCitizen(new POReIDException("Não foi possivel continuar o processo de alteração do pin OTP", ex));
}
}
代码示例来源:origin: poreid/poreid
private void httpPostChangeUnlockPINResponse(PinChangeUnlockResponse pcur) throws POReIDException {
try {
HttpsURLConnection con = (HttpsURLConnection) new URL(OTP_SEND_CHANGE_PIN_RESPONSE_URL).openConnection(this.proxy);
con.setSSLSocketFactory(sslSocketFactory);
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "text/plain");
con.setRequestProperty("charset", "utf-8");
con.setRequestProperty("Content-Length", String.valueOf(pcur.toString().getBytes(StandardCharsets.UTF_8).length));
con.setRequestProperty("Cookie", cookie);
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
try (DataOutputStream out = new DataOutputStream(con.getOutputStream())) {
out.writeBytes(pcur.toString());
out.flush();
}
if (HttpsURLConnection.HTTP_OK == con.getResponseCode()) {
JSONObject js = new JSONObject(new JSONTokener(con.getInputStream()));
if (js.has("sendChangePINResponse")){
return;
}
}
warnCitizen(new POReIDException("Não foi possivel continuar o processo de alteração do pin OTP"));
} catch (IOException ex) {
warnCitizen(new POReIDException("Não foi possivel continuar o processo de alteração do pin OTP", ex));
}
}
代码示例来源:origin: andforce/iBeebo
uRLConnection.setDoOutput(true);
uRLConnection.setRequestMethod("POST");
uRLConnection.setUseCaches(false);
uRLConnection.setConnectTimeout(CONNECT_TIMEOUT);
uRLConnection.setReadTimeout(READ_TIMEOUT);
代码示例来源:origin: poreid/poreid
con.setRequestProperty("charset", "utf-8");
con.setRequestProperty("Content-Length", String.valueOf(post.getBytes(StandardCharsets.UTF_8).length));
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
代码示例来源:origin: poreid/poreid
con.setRequestProperty("Content-Length", String.valueOf(otp.toString().getBytes(StandardCharsets.UTF_8).length));
con.setRequestProperty("Cookie", cookie);
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
代码示例来源:origin: poreid/poreid
con.setRequestProperty("Content-Length", "" + String.valueOf(ppu.toString().getBytes(StandardCharsets.UTF_8).length));
con.setRequestProperty("Cookie", cookie);
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
内容来源于网络,如有侵权,请联系作者删除!