Lines Matching defs:connection

139         HttpURLConnection connection = (HttpURLConnection)new URL(publishEndpoint).openConnection();
140 connection.setRequestMethod("GET");
141 connection.setRequestProperty(COOKIE, getAdminSessionTokenCookie());
142 connection.connect();
143 return readInputStream(connection.getInputStream());
148 HttpURLConnection connection = (HttpURLConnection)getPublishAddInstanceUri().openConnection();
149 connection.setDoOutput(true);
150 connection.setRequestMethod("POST");
151 connection.setRequestProperty(SharedSTSConstants.CONTENT_TYPE, SharedSTSConstants.APPLICATION_JSON);
152 connection.setRequestProperty(COOKIE, getAdminSessionTokenCookie());
153 OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
157 if (connection.getResponseCode() == HttpURLConnection.HTTP_CREATED) {
158 return getSuccessMessage(connection);
160 throw new IOException(getErrorMessage(connection));
165 HttpURLConnection connection = (HttpURLConnection)new URL(deletionUrl).openConnection();
166 connection.setDoOutput(true);
167 connection.setRequestMethod("DELETE");
168 connection.setRequestProperty(SharedSTSConstants.CONTENT_TYPE, SharedSTSConstants.APPLICATION_JSON);
169 connection.setRequestProperty(COOKIE, getAdminSessionTokenCookie());
170 connection.connect();
172 if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
173 return getSuccessMessage(connection);
175 throw new IOException(getErrorMessage(connection));
179 private String getSuccessMessage(HttpURLConnection connection) throws IOException {
180 return readInputStream(connection.getInputStream());
183 private String getErrorMessage(HttpURLConnection connection) throws IOException {
184 if (connection.getErrorStream() != null) {
185 return readInputStream(connection.getErrorStream());
187 return readInputStream(connection.getInputStream());