Changeset 778
- Timestamp:
- 06/28/07 17:07:11 (2 years ago)
- Files:
-
- org.jalcedo.client/trunk/org.jalcedo.client.rest/.classpath (modified) (1 diff)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/META-INF/MANIFEST.MF (modified) (1 diff)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/build.properties (modified) (1 diff)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/json-src (deleted)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/lib (deleted)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/lib-http (deleted)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/lib-json (deleted)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/Connection.java (modified) (1 diff)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/HttpClientConnection.java (modified) (8 diffs)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/Response.java (modified) (1 diff)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/convert (deleted)
- org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/internal (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
org.jalcedo.client/trunk/org.jalcedo.client.rest/.classpath
r656 r778 2 2 <classpath> 3 3 <classpathentry kind="src" path="src"/> 4 <classpathentry kind="src" path="json-src"/>5 <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.0.4.jar"/>6 <classpathentry exported="true" kind="lib" path="lib-http/commons-httpclient-3.0.1.jar"/>7 <classpathentry exported="true" kind="lib" path="lib-http/commons-codec-1.3.jar"/>8 <classpathentry exported="true" kind="lib" path="lib-json/ezmorph-1.0.1.jar"/>9 <classpathentry exported="true" kind="lib" path="lib-json/commons-lang-2.2.jar"/>10 <classpathentry exported="true" kind="lib" path="lib-json/commons-beanutils-1.7.0.jar"/>11 4 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 12 5 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> org.jalcedo.client/trunk/org.jalcedo.client.rest/META-INF/MANIFEST.MF
r718 r778 6 6 Bundle-Vendor: Jalcedo.org 7 7 Bundle-Localization: plugin 8 Bundle-ClassPath: lib/commons-logging-1.0.4.jar, 9 lib-http/commons-httpclient-3.0.1.jar, 10 lib-http/commons-codec-1.3.jar, 11 lib-json/ezmorph-1.0.1.jar, 12 lib-json/commons-lang-2.2.jar, 13 lib-json/commons-beanutils-1.7.0.jar, 14 . 15 Export-Package: org.jalcedo.client.rest.convert, 16 org.jalcedo.client.rest.connect 8 Bundle-ClassPath: . 9 Export-Package: org.jalcedo.client.rest.connect 10 Require-Bundle: org.apache.commons.httpclient, 11 org.apache.commons.logging org.jalcedo.client/trunk/org.jalcedo.client.rest/build.properties
r718 r778 3 3 output.. = bin/ 4 4 bin.includes = META-INF/,\ 5 .,\ 6 lib/commons-logging-1.0.4.jar,\ 7 lib-http/commons-httpclient-3.0.1.jar,\ 8 lib-http/commons-codec-1.3.jar,\ 9 lib-json/ezmorph-1.0.1.jar,\ 10 lib-json/commons-lang-2.2.jar,\ 11 lib-json/commons-beanutils-1.7.0.jar 5 . 12 6 src.includes = .classpath,\ 13 7 .project,\ org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/Connection.java
r729 r778 39 39 * 40 40 * @param url 41 * @param queryParams 41 42 * @param body 42 * @param queryParams43 43 * @return 44 44 */ 45 Response put(String url, RequestEntity body, Map<String, String> queryParams) throws ConnectionException;45 Response put(String url, Map<String, String> queryParams, RequestEntity body) throws ConnectionException; 46 46 47 47 /** 48 48 * 49 49 * @param url 50 * @param queryParams 50 51 * @param body 51 * @param queryParams52 52 * @return 53 53 */ 54 Response post(String url, RequestEntity body, Map<String, String> queryParams) throws ConnectionException;54 Response post(String url, Map<String, String> queryParams, RequestEntity body) throws ConnectionException; 55 55 } org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/HttpClientConnection.java
r729 r778 49 49 protected final Log logger = LogFactory.getLog(this.getClass()); 50 50 51 private HttpClient httpClient; 52 53 public HttpClientConnection() { 54 55 } 56 57 public HttpClientConnection(HttpClient httpClient) { 58 this.httpClient = httpClient; 59 } 60 51 61 private boolean followRedirects = true; 52 62 … … 120 130 URI redirectUri = this.extractRedirectURI(method); 121 131 method.releaseConnection(); 122 return this.get(redirectUri.toString(), new HashMap<String, String>()); 132 return this.get(redirectUri.toString(), 133 new HashMap<String, String>()); 123 134 } 124 135 return new HttpResponse(method); 125 136 } 126 137 127 138 /** 128 139 * … … 150 161 /** 151 162 * this http method needs redirect. 163 * 152 164 * @param method 153 165 * @return … … 167 179 /* 168 180 * (non-Javadoc) 169 * 170 * @see org.jalcedo.client.rest.connect.Connection#post(java.lang.String, 171 * org.jalcedo.client.rest.connect.RequestEntity, java.util.Map) 172 */ 173 public Response post(String url, RequestEntity body, 174 Map<String, String> queryParams) throws ConnectionException { 181 * @see org.jalcedo.client.rest.connect.Connection#post(java.lang.String, java.util.Map, org.jalcedo.client.rest.connect.RequestEntity) 182 */ 183 public Response post(String url, Map<String, String> queryParams, 184 RequestEntity body) throws ConnectionException { 175 185 try { 176 186 PostMethod method = new PostMethod(url); … … 186 196 * 187 197 * @see org.jalcedo.client.rest.connect.Connection#put(java.lang.String, 188 * org.jalcedo.client.rest.connect.RequestEntity, java.util.Map)189 */ 190 public Response put(String url, RequestEntity body,191 Map<String, String> queryParams) throws ConnectionException {198 * java.util.Map, org.jalcedo.client.rest.connect.RequestEntity) 199 */ 200 public Response put(String url, Map<String, String> queryParams, 201 RequestEntity body) throws ConnectionException { 192 202 try { 193 203 PutMethod method = new PutMethod(url); … … 216 226 217 227 public HttpClient getHttpClient() { 218 return CLIENT; 228 if (this.httpClient == null) { 229 return CLIENT; 230 } 231 return this.httpClient; 219 232 } 220 233 … … 314 327 } 315 328 } 316 329 317 330 private class HttpResponse implements Response { 318 331 319 332 final private HttpMethod method; 320 333 321 334 public HttpResponse(HttpMethod method) { 322 335 this.method = method; 323 336 } 324 337 325 public String get ContentType() {338 public String getMediaType() { 326 339 return this.method.getResponseHeader("content-type").getValue(); 327 340 } … … 334 347 return this.method.getResponseBodyAsString(); 335 348 } 336 349 337 350 } 338 351 } org.jalcedo.client/trunk/org.jalcedo.client.rest/src/org/jalcedo/client/rest/connect/Response.java
r729 r778 34 34 * @return 35 35 */ 36 String get ContentType();36 String getMediaType(); 37 37 }
