Package play.mvc.Http

Examples of play.mvc.Http.Response


    Map<String, File> files= new HashMap<String, File>();
    File file = Play.getFile("test/angel.gif");
    assertTrue(file.exists());

    files.put("upload", file);
    Response uploadResponse = POST("/Binary/upload", parameters, files);

        assertStatus(200, uploadResponse);

        String size = uploadResponse.getHeader("Content-Length");

      assertEquals("Size does not match", "2440", size);
  }
View Full Code Here


//  }


    @Test
    public void testGetBinaryWithCustomContentType() {
        Response response = GET("/binary/getBinaryWithCustomContentType");
        assertIsOk(response);
        assertContentType("custom/contentType", response);
    }
View Full Code Here

public class TransactionalJPATest extends FunctionalTest {
   
    @Test
    public void testImport() {
        Response response = GET("/Transactional/readOnlyTest");
        assertIsOk(response);
        response = GET("/Transactional/echoHowManyPosts");
        assertIsOk(response);
        assertEquals("There are 0 posts", getContent(response));
    }
View Full Code Here

   
    @Test
    public void testDisableTransaction() {
 
        //make sure isInsideTransaction returns true when actually inside a transaction
        Response response = GET("/Transactional/verifyIsInsideTransaction");
        assertIsOk(response);
        assertEquals("isInsideTransaction: true", getContent(response));
 
        //verify that we can make the controller run without any transaction at all
        response = GET("/Transactional/disabledTransactionTest");
View Full Code Here

            // Plain old HttpRequest
            try {
                final Request request = parseRequest(ctx, nettyRequest, messageEvent);

                final Response response = new Response();
                Http.Response.current.set(response);

                // Buffered in memory output
                response.out = new ByteArrayOutputStream();

                // Direct output (will be set later)
                response.direct = null;

                // Streamed output (using response.writeChunk)
                response.onWriteChunk(new Action<Object>() {

                    public void invoke(Object result) {
                        writeChunk(request, response, ctx, nettyRequest, result);
                    }
                });
View Full Code Here

        if (exposePlayServer) {
            nettyResponse.setHeader(SERVER, signature);
        }

        Request request = Request.current();
        Response response = Response.current();

        String encoding = response.encoding;

        try {
            if (!(e instanceof PlayException)) {
View Full Code Here

     * @param url relative url such as <em>"/products/1234"</em>
     * @param followRedirect indicates if request have to follow redirection (status 302)
     * @return the response
     */
    public static Response GET(Object url, boolean followRedirect) {
        Response response = GET(url);
        if (Http.StatusCode.FOUND == response.status && followRedirect) {
            Http.Header redirectedTo = response.headers.get("Location");
            java.net.URL redirectedUrl = null;
            try {
                redirectedUrl = new java.net.URL(redirectedTo.value());
View Full Code Here

            throw new RuntimeException(ex);
        }
    }

    public static Response makeRequest(final Request request) {
        Response response = newResponse();
        makeRequest(request, response);

        if (response.status == 302) { // redirect
            // if Location-header is pressent, fix it to "look like" a functional-test-url
            Http.Header locationHeader = response.headers.get("Location");
View Full Code Here

        }
        return response;
    }

    public static Response newResponse() {
        Response response = new Response();
        response.out = new ByteArrayOutputStream();
        return response;
    }
View Full Code Here

            Logger.trace("ServletWrapper>service " + httpServletRequest.getRequestURI());
        }

        Request request = null;
        try {
            Response response = new Response();
            response.out = new ByteArrayOutputStream();
            Response.current.set(response);
            request = parseRequest(httpServletRequest);

            if (Logger.isTraceEnabled()) {
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.