欢迎光临,欧冠竞猜买球-欧冠竞猜买球|官方网站!
 066-45426602

工程业绩-SCEG

立足品质  重誉守信   创优争先    追求卓越

欧冠竞猜买球|Gutty 0.14.9 发布,基于 Guice 和 Netty 的网络服务框架
本文摘要:欧冠竞猜买球,欧冠竞猜买球官方网站,GETPath"/redis/read"Produces"application/json"publicUserreadRedis{Useruser=userRedis}GETPath"/redis/write"Produces"application/json"publicUserwriteRedis{Useruser=newUser;

欧冠竞猜买球官方网站

一直很喜欢Netty和Guice,简易功能强大,一直想亲自动手来整合她们。Gutty大约用了一个月的時间来做,参照Spring中一些习惯性,根据扫描包进行路由器,依靠,长连接配置,或者全自动给Controller传送值。也预设了模板,Redis和Mybatis的方便快捷连接,能够按URI来添加好几个Filter,后边还会继续再次的健全和添加方便快捷的作用。

欧冠竞猜买球

作用目录和进行情况短连接*[√]Guice和Netty整合*[√]启动扫描包,为Controller和Socket的类配置路由器*[√]全自动关联扫描到的Service的类一般的关联和按名字关联*[√]PostGetDeletePut的httpMethod支持*[√]根据Product鉴别传参是Json或是模板,或者Protobuf或者Binary*[√]操纵类下的方式主要参数传到,支持CookieParmQueryParamPathParamFormParam*[√]Controller鉴别和輸出Json要求*[√]Controller鉴别Protobuf要求*[√]能够根据FileParam来文件上传*[√]支持模板,预设Freemarker和Thymeleaf的连接*[√]支持RequestAttribute,能够用于出示Session作用*[√]兼容uri的Filter支持Websocket*[√]整合Websocket,根据Socket特定类接受长连接数据信息*[√]Websocket的路由器根据类的Path进行配置*[√]支持OpenCloseMessageTextMessageBinaryMessagePingPong进行不一样数据文件的传送*[√]长连接WebsocketFrame的值可全自动传到到你的sockethandler*[√]添加protobuf,json的自动编号,编解码到自变量*[√]兼容uri的Filter支持*[].9compile'com.doopp:gutty:'运行GuttypublicstaticvoidmainString[]args{newGutty.loadPropertiesargs//载入配置文档//设置扫描的包途径.setBasePackages".test"//Json支持.setMessageConverterJacksonMessageConverter.class//模板支持.setViewResolverFreemarkerViewResolver.class//添加Filter.addFilter"/api",ApiFilter.class//配置数据库查询,必须引进guice-mybatis包.setMyBatisHikariCPProvider.class,".test.dao",PageInterceptor.class//配置好几个redis.addModulesnewRedisModule{Overrideprotectedvoidinitialize{bindJedisPoolConfigProviderJedisPoolConfigProvider.class;bindSerializableHelperJdkSerializableHelper.class;}SingletonProvidesNamed"userRedis"publicShardedJedisHelperuserRedisJedisPoolConfigjedisPoolConfig,SerializableHelperserializableHelper,Named""StringuserServers{returnnewShardedJedisHelperuserServers,jedisPoolConfig,serializableHelper;}SingletonProvidespublicShardedJedisHelpertestRedisJedisPoolConfigjedisPoolConfig,SerializableHelperserializableHelper,Named""StringuserServers{returnnewShardedJedisHelperuserServers,jedisPoolConfig,serializableHelper;}}//进行injector配置后,实行里边的编码,多用以每日任务的实行.addInjectorConsumerinjector->{ScheduledExecutorServicenewScheduledThreadPool=Executors.newScheduledThreadPool8;newScheduledThreadPool.scheduleWithFixedDelayinjector.getInstanceAgarTask.class,1000,16,TimeUnit.MILLISECONDS;}.start;}Controller类Path"/api"ControllerpublicclassHelloController{privatestaticfinalLoggerlogger=LoggerFactory.getLoggerHelloController.class;InjectprivateHelloServicehelloService;InjectprivateUserDaouserDao;InjectNamed"userRedis"privateShardedJedisHelperuserRedis;GETPath"/redis/read"Produces"application/json"publicUserreadRedis{Useruser=userRedis.get"user_redis".getBytes,User.class;returnuser;}GETPath"/redis/write"Produces"application/json"publicUserwriteRedis{Useruser=newUser;user.setIdSystem.currentTimeMillis;userRedis.set"user_redis".getBytes,user;returnuser;}GETPath"/template"publicStringtemplateModelMapmodelMap{modelMap.addAttribute"hello","hellofreemarker!";return"hello.template";}GETPath"/hello"Produces"application/json"publicStringhelloCookieParam"user"Stringuser{returnhelloService.hello;}GETPath"/users"Produces"application/json"publicListusersRequestAttribute"hello"Stringhello{hello;returnuserDao.selectAll;}GETPath"/hello/{id}/{name}"publicStringhello3pathParam"id"Integerid,PathParam"name"Stringname{logger.info"id{}",id;logger.info"name{}",name;returnhelloService.hello;}POSTPath"/hello"Produces"application/json"publicUserhello2FormParam"liu"Stringliu{logger.info"liu{}",liu;Useruser=newUser;user.setNickNameliu;returnuser;}POSTPath"/json"Produces"application/json"publicUserhello2Useruser{logger.info"user{}",user;returnuser;}POSTPath"/upload"Produces"application/json"publicStringuploadFileParamvalue="file",path="d:/tmp"FileuploadFile{logger.info"file{}",uploadFile;return"hello";}}Service类//HelloService.javapublicinterfaceHelloService{Stringhello;}//HelloServiceImpl.javaServicepublicclassHelloServiceImplimplementsHelloService{OverridepublicStringhello{return"hellokunlun!";}}Websocket类SocketPath"/ws/game"publicclassHelloSocket{privatestaticfinalLoggerlogger=LoggerFactory.getLoggerHelloSocket.class;OpenpublicvoidonConnectChannelchannel{channel.writeAndFlushnewTextWebSocketFrame"youconnected";}TextMessagepublicvoidonTextMessageChannelchannel{channel.writeAndFlushnewTextWebSocketFrame"hello";}TextMessagepublicvoidonJsonMessageJsonFrameUseruser{logger.info"user{}",user.getNickName;}BinaryMessagepublicvoidonBinaryMessageBinaryWebSocketFramebinaryWebSocketFrame{logger.info"binaryFrame{}",binaryWebSocketFrame.content;}BinaryMessagepublicvoidonProtobufMessageProtobufFrameUseruser{logger.info"user{}",user;}//Message//publicvoidonMessageWebSocketFramewebSocketFrame{//logger.info"onMessage:{}",webSocketFrame.getClass;//}PingpublicvoidonPing{}PongpublicvoidonPong{}ClosepublicvoidonClose{}}。

欧冠竞猜买球

欧冠竞猜买球


本文关键词:欧冠竞猜买球,欧冠竞猜买球官方网站

本文来源:欧冠竞猜买球-www.city-talks.com

上一篇:GRUB2【欧冠竞猜买球】
下一篇:SpringCloudGreenwich【欧冠竞猜买球官方网站】

Copyright © Copyright 2017-2018 欧冠竞猜买球