Package org.springframework.http.client

Examples of org.springframework.http.client.ClientHttpRequest


            @Override
            protected ClientHttpRequest createRequest(final URI uri,
                                                      final HttpMethod httpMethod,
                                                      final MfClientHttpRequestFactory requestFactory) throws
                    IOException {
                final ClientHttpRequest request = requestFactory.createRequest(uri, httpMethod);
                request.getHeaders().putAll(AddHeadersProcessor.this.headers);
                return request;
            }
        };

    }
View Full Code Here


                        } else {
                            geotiffFile = File.createTempFile("downloadedGeotiff", ".tiff");
                            Closer closer = Closer.create();

                            try {
                                final ClientHttpRequest request = requestFactory.createRequest(url.toURI(), HttpMethod.GET);
                                final ClientHttpResponse httpResponse = closer.register(request.execute());
                                FileOutputStream output = closer.register(new FileOutputStream(geotiffFile));
                                ByteStreams.copy(httpResponse.getBody(), output);
                            } finally {
                                closer.close();
                            }
View Full Code Here

*/
public class MetricsApiTest extends AbstractApiTest {

    @Test
    public void testMetrics() throws Exception {
        ClientHttpRequest request = getMetricsRequest("metrics", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(MediaType.APPLICATION_JSON, response.getHeaders().getContentType());
        JSONObject sampleRequest = new JSONObject(getBodyAsText(response));
        assertTrue(sampleRequest.has("version"));
    }
View Full Code Here

        assertTrue(sampleRequest.has("version"));
    }

    @Test
    public void testPing() throws Exception {
        ClientHttpRequest request = getMetricsRequest("ping", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals("pong", getBodyAsText(response).trim());
    }
View Full Code Here

        assertEquals("pong", getBodyAsText(response).trim());
    }

    @Test
    public void testThreads() throws Exception {
        ClientHttpRequest request = getMetricsRequest("threads", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders().getContentType());
        assertFalse(getBodyAsText(response).isEmpty());
    }
View Full Code Here

        assertFalse(getBodyAsText(response).isEmpty());
    }

    @Test
    public void testHealthcheck() throws Exception {
        ClientHttpRequest request = getMetricsRequest("healthcheck", HttpMethod.GET);
        response = request.execute();
        // TODO not implemented?
        assertEquals(HttpStatus.NOT_IMPLEMENTED, response.getStatusCode());
//        assertEquals(HttpStatus.OK, response.getStatusCode());
//        assertEquals(MediaType.APPLICATION_JSON, response.getHeaders().getContentType());
//        assertNotNull(new JSONObject(getBodyAsText(response)));
View Full Code Here

                            geoX, geoX + tileSizeInWorld.x, geoY, geoY + tileSizeInWorld.y, mapProjection);

                    int row = (int) Math.round((tileCacheBounds.getMaxY() - tileBounds.getMaxY()) * rowFactor);
                    int column = (int) Math.round((tileBounds.getMinX() - tileCacheBounds.getMinX()) * columnFactor);

                    ClientHttpRequest tileRequest = this.tiledLayer.getTileRequest(this.httpRequestFactory, commonUrl, tileBounds,
                            tileSizeOnScreen, column, row);

                    if (isInTileCacheBounds(tileCacheBounds, tileBounds)) {
                        if (isTileVisible(tileBounds)) {
                            final SingleTileLoaderTask task = new SingleTileLoaderTask(tileRequest, this.errorImage, xIndex, yIndex);
View Full Code Here

            for (URL icon : icons) {
                Image image = null;
                Closer closer = Closer.create();
                try {
                    checkCancelState(context);
                    final ClientHttpRequest request = clientHttpRequestFactory.createRequest(icon.toURI(), HttpMethod.GET);
                    final ClientHttpResponse httpResponse = closer.register(request.execute());
                    if (httpResponse.getStatusCode() == HttpStatus.OK) {
                        image = ImageIO.read(httpResponse.getBody());
                        if (image == null) {
                            LOGGER.warn("The URL: " + icon + " is NOT an image format that can be decoded");
                        }
View Full Code Here

        if (urlMatcher.matches() && urlMatcher.group(this.urlGroup) != null) {
            final String uriString = urlMatcher.group(this.urlGroup);
            try {
                URI url = new URI(uriString);
                final ClientHttpRequest request = requestFactory.createRequest(url, HttpMethod.GET);
                final ClientHttpResponse response = request.execute();
                if (response.getStatusCode() == HttpStatus.OK) {
                    try {
                        final BufferedImage image = ImageIO.read(response.getBody());
                        if (image == null) {
                            LOGGER.warn("The URL: " + url + " is NOT an image format that can be decoded");
View Full Code Here

*/
public class OldPrintApiTest extends AbstractApiTest {
   
    @Test
    public void testInfo() throws Exception {
        ClientHttpRequest request = getPrintRequest("info.json", HttpMethod.GET);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(getJsonMediaType(), response.getHeaders().getContentType());
       
        JSONObject info = new JSONObject(getBodyAsText(response));
        assertTrue(info.has("scales"));
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.