Package org.springframework.http

Examples of org.springframework.http.MediaType


    public void testCreateAndGetReport_Success_App() throws Exception {
        ClientHttpRequest request = getPrintRequest("geoext" + MapPrinterServlet.CREATE_AND_GET_URL + ".pdf", HttpMethod.POST);
        setPrintSpec(getPrintSpec("examples/geoext/requestData.json"), request);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(new MediaType("application", "pdf"), response.getHeaders().getContentType());
        assertTrue(response.getBody().read() >= 0);
    }
View Full Code Here


        ClientHttpRequest request = getPrintRequest(MapPrinterServlet.CREATE_AND_GET_URL + ".pdf", HttpMethod.POST);
        String example = getDefaultAppDefaultRequestSample();
        setPrintSpec(example, request);
        response = request.execute();
        assertEquals(HttpStatus.OK, response.getStatusCode());
        assertEquals(new MediaType("application", "pdf"), response.getHeaders().getContentType());
        assertTrue(response.getBody().read() >= 0);
    }
View Full Code Here

    }

    protected MediaType getJsonMediaType() {
        Map<String, String> params = new HashMap<String, String>();
        params.put("charset", "utf-8");
        return new MediaType("application", "json", params);
    }
View Full Code Here

    }

    protected MediaType getJavaScriptMediaType() {
        Map<String, String> params = new HashMap<String, String>();
        params.put("charset", "utf-8");
        return new MediaType("application", "javascript", params);
    }
View Full Code Here

        assertTrue("Report url should end with .printout: " + getUrl, getUrl.endsWith(".printout"));
         
        ClientHttpRequest requestGetPdf = getRequest(getUrl.replace("/print-servlet/", ""), HttpMethod.GET);
        response = requestGetPdf.execute();
        assertEquals(response.getStatusText(), HttpStatus.OK, response.getStatusCode());
        assertEquals(new MediaType("application", "pdf"), response.getHeaders().getContentType());
        assertTrue(response.getBody().read() >= 0);
    }
View Full Code Here

        assertTrue("Report url should end with .printout: " + getUrl, getUrl.endsWith(".printout"));

        ClientHttpRequest requestGetPdf = httpRequestFactory.createRequest(new URI(getUrl), HttpMethod.GET);
        response = requestGetPdf.execute();
        assertEquals(response.getStatusText(), HttpStatus.OK, response.getStatusCode());
        assertEquals(new MediaType("application", "pdf"), response.getHeaders().getContentType());
        assertTrue(response.getBody().read() >= 0);
    }
View Full Code Here

    public void testPrint_SpecAsPostBody() throws Exception {
        ClientHttpRequest request = getPrintRequest("print.pdf", HttpMethod.POST);
        setPrintSpec(getPrintSpec("examples/verboseExample/old-api-requestData.json"), request);
        response = request.execute();
        assertEquals(response.getStatusText(), HttpStatus.OK, response.getStatusCode());
        assertEquals(new MediaType("application", "pdf"), response.getHeaders().getContentType());
        assertTrue(response.getBody().read() >= 0);
    }
View Full Code Here

    public void testPrint_SpecAsFormPost() throws Exception {
        ClientHttpRequest request = getPrintRequest("print.pdf", HttpMethod.POST);
        setPrintSpec("spec=" + getPrintSpec("examples/verboseExample/old-api-requestData.json"), request);
        response = request.execute();
        assertEquals(response.getStatusText(), HttpStatus.OK, response.getStatusCode());
        assertEquals(new MediaType("application", "pdf"), response.getHeaders().getContentType());
        assertTrue(response.getBody().read() >= 0);
    }
View Full Code Here

        String printSpec = getPrintSpec("examples/verboseExample/old-api-requestData.json");
        String url = "print.pdf?spec=" + URLEncoder.encode(printSpec, Constants.DEFAULT_ENCODING);
        ClientHttpRequest request = getPrintRequest(url, HttpMethod.GET);
        response = request.execute();
        assertEquals(response.getStatusText(), HttpStatus.OK, response.getStatusCode());
        assertEquals(new MediaType("application", "pdf"), response.getHeaders()
                .getContentType());
        assertTrue(response.getBody().read() >= 0);
    }
View Full Code Here

        assertTrue("Report url should end with .printout: " + getUrl, getUrl.endsWith(".printout"));

        ClientHttpRequest requestGetPdf = httpRequestFactory.createRequest(new URI(getUrl), HttpMethod.GET);
        response = requestGetPdf.execute();
        assertEquals(response.getStatusText(), HttpStatus.OK, response.getStatusCode());
        assertEquals(new MediaType("application", "pdf"), response.getHeaders().getContentType());
        assertTrue(response.getBody().read() >= 0);
    }
View Full Code Here

TOP

Related Classes of org.springframework.http.MediaType

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.