本文整理了Java中javax.net.ssl.HttpsURLConnection.setDoInput()
方法的一些代码示例,展示了HttpsURLConnection.setDoInput()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpsURLConnection.setDoInput()
方法的具体详情如下:
包路径:javax.net.ssl.HttpsURLConnection
类名称:HttpsURLConnection
方法名:setDoInput
暂无
代码示例来源:origin: jmdhappy/xxpay-master
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod(requestMethod);
代码示例来源:origin: jmdhappy/xxpay-master
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod(requestMethod);
代码示例来源:origin: wuyouzhuguli/FEBS-Shiro
conn.setRequestProperty(CONTENTTYPE, UTF8);
conn.setDoOutput(true);
conn.setDoInput(true);
代码示例来源:origin: jmdhappy/xxpay-master
con.setSSLSocketFactory(sc.getSocketFactory());
con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
代码示例来源:origin: Javen205/IJPay
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
代码示例来源:origin: Javen205/IJPay
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
代码示例来源:origin: jmdhappy/xxpay-master
con.setSSLSocketFactory(sc.getSocketFactory());
con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
代码示例来源:origin: jmdhappy/xxpay-master
con.setSSLSocketFactory(sc.getSocketFactory());
con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
代码示例来源:origin: youngMen1/JAVA-
public static String getUserInfo(String openId) {
String token = WeiXinUtils.getToken();
if (token != null) {
String urlString = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + token + "&openid="
+ openId;
try {
URL url = new URL(urlString);
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setDoInput(true);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(httpsURLConnection.getInputStream()));
String line = null;
StringBuilder stringBuilder = new StringBuilder();
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line);
}
String kfString = stringBuilder.toString();
return kfString;
} catch (Exception ex) {
ex.printStackTrace();
}
}
return null;
}
}
代码示例来源:origin: youngMen1/JAVA-
public static String getUserList(String next_openid) {
String token = WeiXinUtils.getToken();
if (token != null) {
String urlString = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=" + token;
if (next_openid != null) {
urlString = urlString + "&next_openid=" + next_openid;
}
try {
URL url = new URL(urlString);
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setDoInput(true);
DataInputStream dataInputStream = new DataInputStream(httpsURLConnection.getInputStream());
StringBuffer stringBuffer = new StringBuffer();
int inputByte = dataInputStream.read();
while (inputByte != -1) {
stringBuffer.append((char) inputByte);
inputByte = dataInputStream.read();
}
String kfString = stringBuffer.toString();
return kfString;
} catch (Exception ex) {
ex.printStackTrace();
}
}
return null;
}
代码示例来源:origin: gradle.plugin.com.rosberry.android.gradle/rawf
private void initConnection(HttpsURLConnection connection) {
connection.setConnectTimeout(5000);
connection.setUseCaches(false);
connection.setDoInput(true);
}
代码示例来源:origin: sakaiproject/sakai
private static HttpsURLConnection fetchConnection(String apiURL, int timeout, Proxy proxy)
throws MalformedURLException, IOException, ProtocolException {
HttpsURLConnection connection;
URL hostURL = new URL(apiURL);
if (proxy == null) {
connection = (HttpsURLConnection) hostURL.openConnection();
} else {
connection = (HttpsURLConnection) hostURL.openConnection(proxy);
}
// This actually turns into a POST since we are writing to the
// resource body. ( You can see this in Webscarab or some other HTTP
// interceptor.
connection.setRequestMethod("GET");
connection.setConnectTimeout(timeout);
connection.setReadTimeout(timeout);
connection.setDoOutput(true);
connection.setDoInput(true);
return connection;
}
代码示例来源:origin: com.vmware/vijava
private static HttpsURLConnection getHTTPConnection(String urlStr, String cookieStr) throws IOException
{
HostnameVerifier hv = new HostnameVerifier()
{
public boolean verify(String urlHostName, SSLSession session)
{
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
URL url = new URL(urlStr);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setAllowUserInteraction(true);
conn.setRequestProperty("Cookie", cookieStr);
conn.connect();
return conn;
}
代码示例来源: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: yavijava/yavijava-samples
private static HttpsURLConnection getHTTPConnection(String urlStr, String cookieStr) throws IOException
{
HostnameVerifier hv = new HostnameVerifier()
{
public boolean verify(String urlHostName, SSLSession session)
{
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
URL url = new URL(urlStr);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setAllowUserInteraction(true);
conn.setRequestProperty("Cookie", cookieStr);
conn.connect();
return conn;
}
代码示例来源: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: ihaolin/antares
private void prepareRequest() {
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setConnectTimeout(connectTimeout);
connection.setReadTimeout(readTimeout);
header("Accept-Charset", acceptCharset);
header("Connection", connectType);
if (gzip){
header("Accept-Encoding", "gzip, deflate");
}
if (!Strings.isNullOrEmpty(contentType)){
header("Content-Type", connectType);
}
if (!Strings.isNullOrEmpty(acceptType)){
header("Accept", acceptType);
}
if (!Strings.isNullOrEmpty(body)){
header("Content-Length", String.valueOf(body.length()));
}
}
代码示例来源:origin: me.hao0/common
private void prepareRequest() {
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setConnectTimeout(connectTimeout);
connection.setReadTimeout(readTimeout);
header("Accept-Charset", acceptCharset);
header("Connection", connectType);
if (gzip){
header("Accept-Encoding", "gzip, deflate");
}
if (!Strings.isNullOrEmpty(contentType)){
header("Content-Type", connectType);
}
if (!Strings.isNullOrEmpty(acceptType)){
header("Accept", acceptType);
}
if (!Strings.isNullOrEmpty(body)){
header("Content-Length", String.valueOf(body.length()));
}
}
代码示例来源:origin: ihaolin/common
private void prepareRequest() {
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setConnectTimeout(connectTimeout);
connection.setReadTimeout(readTimeout);
header("Accept-Charset", acceptCharset);
header("Connection", connectType);
if (gzip){
header("Accept-Encoding", "gzip, deflate");
}
if (!Strings.isNullOrEmpty(contentType)){
header("Content-Type", connectType);
}
if (!Strings.isNullOrEmpty(acceptType)){
header("Accept", acceptType);
}
if (!Strings.isNullOrEmpty(body)){
header("Content-Length", String.valueOf(body.length()));
}
}
内容来源于网络,如有侵权,请联系作者删除!