source: josm/trunk/src/oauth/signpost/basic/HttpURLConnectionResponseAdapter.java@ 7185

Last change on this file since 7185 was 6849, checked in by stoecker, 10 years ago

see #9710 - update oauth library code

File size: 898 bytes
Line 
1package oauth.signpost.basic;
2
3import java.io.IOException;
4import java.io.InputStream;
5import java.net.HttpURLConnection;
6
7import oauth.signpost.http.HttpResponse;
8
9public class HttpURLConnectionResponseAdapter implements HttpResponse {
10
11 private HttpURLConnection connection;
12
13 public HttpURLConnectionResponseAdapter(HttpURLConnection connection) {
14 this.connection = connection;
15 }
16
17 public InputStream getContent() throws IOException {
18 try {
19 return connection.getInputStream();
20 } catch (IOException e) {
21 return connection.getErrorStream();
22 }
23 }
24
25 public int getStatusCode() throws IOException {
26 return connection.getResponseCode();
27 }
28
29 public String getReasonPhrase() throws Exception {
30 return connection.getResponseMessage();
31 }
32
33 public Object unwrap() {
34 return connection;
35 }
36}
Note: See TracBrowser for help on using the repository browser.