186 * HttpOutputStream generates: "application/octet-stream".
187 * (Servers' error responses will generally be "text/html".)
188 * Any error response body is printed to the log.
189 */
190 String contentType = conn.getContentType();
191 if (contentType == null ||
192 !conn.getContentType().equals("application/octet-stream"))
193 {
194 if (RMIMasterSocketFactory.proxyLog.isLoggable(Log.BRIEF)) {
195 String message;
196 if (contentType == null) {
197 message = "missing content type in response" +
198 lineSeparator;
199 } else {
200 message = "invalid content type in response: " +
201 contentType + lineSeparator;
202 }
203
204 message += "HttpSendSocket.readNotify: response body: ";
205 try {
206 DataInputStream din = new DataInputStream(in);
207 String line;
208 while ((line = din.readLine()) != null)
209 message += line + lineSeparator;
210 } catch (IOException e) {
211 }
212 RMIMasterSocketFactory.proxyLog.log(Log.BRIEF, message);
213 }
214
215 throw new IOException("HTTP request failed");
216 }
217
218 return in;
219 }
220
221 /**
222 * Get the address to which the socket is connected.
223 */
224 public InetAddress getInetAddress()
225 {
226 try {
|
186 * HttpOutputStream generates: "application/octet-stream".
187 * (Servers' error responses will generally be "text/html".)
188 * Any error response body is printed to the log.
189 */
190 String contentType = conn.getContentType();
191 if (contentType == null ||
192 !conn.getContentType().equals("application/octet-stream"))
193 {
194 if (RMIMasterSocketFactory.proxyLog.isLoggable(Log.BRIEF)) {
195 String message;
196 if (contentType == null) {
197 message = "missing content type in response" +
198 lineSeparator;
199 } else {
200 message = "invalid content type in response: " +
201 contentType + lineSeparator;
202 }
203
204 message += "HttpSendSocket.readNotify: response body: ";
205 try {
206 BufferedReader din = new BufferedReader(new InputStreamReader(in));
207 String line;
208 while ((line = din.readLine()) != null)
209 message += line + lineSeparator;
210 } catch (IOException e) {
211 }
212 RMIMasterSocketFactory.proxyLog.log(Log.BRIEF, message);
213 }
214
215 throw new IOException("HTTP request failed");
216 }
217
218 return in;
219 }
220
221 /**
222 * Get the address to which the socket is connected.
223 */
224 public InetAddress getInetAddress()
225 {
226 try {
|