On 07/10/14 08:48, Francesco Cina
wrote:
On Tuesday, October 7, 2014 9:24:56 AM UTC+2, Tim
Fox wrote:
On 07/10/14 08:08, Francesco Cina wrote:
Hi all,
I'm currently blocked with an apparently simple task, I
have a file in the classpath and I need to send it as
response to an http call. The file is a javascript
library, but it could be whatever else (e.g.: css, png,
svg, etc...).
The vertx.fileSystem() class only handles file from the
file system and I'm not able to find an alternative for
the classpath.
Hi Tim,
thanks for the fast reply!
I would like to reproduce the behaviour of Servlet 3.0 in
which every file in the classpath in the "META-INF/resources/"
path is automatically available as a web resource.
Most probably, servlet engines are just using getResourceAsStream()
to implement this behaviour. So, if you want to reproduce the
behaviour of Vert.x 3.0 just use that.
So it is not possible to read asynchronously from the
classpath; however, maybe I'm wrong, but I remember that I
read a post of yours in which you explained that even reading
from the FileSystem and/or using an InputStream is always a
blocking operation.
Of course, the API is inherently synchronous - you can see that for
yourself :)
The question is how long does it block for and is that going to be
an issue for your application? If you have a long classpath and/or a
large resource then it's probably going to block for longer than if
you have a short claspath and/or small resource.
Again, how long is a piece of string? ;)
The only real way you can answer these questions is to experiment
yourself.