Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/src/org/openconcerto/utils/net/HTTPClient.java |
---|
116,7 → 116,7 |
return this.getToken() != null; |
} |
protected final String getToken() { |
public final String getToken() { |
return this.token; |
} |
144,8 → 144,9 |
con.setRequestProperty("Accept-Encoding", "gzip"); |
if (this.getSocketFactory() != null) |
con.setSSLSocketFactory(this.getSocketFactory()); |
if (getToken() != null) |
if (getToken() != null) { |
con.setRequestProperty("Authorization", "Bearer " + Base64.getEncoder().encodeToString(getToken().getBytes(StandardCharsets.UTF_8))); |
} |
return con; |
} |
153,12 → 154,13 |
return "gzip".equals(con.getContentEncoding()) ? new GZIPInputStream(con.getInputStream()) : con.getInputStream(); |
} |
public final HttpsURLConnection send(final HttpsURLConnection con, final String params) throws IOException { |
return this.send(con, params, true); |
public final HttpsURLConnection send(final HttpsURLConnection con, final String formUrlEncodedParams) throws IOException { |
return this.send(con, formUrlEncodedParams, true); |
} |
public final HttpsURLConnection send(final HttpsURLConnection con, final String params, final boolean allowGzip) throws IOException { |
return this.send(con, params.getBytes(StandardCharsets.UTF_8), allowGzip); |
public final HttpsURLConnection send(final HttpsURLConnection con, final String formUrlEncodedParams, final boolean allowGzip) throws IOException { |
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
return this.send(con, formUrlEncodedParams.getBytes(StandardCharsets.UTF_8), allowGzip); |
} |
public final HttpsURLConnection send(final HttpsURLConnection con, final byte[] toSend, final boolean allowGzip) throws IOException { |