SHARE
TWEET

Untitled

a guest Jan 11th, 2017 25 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Override
  2. public void start(Future<Void> fut){
  3.     Router router = Router.router(vertx);
  4.     stat = StaticHandler.create().setEnableRangeSupport(true);
  5.     router.route("/pathexample").blockingHandler(routingContext -> {
  6.         HttpServerResponse response = routingContext.response();
  7.         response.headers().add("Accept-Ranges","bytes");
  8.         response.headers().add("Content-Type","video/mp4");
  9.         response.sendFile(getFile());  
  10.     });
  11.     router.route("/pathexample").blockingHandler(stat);
  12.     vertx
  13.         .createHttpServer()
  14.         .requestHandler(router::accept)
  15.         .listen(
  16.             config().getInteger("http.port",port),
  17.             result -> {
  18.                 if(result.succeeded()){
  19.                     fut.complete();
  20.                 }else{
  21.                     fut.fail(result.cause());
  22.                 }
  23.             }
  24.         );
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top