Changeset 729
- Timestamp:
- 06/20/07 15:51:52 (2 years ago)
- Files:
-
- org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/Connection.java (modified) (4 diffs)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/HttpClientConnection.java (modified) (9 diffs)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/Response.java (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/Connection.java
r656 r729 26 26 * @return 27 27 */ 28 Stringget(String url, Map<String, String> queryParams) throws ConnectionException;28 Response get(String url, Map<String, String> queryParams) throws ConnectionException; 29 29 30 30 /** … … 34 34 * @return 35 35 */ 36 Stringdelete(String url, Map<String, String> queryParams) throws ConnectionException;36 Response delete(String url, Map<String, String> queryParams) throws ConnectionException; 37 37 38 38 /** … … 43 43 * @return 44 44 */ 45 Stringput(String url, RequestEntity body, Map<String, String> queryParams) throws ConnectionException;45 Response put(String url, RequestEntity body, Map<String, String> queryParams) throws ConnectionException; 46 46 47 47 /** … … 52 52 * @return 53 53 */ 54 Stringpost(String url, RequestEntity body, Map<String, String> queryParams) throws ConnectionException;54 Response post(String url, RequestEntity body, Map<String, String> queryParams) throws ConnectionException; 55 55 } org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/HttpClientConnection.java
r717 r729 12 12 13 13 import java.io.IOException; 14 import java.io.InputStream; 14 15 import java.io.OutputStream; 15 16 import java.util.ArrayList; … … 72 73 * java.util.Map) 73 74 */ 74 public Stringdelete(String url, Map<String, String> queryParams)75 public Response delete(String url, Map<String, String> queryParams) 75 76 throws ConnectionException { 76 77 try { … … 89 90 * java.util.Map) 90 91 */ 91 public Stringget(String url, Map<String, String> queryParams)92 public Response get(String url, Map<String, String> queryParams) 92 93 throws ConnectionException { 93 94 try { … … 111 112 * @throws IOException 112 113 */ 113 private StringdoMethod(Map<String, String> queryParams, HttpMethod method)114 private Response doMethod(Map<String, String> queryParams, HttpMethod method) 114 115 throws HttpException, IOException { 115 116 this.setQueryString(method, queryParams); … … 121 122 return this.get(redirectUri.toString(), new HashMap<String, String>()); 122 123 } 123 return method.getResponseBodyAsString();124 return new HttpResponse(method); 124 125 } 125 126 … … 170 171 * org.jalcedo.client.rest.connect.RequestEntity, java.util.Map) 171 172 */ 172 public Stringpost(String url, RequestEntity body,173 public Response post(String url, RequestEntity body, 173 174 Map<String, String> queryParams) throws ConnectionException { 174 175 try { … … 187 188 * org.jalcedo.client.rest.connect.RequestEntity, java.util.Map) 188 189 */ 189 public Stringput(String url, RequestEntity body,190 public Response put(String url, RequestEntity body, 190 191 Map<String, String> queryParams) throws ConnectionException { 191 192 try { … … 207 208 * @throws IOException 208 209 */ 209 private StringdoEntityEnclosingMethod(RequestEntity body,210 private Response doEntityEnclosingMethod(RequestEntity body, 210 211 Map<String, String> queryParams, EntityEnclosingMethod method) 211 212 throws HttpException, IOException { … … 313 314 } 314 315 } 316 317 private class HttpResponse implements Response { 318 319 final private HttpMethod method; 320 321 public HttpResponse(HttpMethod method) { 322 this.method = method; 323 } 324 325 public String getContentType() { 326 return this.method.getResponseHeader("content-type").getValue(); 327 } 328 329 public InputStream getStream() throws IOException { 330 return this.method.getResponseBodyAsStream(); 331 } 332 333 public String getText() throws IOException { 334 return this.method.getResponseBodyAsString(); 335 } 336 337 } 315 338 }
