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)
- fail() in RoutingContextImpl constructor causes "Unhandled exception in router" even if error was handled
- converting routing context request to web socket returns text handler id as null. HOT 1
- ForwardedParser parse XFF IPV6. HOT 4
- sqlConnection.updateWithParams HOT 1
- VertxRest HOT 1
- Investigate if Vertx WebClient can support HTTP proxy server proxying HTTPS requests HOT 1
- Add webUser() method to io.vertx.ext.web.handler.graphql.ws.Message HOT 2
- vertx-web-graphql subscription onError() is not returning a payload of an array of GraphQLErrors HOT 1
- `BodyHandler` with `deleteUploadedFilesOnEnd=true` fail to clean temporary file HOT 1
- GraphQLWS: store the RoutingContext in GraphQLContext HOT 1
- Deprecate GraphQLHandler#getRoutingContext HOT 1
- Support request forwarding to Web API Service with new OpenAPI Router
- Handling close connection with GraphQLWSHandler HOT 8
- vertx-web-api-contract contains shaded dependencies with Critical CVE HOT 1
- MVEL is broken with Java 21 HOT 2
- All CORS rejections reported to server logs HOT 3
- BodyHandler with setDeleteUploadedFilesOnEnd "true" logs warn if uploaded file was moved HOT 3
- feat: Reject function for Web-Client
- Ability to introspect and log the OAuth token obtained by the OAuth2WebClient. HOT 3
- Upgrade GraphiQL IDE HOT 1
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.