Examples of HttpUriRequest


Examples of org.apache.http.client.methods.HttpUriRequest

                        + " Total=" + (res.getHeadersSize() + res.getBodySize()));
            }

            // If we redirected automatically, the URL may have changed
            if (getAutoRedirects()){
                HttpUriRequest req = (HttpUriRequest) localContext.getAttribute(ExecutionContext.HTTP_REQUEST);
                HttpHost target = (HttpHost) localContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
                URI redirectURI = req.getURI();
                if (redirectURI.isAbsolute()){
                    res.setURL(redirectURI.toURL());
                } else {
                    res.setURL(new URL(new URL(target.toURI()),redirectURI.toString()));
                }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

            map.clear();
        }
    }

    public boolean interrupt() {
        HttpUriRequest request = currentRequest;
        if (request != null) {
            currentRequest = null; // don't try twice
            try {
                request.abort();
            } catch (UnsupportedOperationException e) {
                log.warn("Could not abort pending request", e);
            }
        }
        return request != null;
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

    }
   
    @BeforeClass
    public static void setup() {
        client = new DefaultHttpClient();
        final HttpUriRequest get = new HttpGet(baseUrl);
        System.setProperty("http.port", String.valueOf(port));
        System.setProperty("osgi.storage.path", getOsgiStoragePath());
       
        final InputStream is = CrankstartBootstrapTest.class.getResourceAsStream(TEST_RESOURCE);
        assertNotNull("Expecting test resource to be found:" + TEST_RESOURCE, is);
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

    }
   
    @Test
    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testHttpRoot() throws Exception {
        final HttpUriRequest get = new HttpGet(baseUrl);
        HttpResponse response = null;
        try {
            response = client.execute(get);
            assertEquals("Expecting page not found at " + get.getURI(), 404, response.getStatusLine().getStatusCode());
        } finally {
            closeConnection(response);
        }
    }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

    }
   
    @Test
    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testSingleConfigServlet() throws Exception {
        final HttpUriRequest get = new HttpGet(baseUrl + "/single");
        HttpResponse response = null;
        try {
            response = client.execute(get);
            assertEquals("Expecting success for " + get.getURI(), 200, response.getStatusLine().getStatusCode());
        } finally {
            closeConnection(response);
        }
    }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

    @Test
    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testConfigFactoryServlet() throws Exception {
        final String [] paths = { "/foo", "/bar/test" };
        for(String path : paths) {
            final HttpUriRequest get = new HttpGet(baseUrl + path);
            HttpResponse response = null;
            try {
                response = client.execute(get);
                assertEquals("Expecting success for " + get.getURI(), 200, response.getStatusLine().getStatusCode());
            } finally {
                closeConnection(response);
            }
        }
    }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

   
    @Test
    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testJUnitServlet() throws Exception {
        final String path = "/system/sling/junit";
        final HttpUriRequest get = new HttpGet(baseUrl + path);
        HttpResponse response = null;
        try {
            response = client.execute(get);
            assertEquals("Expecting JUnit servlet to be installed via sling extension command, at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
        } finally {
            closeConnection(response);
        }
    }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

                "org.apache.sling.settings"
        };
       
        for(String name : addBundles) {
            final String path = basePath + name;
            final HttpUriRequest get = new HttpGet(baseUrl + path);
            HttpResponse response = null;
            try {
                response = client.execute(get);
                assertEquals("Expecting additional bundle to be present at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
            } finally {
                closeConnection(response);
            }
        }
    }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

    @Test
    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testFelixFormatConfig() throws Exception {
        setAdminCredentials();
        final String path = "/system/console/config/configuration-status-20140606-1347+0200.txt";
        final HttpUriRequest get = new HttpGet(baseUrl + path);
        HttpResponse response = null;
        try {
            response = client.execute(get);
            assertEquals("Expecting config dump to be available at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
            assertNotNull("Expecting response entity", response.getEntity());
            String encoding = "UTF-8";
            if(response.getEntity().getContentEncoding() != null) {
                encoding = response.getEntity().getContentEncoding().getValue();
            }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testSpecificStartLevel() throws Exception {
        // Verify that this bundle is only installed, as it's set to start level 99
        setAdminCredentials();
        final String path = "/system/console/bundles/org.apache.commons.collections.json";
        final HttpUriRequest get = new HttpGet(baseUrl + path);
        HttpResponse response = null;
        try {
            response = client.execute(get);
            assertEquals("Expecting bundle status to be available at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
            assertNotNull("Expecting response entity", response.getEntity());
            String encoding = "UTF-8";
            if(response.getEntity().getContentEncoding() != null) {
                encoding = response.getEntity().getContentEncoding().getValue();
            }
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.