Tabnine Logo
ResponseTimeHandler.create
Code IndexAdd Tabnine to your IDE (free)

How to use
create
method
in
io.vertx.ext.web.handler.ResponseTimeHandler

Best Java code snippets using io.vertx.ext.web.handler.ResponseTimeHandler.create (Showing top 10 results out of 315)

origin: vert-x3/vertx-web

@Test
public void testRequestTime2() throws Exception {
 router.route().handler(ResponseTimeHandler.create());
 router.route().handler(rc -> vertx.setTimer(250, tid -> rc.response().end()));
 testRequest(HttpMethod.GET, "/", null, resp -> {
  String reqTime = resp.headers().get("x-response-time");
  assertNotNull(reqTime);
  assertTrue(reqTime.endsWith("ms"));
  String time = reqTime.substring(0, reqTime.length() - 2);
  Integer dur = Integer.valueOf(time);
  assertTrue(dur >= 250);
 }, 200, "OK", null);
}
origin: vert-x3/vertx-web

@Test
public void testRequestTime1() throws Exception {
 router.route().handler(ResponseTimeHandler.create());
 router.route().handler(rc -> rc.response().end());
 testRequest(HttpMethod.GET, "/", null, resp -> {
  String reqTime = resp.headers().get("x-response-time");
  assertNotNull(reqTime);
  assertTrue(reqTime.endsWith("ms"));
 }, 200, "OK", null);
}
origin: vert-x3/vertx-web

@Override
public void setUp() throws Exception {
 super.setUp();
 router.route().handler(ResponseContentTypeHandler.create());
 // Added to make sure ResponseContentTypeHandler works well with others
 router.route().handler(ResponseTimeHandler.create());
 testRoute = router.route("/test");
}
origin: vert-x3/vertx-rx

/**
 * Create a handler
 * @return the handler
 */
public static io.vertx.rxjava.ext.web.handler.ResponseTimeHandler create() { 
 io.vertx.rxjava.ext.web.handler.ResponseTimeHandler ret = io.vertx.rxjava.ext.web.handler.ResponseTimeHandler.newInstance(io.vertx.ext.web.handler.ResponseTimeHandler.create());
 return ret;
}
origin: io.vertx/vertx-rx-java

/**
 * Create a handler
 * @return the handler
 */
public static io.vertx.rxjava.ext.web.handler.ResponseTimeHandler create() { 
 io.vertx.rxjava.ext.web.handler.ResponseTimeHandler ret = io.vertx.rxjava.ext.web.handler.ResponseTimeHandler.newInstance(io.vertx.ext.web.handler.ResponseTimeHandler.create());
 return ret;
}
origin: wanghongfei/gae

@Override
public void start() {
  HttpServer server = vertx.createHttpServer();
  Router router = Router.router(vertx);
  router.route().handler(BodyHandler.create());
  router.route().handler(ResponseTimeHandler.create());
  router.route("/")
      .handler(jsonHandlerVertx)
      .handler(authHandlerVertx)
      // .blockingHandler(bidHandlerVertx, false)
      .handler(bidHandlerVertx)
      .failureHandler(errorHandlerVertx);
  server.requestHandler(router::accept).listen(serverProps.getPort());
}
origin: io.vertx/vertx-web

@Test
public void testRequestTime2() throws Exception {
 router.route().handler(ResponseTimeHandler.create());
 router.route().handler(rc -> vertx.setTimer(250, tid -> rc.response().end()));
 testRequest(HttpMethod.GET, "/", null, resp -> {
  String reqTime = resp.headers().get("x-response-time");
  assertNotNull(reqTime);
  assertTrue(reqTime.endsWith("ms"));
  String time = reqTime.substring(0, reqTime.length() - 2);
  Integer dur = Integer.valueOf(time);
  assertTrue(dur >= 250);
 }, 200, "OK", null);
}
origin: mpusher/mpns

public void initHandler() {
  /*mainRouter.route("/static").handler(StaticHandler
      .create()
      .setCachingEnabled(true)
  );
  mainRouter.route("/favicon.ico").handler(FaviconHandler.create("/webroot/favicon.ico"));
  mainRouter.route().failureHandler(ErrorHandler.create());*/
  mainRouter.mountSubRouter("/api", apiRouter);
  apiRouter.route().handler(TimeoutHandler.create(config.getInteger("max.request.timeout", 10 * 1024)));
  apiRouter.route().handler(AccessLogHandler.create(config.getString("api.access.log", "App-Api")));
  apiRouter.route().handler(BodyHandler.create());
  apiRouter.route().handler(ResponseTimeHandler.create());
  apiRouter.route().failureHandler(ApiErrorHandler.create());
}
origin: io.vertx/vertx-web

@Test
public void testRequestTime1() throws Exception {
 router.route().handler(ResponseTimeHandler.create());
 router.route().handler(rc -> rc.response().end());
 testRequest(HttpMethod.GET, "/", null, resp -> {
  String reqTime = resp.headers().get("x-response-time");
  assertNotNull(reqTime);
  assertTrue(reqTime.endsWith("ms"));
 }, 200, "OK", null);
}
origin: io.vertx/vertx-web

@Override
public void setUp() throws Exception {
 super.setUp();
 router.route().handler(ResponseContentTypeHandler.create());
 // Added to make sure ResponseContentTypeHandler works well with others
 router.route().handler(ResponseTimeHandler.create());
 testRoute = router.route("/test");
}
io.vertx.ext.web.handlerResponseTimeHandlercreate

Javadoc

Create a handler

Popular methods of ResponseTimeHandler

  • handle

Popular in Java

  • Making http requests using okhttp
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now