Ratpack sendFile in Java8

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Ratpack sendFile in Java8

Syntax
Hi *,

i´m new in ratpack and play around with ratpack in java8 (not groovy), so is any simpler expression for the default handler to render a file?
---
handler(context -> context.getResponse().sendFile(context, new File(HandlerFactory.class.getClassLoader().getResource("static/index.html").toURI()).toPath()));
---
Thanks,
Syntax
Reply | Threaded
Open this post in threaded view
|

Re: Ratpack sendFile in Java8

Luke Daley
Administrator
This should do it:

handler(context -> context.render(context.file("static/index.html”)));
Reply | Threaded
Open this post in threaded view
|

Re: Ratpack sendFile in Java8

Syntax
Thx :-)