Package org.springframework.http.client

Examples of org.springframework.http.client.ClientHttpRequest


        assertTrue(appIdsJson.length() > 0);
    }

    @Test
    public void testListAppsJsonp() throws Exception {
        ClientHttpRequest request = getPrintRequest(MapPrinterServlet.LIST_APPS_URL + "?jsonp=listApps", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJavaScriptMediaType(), response.getHeaders().getContentType());

        String responseAsText = getBodyAsText(response);
        assertTrue(responseAsText.startsWith("listApps("));
View Full Code Here


        assertTrue(appIdsJson.length() > 0);
    }

    @Test
    public void testGetCapabilities_NoApp() throws Exception {
        ClientHttpRequest request = getPrintRequest(MapPrinterServlet.CAPABILITIES_URL, HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJsonMediaType(), response.getHeaders().getContentType());
        assertTrue(getBodyAsText(response).contains("\"app\":\"default\""));
    }
View Full Code Here

        assertTrue(getBodyAsText(response).contains("\"app\":\"default\""));
    }

    @Test
    public void testGetCapabilities_App() throws Exception {
        ClientHttpRequest request = getPrintRequest("geoext" + MapPrinterServlet.CAPABILITIES_URL, HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJsonMediaType(), response.getHeaders().getContentType());
        assertTrue(getBodyAsText(response).contains("\"app\":\"geoext\""));
    }
View Full Code Here

        assertTrue(getBodyAsText(response).contains("\"app\":\"geoext\""));
    }

    @Test
    public void testGetCapabilities_InvalidApp() throws Exception {
        ClientHttpRequest request = getPrintRequest("INVALID-APP_ID" + MapPrinterServlet.CAPABILITIES_URL, HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode());
    }
View Full Code Here

        assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode());
    }

    @Test
    public void testGetCapabilitiesPretty_NoApp() throws Exception {
        ClientHttpRequest request = getPrintRequest(MapPrinterServlet.CAPABILITIES_URL + "?pretty=true", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJsonMediaType(), response.getHeaders().getContentType());
        assertTrue(getBodyAsText(response).contains("\n"));
    }
View Full Code Here

        assertTrue(getBodyAsText(response).contains("\n"));
    }

    @Test
    public void testGetCapabilitiesJsonp_NoApp() throws Exception {
        ClientHttpRequest request = getPrintRequest(MapPrinterServlet.CAPABILITIES_URL + "?jsonp=printCapabilities", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJavaScriptMediaType(), response.getHeaders().getContentType());
        assertTrue(getBodyAsText(response).startsWith("printCapabilities("));
    }
View Full Code Here

        assertTrue(getBodyAsText(response).startsWith("printCapabilities("));
    }

    @Test
    public void testGetCapabilitiesJsonpPretty_NoApp() throws Exception {
        ClientHttpRequest request = getPrintRequest(
                MapPrinterServlet.CAPABILITIES_URL + "?pretty=true&jsonp=printCapabilities", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJavaScriptMediaType(), response.getHeaders().getContentType());
        String responseAsText = getBodyAsText(response);
        assertTrue(responseAsText.startsWith("printCapabilities("));
        assertTrue(responseAsText.contains("\n"));
View Full Code Here

        assertTrue(responseAsText.contains("\n"));
    }

    @Test
    public void testExampleRequest_NoApp() throws Exception {
        ClientHttpRequest request = getPrintRequest(MapPrinterServlet.EXAMPLE_REQUEST_URL, HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJsonMediaType(), response.getHeaders().getContentType());
        checkExampleRequest(getBodyAsText(response));
    }
View Full Code Here

        checkExampleRequest(getBodyAsText(response));
    }

    @Test
    public void testExampleRequestJsonp_NoApp() throws Exception {
        ClientHttpRequest request = getPrintRequest(MapPrinterServlet.EXAMPLE_REQUEST_URL + "?jsonp=exampleRequest", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJavaScriptMediaType(), response.getHeaders().getContentType());

        String responseAsText = getBodyAsText(response);
        assertTrue(responseAsText.startsWith("exampleRequest("));
View Full Code Here

        checkExampleRequest(responseAsText);
    }

    @Test
    public void testExampleRequest_App() throws Exception {
        ClientHttpRequest request = getPrintRequest("geoext" + MapPrinterServlet.EXAMPLE_REQUEST_URL, HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJsonMediaType(), response.getHeaders().getContentType());
        checkExampleRequest(getBodyAsText(response));
    }
View Full Code Here

TOP

Related Classes of org.springframework.http.client.ClientHttpRequest

Copyright © 2018 www.massapicom. 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.