Giter Club home page Giter Club logo

Comments (5)

jknack avatar jknack commented on July 28, 2024

Jooby 3.1 moved to jetty 12, so yea it is possible. Can you provide an example to reproduce the bug?

from jooby.

ogrammer avatar ogrammer commented on July 28, 2024

@jknack, it is just:

get("/test.zip", ctx -> {
    ctx.setResponseType("application/zip");
    return Path.of("test.zip");
});

Does not work or only works very very rarely.

Changing to this makes it work:

get("/test.zip", ctx -> {
    ctx.setResponseType("application/zip");
    return Files.newInputStream(Path.of("test.zip"));
});

from jooby.

ogrammer avatar ogrammer commented on July 28, 2024

My test file is 70 MB for reference but it also happens with small files.

from jooby.

jknack avatar jknack commented on July 28, 2024

@ogrammer with a zip file of 25mb, the following test executed successfully all times:

public class Issue3437 {
    @ServerTest(iterations = 1000, server = JettyServer.class)
    public void shouldRenderPathInstances(ServerTestRunner runner) {
        runner.define(app -> {
            app.get("/test.zip", ctx -> {
                ctx.setResponseType("application/zip");
                return Path.of("/Users/edgar/Downloads/test.zip");
            });
        }).ready(http -> {
            http.get("/test.zip", rsp -> {
                assertEquals(200, rsp.code());
            });
        });
    }
}

from jooby.

ogrammer avatar ogrammer commented on July 28, 2024

@jknack You need to try with firefox not jooby http client. It happens with firefox and i am certain it is a jooby or jetty bug because it does not happen in versions before 3.1.x and also does not happen if I use InputStream instead of Path (which jooby makes into a FileChannel)

from jooby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.