Package play.mvc.Http

Examples of play.mvc.Http.Response


    // ------------
    @Override
    public void service(GrizzlyRequest grizzlyRequest, GrizzlyResponse grizzlyResponse) {
        Request request = null;
        try {
            Response response = new Response();
            response.out = new ByteArrayOutputStream();
            Response.current.set(response);
            request = parseRequest(grizzlyRequest);
            boolean raw = false;
            for (PlayPlugin plugin : Play.plugins) {
View Full Code Here


  }

  @Test
  public void indexTest() {
    // make a request on the application (embedded)
    Response response = GET("/");
    // check the HTTP response status is OK
    assertStatus(200, response);
    // check the response is HTML
    assertContentType("text/html", response);
    // check the declared charset encoding
View Full Code Here

            request.body = new ByteArrayInputStream(new byte[0]);
            Request.current.set(request);
        }

        if (Response.current() == null) {
            Response response = new Response();
            response.out = new ByteArrayOutputStream();
            response.direct = null;
            Response.current.set(response);
        }
View Full Code Here

public class ContentTypeAssertionTest {

  @Test(expected=AssertionError.class)
  public void givenContentTypeIsMissing_shouldThrowAssertionError() {
    Response responseWithoutContentType = new Response();

    assertContentType("text/html", responseWithoutContentType);
  }
View Full Code Here

        }
    }

    @Test
    public void contentTypeShouldReturnDefaultCharsetInAbsenceOfResponse() throws Exception {
        Response originalResponse = Response.current();
        try {
            Response.current.set(null);
            assertEquals("text/xml; charset=" + play.Play.defaultWebEncoding,
                         MimeTypes.getContentType("test.xml"));
        }
View Full Code Here

        when(request.method()).thenReturn(METHOD);
        when(request.path()).thenReturn(addonContext + PATH);
        when(request.queryString()).thenReturn(ImmutableMap.<String, String[]>of());
        when(jwtIssuerValidator.isValid(anyString())).thenReturn(true);
        when(jwtIssuerSharedSecretService.getSharedSecret(anyString())).thenReturn(PASSWORD);
        Response response = new Response();
        return jwtAuthenticator.authenticate(request, response).getResult();
    }
View Full Code Here

        // 3. Manually processes the tasks
        List<TaskStateInfo> states = queueInfo.getTaskInfo();
        for (int i = 0; i < states.size(); i++) {
            TaskStateInfo taskInfo = states.get(i);
            Response response = executeTask(taskInfo);
            assertStatus(200, response);
            Map<String, List<String>> params = new QueryStringDecoder("http://dummy/a?" + taskInfo.getBody())
                .getParameters();
            Key first = KeyFactory.stringToKey(params.get(ChunkedRuleProcessor.pSTART_ID)
                                                     .get(0));
View Full Code Here

public class ApplicationTest extends FunctionalTest {

    @Test
    public void testThatIndexPageWorks() {
        Response response = GET("/");
        assertIsOk(response);
        assertContentType("text/html", response);
        assertCharset(play.Play.defaultWebEncoding, response);
    }
View Full Code Here

    @Test
    public void uploadAndGetBlob() throws IOException {
        Map<String,File> files = new HashMap<String, File>();
        files.put("image", new File("test/googlelogo.png"));
        Response response = POST("/image", Collections.<String, String>emptyMap(), files);

        assertIsOk(response);

        String id = getContent(response);

        Response imageResp = GET("/image/" + id);
        assertIsOk(imageResp);

        String responseMd5 = DigestUtils.md5Hex(imageResp.out.toByteArray());
        assertEquals(actualMd5, responseMd5);
    }
View Full Code Here

        jsonp(url);
        jsonpDetails(url);
    }

    private void json(String url) {
        Response response = GET(url);
        assertJson(response);
    }
View Full Code Here

TOP

Related Classes of play.mvc.Http.Response

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.