Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpGet.releaseConnection()


            HttpEntity entity1 = response1.getEntity();
            // do something useful with the response body
            // and ensure it is fully consumed
            EntityUtils.consume(entity1);
        } finally {
            httpGet.releaseConnection();
        }

        HttpPost httpPost = new HttpPost("http://targethost/login");
        List <NameValuePair> nvps = new ArrayList <NameValuePair>();
        nvps.add(new BasicNameValuePair("username", "vip"));
View Full Code Here


        {
            IOUtil.close( reader );

            if ( httpMethod != null )
            {
                httpMethod.releaseConnection();
            }
            if ( httpClient != null )
            {
                httpClient.getConnectionManager().shutdown();
            }
View Full Code Here

        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            throw e;
        } finally {
            if (get != null) {
                get.releaseConnection();
            }
        }

    }
View Full Code Here

            String output;
            while ((output = br.readLine()) != null) {
                sb.append(output);
            }

            getRequest.releaseConnection();

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

            return response.getEntity().getContent();
        } catch (Exception e) {
            throw new IOException(e.getMessage());
        } finally {
            if (get != null && !ok) {
                get.releaseConnection();
            }
            if (Administrator.INSTANCE != null) {
                Administrator.PROGRESS.setValue(0);
                Administrator.PROGRESS.setString("");
            }
View Full Code Here

        HttpGet get = new HttpGet(url);
        HttpResponse response = getOrDelete(get, getAuthAccess(), false);
        assertEquals(SC_OK, response.getStatusLine().getStatusCode());
        // xml from mimetype mapping
        CheckCDHeader(response, "attachment", TestRESTAPI.DS5ID + ".xml");
        get.releaseConnection();

        // filename from id, id contains extension (no label present)
        url =
            getURI("/objects/demo:REST/datastreams/DS6.xml/content?download=true");
        get = new HttpGet(url);
View Full Code Here

            getURI("/objects/demo:REST/datastreams/DS6.xml/content?download=true");
        get = new HttpGet(url);
        response = getOrDelete(get, getAuthAccess(), false);
        assertEquals(SC_OK, response.getStatusLine().getStatusCode());
        CheckCDHeader(response, "attachment", TestRESTAPI.DS6ID); // no extension, id contains it
        get.releaseConnection();
    }

    @Test
    public void testUpload() throws Exception {
        String uploadUrl = "/upload";
View Full Code Here

                            + URLEncoder.encode(p, "UTF-8"));
            get = new HttpGet(url);
            response = getOrDelete(get, true, false);
            status = response.getStatusLine().getStatusCode();
            byte [] responseBytes = readBytes(response);
            get.releaseConnection();
            assertEquals(SC_OK, status);
            checkRelationship(responseBytes, s, p, o, true);

            // purge it
            url =
View Full Code Here

            status = response.getStatusLine().getStatusCode();
            responseString = readString(response);
            assertEquals(SC_OK, status);
            assertEquals("Purge relationship", "false", responseString);
        } finally {
            if (get != null) get.releaseConnection();
            if (delete != null) delete.releaseConnection();
        }
    }

    @Test
View Full Code Here

        int status = response.getStatusLine().getStatusCode();
        String cLen = (response.containsHeader(HttpHeaders.CONTENT_LENGTH)) ?
            response.getFirstHeader(HttpHeaders.CONTENT_LENGTH).getValue() :
            null;
        EntityUtils.consumeQuietly(response.getEntity());
        get.releaseConnection();
        assertEquals(SC_OK, status);
        assertEquals("19498", cLen);
    }

    private MultipartEntity _doUploadPost() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.