/** * Template method for preparing the given {@link java.net.HttpURLConnection}. * <p/> * The default implementation prepares the connection for input and output, sets the HTTP method to POST, disables * caching, and sets the {@code Accept-Encoding} header to gzip, if {@linkplain #setAcceptGzipEncoding(boolean) * applicable}. * * @param connection the connection to prepare * @throws IOException in case of I/O errors */ protected void prepareConnection(HttpURLConnection connection) throws IOException { connection.setRequestMethod(HttpTransportConstants.METHOD_POST); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); if (isAcceptGzipEncoding()) { connection.setRequestProperty(HttpTransportConstants.HEADER_ACCEPT_ENCODING, HttpTransportConstants.CONTENT_ENCODING_GZIP); } }
/** * Template method for preparing the given {@link java.net.HttpURLConnection}. * * <p>The default implementation prepares the connection for input and output, sets the HTTP method to POST, disables * caching, and sets the {@code Accept-Encoding} header to gzip, if {@linkplain #setAcceptGzipEncoding(boolean) * applicable}. * * @param connection the connection to prepare * @throws IOException in case of I/O errors */ protected void prepareConnection(HttpURLConnection connection) throws IOException { connection.setRequestMethod(HttpTransportConstants.METHOD_POST); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); if (isAcceptGzipEncoding()) { connection.setRequestProperty(HttpTransportConstants.HEADER_ACCEPT_ENCODING, HttpTransportConstants.CONTENT_ENCODING_GZIP); } connection.setConnectTimeout(Math.toIntExact(this.connectionTimeout.toMillis())); connection.setReadTimeout(Math.toIntExact(this.readTimeout.toMillis())); }
/** * Template method for preparing the given {@link java.net.HttpURLConnection}. * * <p>The default implementation prepares the connection for input and output, sets the HTTP method to POST, disables * caching, and sets the {@code Accept-Encoding} header to gzip, if {@linkplain #setAcceptGzipEncoding(boolean) * applicable}. * * @param connection the connection to prepare * @throws IOException in case of I/O errors */ protected void prepareConnection(HttpURLConnection connection) throws IOException { connection.setRequestMethod(HttpTransportConstants.METHOD_POST); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); if (isAcceptGzipEncoding()) { connection.setRequestProperty(HttpTransportConstants.HEADER_ACCEPT_ENCODING, HttpTransportConstants.CONTENT_ENCODING_GZIP); } connection.setConnectTimeout(Math.toIntExact(this.connectionTimeout.toMillis())); connection.setReadTimeout(Math.toIntExact(this.readTimeout.toMillis())); }
/** * Template method for preparing the given {@link java.net.HttpURLConnection}. * * <p>The default implementation prepares the connection for input and output, sets the HTTP method to POST, disables * caching, and sets the {@code Accept-Encoding} header to gzip, if {@linkplain #setAcceptGzipEncoding(boolean) * applicable}. * * @param connection the connection to prepare * @throws IOException in case of I/O errors */ protected void prepareConnection(HttpURLConnection connection) throws IOException { connection.setRequestMethod(HttpTransportConstants.METHOD_POST); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); if (isAcceptGzipEncoding()) { connection.setRequestProperty(HttpTransportConstants.HEADER_ACCEPT_ENCODING, HttpTransportConstants.CONTENT_ENCODING_GZIP); } connection.setConnectTimeout(Math.toIntExact(this.connectionTimeout.toMillis())); connection.setReadTimeout(Math.toIntExact(this.readTimeout.toMillis())); }