Comments (5)
Thanks. Do you have a reproducer?
from vertx-web.
not something to copy paste in here, but any attempt to use StaticServer.staticServer() handler on windows should fail due to this.
from vertx-web.
If you could put together a simple test that exhibits the issue it would be a lot easier for me to track this down.
from vertx-web.
ok. below is a simple server for static files handling. the static server reads files from /webRoot/web/
trying to call localhost:8888/web/example.html
on linux all works good, the static file is returned as expected. on windows i get 500, while debugging i see the exception the follows the code.
//==================
package just.playing.vertx;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.http.HttpServer;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.ext.apex.addons.Favicon;
import io.vertx.ext.apex.addons.StaticServer;
import io.vertx.ext.apex.core.FailureRoutingContext;
import io.vertx.ext.apex.core.Router;
import io.vertx.ext.apex.core.RoutingContext;
public class ApexVerticle extends AbstractVerticle {
public void start( Future<Void> startFuture ) {
Router router = Router.router( vertx );
router.route()
.handler( Favicon.favicon() );
router.routeWithRegex( "/web/*" )
.handler( StaticServer.staticServer()
.setDirectoryListing( false ) )
.failureHandler( ( FailureRoutingContext context ) -> {
context.response()
.setStatusCode( 404 )
.end();
} );
router.route()
.handler( ( RoutingContext context ) -> {
context.fail( 404 );
} );
//server
vertx.createHttpServer( new HttpServerOptions().setPort( 8888 ) )
.requestHandler( router::accept )
.listen( ( AsyncResult<HttpServer> event ) -> {
System.out.println( "Server is up" );
} );
}
}
//=====
on windows machine only:
java.nio.file.NoSuchFileException: C:\Users\atarno\apex-files\webroot%5cweb%5cexample.html
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:99)
at sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:278)
at java.nio.file.Files.copy(Files.java:1274)
at io.vertx.core.impl.FileResolver.unpackFromFileURL(FileResolver.java:107)
at io.vertx.core.impl.FileResolver.resolveFile(FileResolver.java:89)
at io.vertx.core.impl.VertxImpl.resolveFile(VertxImpl.java:603)
at io.vertx.core.file.impl.FileSystemImpl$6.perform(FileSystemImpl.java:517)
at io.vertx.core.file.impl.FileSystemImpl$6.perform(FileSystemImpl.java:514)
at io.vertx.core.file.impl.FileSystemImpl.propsBlocking(FileSystemImpl.java:150)
at io.vertx.ext.apex.addons.impl.StaticServerImpl.getFileProps(StaticServerImpl.java:203)
at io.vertx.ext.apex.addons.impl.StaticServerImpl.handle(StaticServerImpl.java:160)
at io.vertx.ext.apex.addons.impl.StaticServerImpl.handle(StaticServerImpl.java:51)
at io.vertx.ext.apex.core.impl.RouteImpl.handleContext(RouteImpl.java:174)
at io.vertx.ext.apex.core.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:69)
at io.vertx.ext.apex.core.impl.RoutingContextImpl.next(RoutingContextImpl.java:94)
at io.vertx.ext.apex.addons.impl.FaviconImpl.handle(FaviconImpl.java:161)
at io.vertx.ext.apex.addons.impl.FaviconImpl.handle(FaviconImpl.java:33)
at io.vertx.ext.apex.core.impl.RouteImpl.handleContext(RouteImpl.java:174)
at io.vertx.ext.apex.core.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:69)
at io.vertx.ext.apex.core.impl.RoutingContextImpl.next(RoutingContextImpl.java:94)
at io.vertx.ext.apex.core.impl.RouterImpl.accept(RouterImpl.java:56)
...
at io.vertx.core.http.impl.ServerConnection.handleRequest(ServerConnection.java:253)
at io.vertx.core.http.impl.ServerConnection.processMessage(ServerConnection.java:355)
at io.vertx.core.http.impl.ServerConnection.handleMessage(ServerConnection.java:129)
at io.vertx.core.http.impl.HttpServerImpl$ServerHandler.createConnAndHandle(HttpServerImpl.java:569)
at io.vertx.core.http.impl.HttpServerImpl$ServerHandler.doMessageReceived(HttpServerImpl.java:495)
at io.vertx.core.http.impl.HttpServerImpl$ServerHandler.doMessageReceived(HttpServerImpl.java:429)
at io.vertx.core.http.impl.VertxHttpHandler.channelRead(VertxHttpHandler.java:76)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:131)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:161)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.vertx.core.http.impl.cgbystrom.FlashPolicyHandler.channelRead(FlashPolicyHandler.java:69)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:745)
from vertx-web.
Ok, thanks. This should be fixed now (in vertx-core).
from vertx-web.
Related Issues (20)
- HttpContext.fail() does not release the connection when invoked in SEND_REQUEST phase
- WebClient: NPE on misformatted Date or Expires header HOT 1
- absoluteURI is null when host header is missing HOT 2
- Issue with POST request hanging indefinitely in Vert.x Web HOT 3
- CSRF validation fails because CSRFHandler updates the session AFTER the session is already flushed HOT 1
- SockJS Event Bus Bridge does not keep web sessions alive for clustered session managers
- When upgrade vertx4, the path cannot support colon, and vertx 3 is ok HOT 1
- Use the new `OAuth2AuthorizationURL` in `OAuth2AuthHandler.extraParams`
- Reduce heavy atomic operations on RoutingContextImplBase HOT 1
- Rx Version of OAuth2AuthHandler Handler fails to add scopes HOT 2
- Vertx web randomly returns 404 error for certain POST requests even though for other similar requests it returns 200 HOT 2
- ChainAuthHandlerImpl#postAuthentication throws NPE HOT 1
- BodyHandler should not be added before the ProxyHandler HOT 2
- after RoutingContext.reroute(), TimeoutHandler still occured HOT 1
- Request to add localstorage-functonalities HOT 1
- GraphQL: Combination of request batching and Automatic Persisted Queries fails HOT 1
- New web client expectation, result type differ from error type HOT 5
- Exeptionhandler not working correctly HOT 5
- HTTP 1.0 request causes "Unhandled exception in router" HOT 4
- Catch all error handler
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vertx-web.