集册 Java实例教程 通过SSL连接创建删除

通过SSL连接创建删除

欢马劈雪     最近更新时间:2020-01-02 10:19:05

424
通过SSL连接创建删除
/** 
来 自 
nowjava.com - 时  代  Java
**/


import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.OutputStreamWriter;

import java.net.HttpURLConnection;

import java.net.MalformedURLException;

import java.net.URL;

import javax.net.ssl.HttpsURLConnection;


public class Main{

    static public HttpsURLConnection createDeleteConnection(String urlStr) {

        CheckerUtils.notNullOrEmpty(urlStr, "url");


        try {

            URL url = new URL(urlStr);

            HttpsURLConnection con = (HttpsURLConnection) url

                    .openConnection();

            con.setRequestMethod("DELETE");/** NowJava.com 提供 **/

            return con;

        } catch (MalformedURLException e) {

            throw 
展开阅读全文