Example usage for javax.net.ssl HttpsURLConnection getRequestProperty

List of usage examples for javax.net.ssl HttpsURLConnection getRequestProperty

Introduction

In this page you can find the example usage for javax.net.ssl HttpsURLConnection getRequestProperty.

Prototype

public String getRequestProperty(String key) 

Source Link

Document

Returns the value of the named general request property for this connection.

Usage

From source file:tetujin.nikeapi.core.JNikeLowLevelAPI.java

/**
 * /*from   w ww.j  av  a  2 s. c  o m*/
 * @param con ?HttpsURLConnection 
 * @return con option??HttpsURLConnection
 */
protected HttpsURLConnection setHttpHeader(HttpsURLConnection con) {
    try {
        con.setRequestMethod(this.method);
        con.setDoOutput(true);
        con.setInstanceFollowRedirects(false);
        con.setRequestProperty("Accept-Language", this.lang);
        con.setRequestProperty("Accept", this.accept);
        con.setRequestProperty("appid", this.appid);
        System.out.println("Accept: " + con.getRequestProperty("Accept"));
        System.out.println("appid: " + con.getRequestProperty("appid"));
        return con;
    } catch (ProtocolException e) {
        e.printStackTrace();
        return con;
    }
}