Lines Matching refs:connection

172         HttpURLConnection connection = (HttpURLConnection)new URL(publishEndpoint).openConnection();
173 connection.setRequestMethod("GET");
174 connection.setRequestProperty(COOKIE, getAdminSessionTokenCookie());
175 connection.connect();
176 return readInputStream(connection.getInputStream());
181 HttpURLConnection connection = (HttpURLConnection)getPublishAddInstanceUri().openConnection();
182 connection.setDoOutput(true);
183 connection.setRequestMethod("POST");
184 connection.setRequestProperty(SharedSTSConstants.CONTENT_TYPE, SharedSTSConstants.APPLICATION_JSON);
185 connection.setRequestProperty(COOKIE, getAdminSessionTokenCookie());
186 OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
190 if (connection.getResponseCode() == HttpURLConnection.HTTP_CREATED) {
191 return getSuccessMessage(connection);
194 getErrorMessage(connection));
199 HttpURLConnection connection = (HttpURLConnection)new URL(deletionUrl).openConnection();
200 connection.setDoOutput(true);
201 connection.setRequestMethod("DELETE");
202 connection.setRequestProperty(SharedSTSConstants.CONTENT_TYPE, SharedSTSConstants.APPLICATION_JSON);
203 connection.setRequestProperty(COOKIE, getAdminSessionTokenCookie());
204 connection.connect();
206 if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
207 return getSuccessMessage(connection);
209 throw new IOException("Failed to perform DELETE on url: " + deletionUrl + ": " + getErrorMessage(connection));
214 HttpURLConnection connection = (HttpURLConnection)new URL(updateUrl).openConnection();
215 connection.setDoOutput(true);
216 connection.setRequestMethod("PUT");
217 connection.setRequestProperty(SharedSTSConstants.CONTENT_TYPE, SharedSTSConstants.APPLICATION_JSON);
223 connection.setRequestProperty(SharedSTSConstants.CREST_VERSION_HEADER_KEY, REST_STS_PUBLISH_SERVICE_VERSION);
224 connection.setRequestProperty(COOKIE, getAdminSessionTokenCookie());
225 OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
229 if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
230 return getSuccessMessage(connection);
232 throw new IOException("Failed to perform PUT on url: " + updateUrl + ": " + getErrorMessage(connection) +
233 ". The connection request method: " + connection.getRequestMethod());
237 private String getSuccessMessage(HttpURLConnection connection) throws IOException {
238 return readInputStream(connection.getInputStream());
241 private String getErrorMessage(HttpURLConnection connection) throws IOException {
242 if (connection.getErrorStream() != null) {
243 return readInputStream(connection.getErrorStream());
245 return readInputStream(connection.getInputStream());