当前位置: 首页>>代码示例>>Java>>正文


Java CookieHandler类代码示例

本文整理汇总了Java中io.vertx.ext.web.handler.CookieHandler的典型用法代码示例。如果您正苦于以下问题:Java CookieHandler类的具体用法?Java CookieHandler怎么用?Java CookieHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CookieHandler类属于io.vertx.ext.web.handler包,在下文中一共展示了CookieHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void start() throws Exception {
	Router router = Router.router(vertx);
	int serverPort = Config.getIntValue("serverPort");
	
	router.route().handler(BodyHandler.create().setUploadsDirectory("files"));
	router.route().handler(CookieHandler.create());
	router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
	Routing.route(router, "com.planb.restful");
	
	router.route().handler(StaticHandler.create());
	new Parser().start();
	
	Log.info("Server Started At : " + serverPort);
	vertx.createHttpServer().requestHandler(router::accept).listen(serverPort);
}
 
开发者ID:JoMingyu,项目名称:Bobsim-Server,代码行数:17,代码来源:MainVerticle.java

示例2: start

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void start() throws Exception {
	Router router = Router.router(vertx);
	int serverPort = Config.getIntValue("serverPort");
	
	router.route().handler(BodyHandler.create().setUploadsDirectory("files"));
	router.route().handler(CookieHandler.create());
	router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
	router.route().handler(CORSHandler.create());
	router.route().handler(LogHandler.create());
	Routing.route(router, "com.planb.restful");
	
	router.route().handler(StaticHandler.create());
	
	Log.info("Server Started At : " + serverPort);
	vertx.createHttpServer().requestHandler(router::accept).listen(serverPort);
}
 
开发者ID:JoMingyu,项目名称:Server-Quickstart-Vert.x,代码行数:18,代码来源:MainVerticle.java

示例3: configure

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public SockJSHandler configure(VertxContext vertxContext, ServerConfiguration<JsonObject, JsonObject[]> config) {

    JsonObject sockJsConfig=config.getJsonObject(CONFIG_KEY, makeDefaultConfig());

    BridgeOptions bridgeOptions = configureBridgeOptions(sockJsConfig);

    SockJSHandler sockJSHandler = configureSockJsHandler(vertxContext, bridgeOptions, sockJsConfig);
    boolean CSRFProteceted=sockJsConfig.getBoolean(CSRF_PROTECTED, false);
    if(CSRFProteceted) {
        if(config.getString(CSRF_SECRET, EMPTY_CSRF_SECRET).isEmpty() || config.getString(CSRF_SECRET,
                EMPTY_CSRF_SECRET).length()<12)
            throw new CsrfProtectionEnabledBuInvalidSecretProvided();
        vertxContext.router().route().path(VertxBusContext.DEFAULT_EVENTBUS_PATH).handler(CookieHandler.create());
        vertxContext.router().route().path(VertxBusContext.DEFAULT_EVENTBUS_PATH).handler(
                CSRFHandler.create(config.getString(CSRF_SECRET, EMPTY_CSRF_SECRET)));
    }
    return sockJSHandler;
}
 
开发者ID:GwtDomino,项目名称:domino-event-bus,代码行数:20,代码来源:VertxConfigSockJsConfigurator.java

示例4: start

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
public void start() throws Exception {
     Router router = Router.router(vertx);

     router.route().handler(BodyHandler.create().setUploadsDirectory("upload-files"));
     router.route().handler(CookieHandler.create());
     router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)).setNagHttps(false));
     router.route().handler(RequestSecurePreprocessor.create());
     RouteRegister.registerRouters(router, "com.dms.secure", "com.dms.api", "com.dms.templates");
     router.route("/js/*").handler(StaticHandler.create().setCachingEnabled(false).setWebRoot("WEB-INF/js/"));
     
     /*
      * @see com.dms.planb.support .TableDropper
*/
     HttpServerOptions httpOpts = new HttpServerOptions();
     /*System.out.println(SecureConfig.get("SSL_PATH"));
     System.out.println(SecureConfig.get("SSL"));
     httpOpts.setSsl(true)
             .setKeyStoreOptions(new JksOptions().setPath(SecureConfig.get("SSL_PATH")).setPassword(SecureConfig.get("SSL")))
             .setTrustStoreOptions(new JksOptions().setPath(SecureConfig.get("SSL_PATH")).setPassword(SecureConfig.get("SSL")));
     */
     vertx.createHttpServer(httpOpts).requestHandler(router::accept).listen(Integer.parseInt(SecureConfig.get("SERVER_PORT")));
 }
 
开发者ID:DSM-DMS,项目名称:DMS,代码行数:23,代码来源:DmsVerticle.java

示例5: start

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
public void start() throws Exception {
		Router router = Router.router(vertx);
		int serverPort = Config.getIntValue("serverPort");
		
		router.route().handler(BodyHandler.create().setUploadsDirectory("upload-files"));
		router.route().handler(CookieHandler.create());
		router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
		router.route().handler(CORSHandler.create());
		router.route().handler(LogHandler.create());
		
		Routing.route(router, "com.planb.restful");

		router.route().handler(StaticHandler.create());

//		new ParserThread().start();

		Log.info("Server Started");
		vertx.createHttpServer().requestHandler(router::accept).listen(serverPort);
	}
 
开发者ID:JoMingyu,项目名称:Daejeon-People,代码行数:20,代码来源:CoreVerticle.java

示例6: start

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void start() throws Exception {
    Router router = Router.router(vertx);

    router.route().handler(BodyHandler.create());
    router.route().handler(CookieHandler.create());

    bootstrap.getInjector().getInstance(ApplicationVertxRoutes.class).init(router, vertx);

    httpServer = vertx.createHttpServer();
    httpServer.requestHandler(router::accept).listen(getPort(), res -> {
        if (res.succeeded()) {
            log.info("Server is now listening. Thread:" + Thread.currentThread());
        } else {
            log.info("Failed to bind. Thread:" + Thread.currentThread(), res.cause());
        }
    });

}
 
开发者ID:kuangcao,项目名称:ninja-vertx-standalone,代码行数:20,代码来源:NinjaVerticle.java

示例7: initAPIRouter

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
/**
 * Initialise the Root API router and add common handlers to the router. The API router is used to attach subrouters for routes like
 * /api/v1/[groups|users|roles]
 */
private void initAPIRouter() {
	Router router = getAPIRouter();
	if (Mesh.mesh().getOptions().getHttpServerOptions().isCorsEnabled()) {
		router.route().handler(corsHandler);
	}

	router.route().handler(rh -> {
		// Connection upgrade requests never end and therefore the body
		// handler will never
		// pass through to the subsequent route handlers.
		if ("websocket".equalsIgnoreCase(rh.request().getHeader("Upgrade"))) {
			rh.next();
		} else {
			bodyHandler.handle(rh);
		}
	});
	router.route().handler(CookieHandler.create());

}
 
开发者ID:gentics,项目名称:mesh,代码行数:24,代码来源:RouterStorage.java

示例8: start

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void start() {
    Router router = Router.router(vertx);

    router.route().handler(CookieHandler.create());
    router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));

    AuthProvider authProvider = ShiroAuth.create(vertx, ShiroAuthRealmType.PROPERTIES, new JsonObject());
    router.route().handler(UserSessionHandler.create(authProvider));
    router.route("/private/*").handler(RedirectAuthHandler.create(authProvider, "/login.html"));

    router.mountSubRouter("/tokens", tokenRouter(authProvider));
    router.mountSubRouter("/api", auctionApiRouter());

    router.route().failureHandler(ErrorHandler.create(true));
    router.route("/private/*").handler(staticHandler("private"));
    router.route().handler(staticHandler("public"));

    vertx.createHttpServer().requestHandler(router::accept).listen(8080);
}
 
开发者ID:mwarc,项目名称:atm8-realtime-auctions-example,代码行数:21,代码来源:AuctionFrontendVerticle.java

示例9: start

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void start() {
    Router router = Router.router(vertx);

    router.route().handler(CookieHandler.create());
    router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));

    AuthProvider authProvider = ShiroAuth.create(
        vertx,
        new ShiroAuthOptions().setType(ShiroAuthRealmType.PROPERTIES).setConfig(new JsonObject())
    );
    router.route().handler(UserSessionHandler.create(authProvider));
    router.route("/private/*").handler(RedirectAuthHandler.create(authProvider, "/login.html"));

    router.mountSubRouter("/tokens", tokenRouter(authProvider));
    router.mountSubRouter("/api", auctionApiRouter());

    router.route().failureHandler(ErrorHandler.create(true));
    router.route("/private/*").handler(staticHandler("private"));
    router.route().handler(staticHandler("public"));

    vertx.createHttpServer().requestHandler(router::accept).listen(8080);
}
 
开发者ID:mwarc,项目名称:realtime-auctions-vertx3-example,代码行数:24,代码来源:AuctionFrontendVerticle.java

示例10: setUp

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
  super.setUp();
  client = vertx.createHttpClient(new HttpClientOptions().setDefaultPort(8080));
  router = Router.router(vertx);
  router.route().handler(CookieHandler.create());
  router.route()
      .handler(SessionHandler.create(LocalSessionStore.create(vertx))
          .setNagHttps(false)
          .setSessionTimeout(60 * 60 * 1000));
  addHandlersBeforeSockJSHandler(router);
  SockJSHandlerOptions options = new SockJSHandlerOptions().setHeartbeatInterval(2000);
  sockJSHandler = SockJSHandler.create(vertx, options);
  router.route("/test/*").handler(sockJSHandler);
  server = vertx.createHttpServer(new HttpServerOptions().setPort(8080).setHost("localhost"));
  CountDownLatch latch = new CountDownLatch(1);
  server.requestHandler(router::accept).listen(ar -> latch.countDown());
  awaitLatch(latch);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:20,代码来源:SockJSTestBase.java

示例11: init

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void init(Router router) {
  String regex = "/api/([^\\\\/]+)/([^\\\\/]+)/(.*)";
  router.routeWithRegex(regex).handler(CookieHandler.create());
  router.routeWithRegex(regex).handler(createBodyHandler());
  router.routeWithRegex(regex).failureHandler(this::onFailure).handler(this::onRequest);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:8,代码来源:EdgeDispatcher.java

示例12: mount

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void mount(final Router router) {
    // 1. Cookie, Body
    router.route()
            .order(Orders.COOKIE)
            .handler(CookieHandler.create());
    router.route()
            .order(Orders.BODY)
            .handler(BodyHandler.create());
    // 2. Cors Template Solution
    router.route()
            .order(Orders.CORS)
            .handler(CorsHandler.create("*")
                    .allowCredentials(false)
                    .allowedHeaders(new HashSet<String>() {
                        {
                            add(HttpHeaders.AUTHORIZATION);
                            add(HttpHeaders.CONTENT_LENGTH);
                            add(HttpHeaders.CONTENT_TYPE);
                        }
                    })
                    .allowedMethods(new HashSet<HttpMethod>() {
                        {
                            add(HttpMethod.DELETE);
                            add(HttpMethod.GET);
                            add(HttpMethod.POST);
                            add(HttpMethod.PUT);
                        }
                    }));

}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:32,代码来源:RouterAxis.java

示例13: VertxNubes

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
/**
 * @param vertx the vertx instance
 */
public VertxNubes(Vertx vertx, JsonObject json) {
  this.vertx = vertx;
  config = Config.fromJsonObject(json, vertx);
  deploymentIds = new ArrayList<>();
  registry = new ParameterAdapterRegistry();
  marshallers = new HashMap<>();
  config.setMarshallers(marshallers);
  config.createAnnotInjectors(registry);

  // marshalling
  TemplateEngineManager templManager = new TemplateEngineManager(config);
  registerAnnotationProcessor(View.class, new ViewProcessorFactory(templManager));
  registerAnnotationProcessor(File.class, new FileProcessorFactory());
  registerMarshaller("text/plain", new PlainTextMarshaller());
  registerMarshaller("application/json", new JacksonPayloadMarshaller());
  String domainPackage = config.getDomainPackage();
  if (domainPackage != null) {
    try {
      Reflections reflections = new Reflections(domainPackage, new SubTypesScanner(false));
      registerMarshaller("application/xml", new JAXBPayloadMarshaller(reflections.getSubTypesOf(Object.class)));
    } catch (JAXBException je) {
      throw new VertxException(je);
    }
  }
  failureHandler = new DefaultErrorHandler(config, templManager, marshallers);

  // default processors/handlers
  CookieHandler cookieHandler = CookieHandler.create();
  registerAnnotationHandler(Cookies.class, cookieHandler);
  registerAnnotationHandler(CookieValue.class, cookieHandler);
  registerAnnotationHandler(Throttled.class, RateLimitationHandler.create(config));
  registerTypeProcessor(PaginationContext.class, new PaginationProcessor());
  registerTypeProcessor(Payload.class, new PayloadTypeProcessor(marshallers));
  registerAnnotationProcessor(Redirect.class, new ClientRedirectProcessorFactory());
  registerAnnotationProcessor(ContentType.class, new ContentTypeProcessorFactory());
  registerAnnotationProcessor(Logout.class, new LogoutProcessor());
}
 
开发者ID:aesteve,项目名称:nubes,代码行数:41,代码来源:VertxNubes.java

示例14: startWebServer

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
/**
 * Start a web server to define a standard set of endpoints for testing, and provide extension points for both
 * decorating/configuring the auth handler, and also for configuring the router (for example adding additional
 * endpoints)
 * @param baseAuthUrl - the baseline authentication url
 * @param options - SecurityHandler options for configuring the main security handler
 * @param callbackHandlerOptions - CallbackHandlerOptions for configuring the callback handler
 * @param requiredPermissions - list of required permissions to access the protected endpoint
 * @param routerDecorator - modifications to the router (for example addition of custom endpoints for a test
 * @throws Exception - any exception when running this code should trigger test failure
 */
protected void startWebServer(final String baseAuthUrl,
                              final SecurityHandlerOptions options,
                              final CallbackHandlerOptions callbackHandlerOptions,
                              final List<String> requiredPermissions,
                              final BiConsumer<Router, Config> routerDecorator) throws Exception {
    final Router router = Router.router(vertx);
    final Pac4jAuthProvider authProvider = new Pac4jAuthProvider();
    final SessionStore sessionStore = sessionStore();
    final Config config = config(clients(baseAuthUrl), requiredPermissions);
    config.setHttpActionAdapter(new DefaultHttpActionAdapter());

    router.route().handler(CookieHandler.create());
    router.route().handler(sessionHandler(sessionStore));
    router.route().handler(UserSessionHandler.create(authProvider));

    CallbackDeployingPac4jAuthHandler pac4jAuthHandler = authHandler(router,
            authProvider,
            baseAuthUrl,
            options,
            callbackHandlerOptions,
            requiredPermissions);

    routerDecorator.accept(router, config);

    startWebServer(router, pac4jAuthHandler);
}
 
开发者ID:pac4j,项目名称:vertx-pac4j,代码行数:38,代码来源:StatefulPac4jAuthHandlerIntegrationTestBase.java

示例15: init

import io.vertx.ext.web.handler.CookieHandler; //导入依赖的package包/类
@Override
public void init(Router router) {
  router.route().handler(CookieHandler.create());
  router.route().handler(createBodyHandler());
  router.route().failureHandler(this::failureHandler).handler(this::onRequest);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:7,代码来源:VertxRestDispatcher.java


注:本文中的io.vertx.ext.web.handler.CookieHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。