Package play.mvc.Http

Examples of play.mvc.Http.Response


  /**
   * Commits.
   */
  @Test
  public void commits() {
    Response response = GET("/rest/github/repository/feliperazeek/socialestates/commits");
    this.basicTest(response);
  }
View Full Code Here


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

                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

    // ------------
    @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

    Fixtures.deleteAll(); // see Bug #491403
    Fixtures.deleteDirectory("attachments");
    URL deleteURL = reverse(); {
      Binary.deleteAll();
    }   
    Response deletedResponse = GET(deleteURL);
    assertStatus(200, deletedResponse);
  }
View Full Code Here

  @Test
  public void testUploadSomething() {
    URL imageURL = reverse(); {
      Binary.showAvatar(1l);
    }
    Response getResponse = GET(imageURL);
    assertStatus(404, getResponse);
   
    URL url = reverse(); {
      Binary.save(null);
    }
    Map<String,String> parameters= new HashMap<String,String>();
    parameters.put("user.username", "username");
    Map<String, File> files= new HashMap<String, File>();
    File f = Play.getFile("test/fond1.png");
    assertTrue(f.exists());
    files.put("user.avatar", f);
    Response uploadResponse = POST(url, parameters, files);
    assertStatus(302, uploadResponse);
    String id = uploadResponse.getHeader("Location").split("=")[1];
    imageURL = reverse(); {
      Binary.showAvatar(new Long(id));
    }
    getResponse = GET(imageURL);
    assertStatus(200, getResponse);
View Full Code Here

    Map<String, File> files= new HashMap<String, File>();
    File file = Play.getFile("test/winie.jpg");
    assertTrue(file.exists());
    files.put("file", file);
    Response uploadResponse = POST("/Binary/uploadFile", parameters, files);

        assertStatus(200, uploadResponse);

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

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

    Map<String, File> files= new HashMap<String, File>();
    File file = Play.getFile("test/winie.jpg");
    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", "1366949", size);
  }
View Full Code Here

    Map<String, File> files= new HashMap<String, File>();
    File file = Play.getFile("test/angel.gif");
    assertTrue(file.exists());
    files.put("file", file);
    Response uploadResponse = POST("/Binary/uploadFile", parameters, files);

        assertStatus(200, uploadResponse);

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

      assertEquals("Size does not match", "2440", size);
  }
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.