10 2013 档案
Netty Associated -- Channel
摘要:A nexus to a network socket or a component which is capable of I/O operations such as read, write, connect, and bind.一个网络套接字或组件的枢纽, 用来进行 I/O 操作, 例如 read, write, connect, bind.A channel provides a user:一个Channel的提供给用户的东西有:the current state of the channel (e.g. is it open? is it connected?),channel目前的
阅读全文
Netty Associated -- ChannelPipeline
摘要:A list of ChannelHandlers which handles or intercepts inbound events and outbound operations of a Channel. ChannelPipeline implements an advanced form of the Intercepting Filter pattern to give a user full control over how an event is handled and how the ChannelHandlers in a pipeline interact with e
阅读全文
使用Idea创建多Module工程
摘要:1. 点击 New -- Project2. 设置工程父Pom, 如下 4.0.0 org.test test-parent 1.0.0.Beta com.google.guava guava 15.0 3. 删除父工程Src并创建子Module, 点击 New -- Module4. 将子module的java和resource目录设置为source目录右击java和resource目录, 选择 Mark Directory As -- Source Roo...
阅读全文
User guide for Netty 4.x
摘要:Table of ContentsPrefaceThe SolutionGetting StartedBefore Getting StartedWriting a Discard ServerLooking into the Received DataWriting an Echo ServerWriting a Time ServerWriting a Time ClientDealing with a Stream-based TransportSpeaking in POJO instead of ByteBufShutting Down Your ApplicationSummary
阅读全文
RFC 868 -- TIME Protocol
摘要:INTERNET STANDARD Errata ExistNetwork Working Group J. Postel - ISIRequest for Comments: 868 K. Harrenstien - SRI Ma...
阅读全文
Netty Associated -- ByteBuf
摘要:ByteBufByteBuf是Netty的Server与Client之间通信的数据传输载体.他提供了一个byte数组(byte[])的抽象视图buffer创建我们推荐通过一个Unpooled的帮助方法来创建新的buffer而不是通过调用独立的构造器来创建随机访问索引就像普通的原声字节数组一样, By...
阅读全文
Spring Test, JUnit, Mockito, Hamcrest 集成 Web 测试
摘要:关于Spring 3.21. Spring 3.2 及以上版本自动开启检测URL后缀,设置Response content-type功能, 如果不手动关闭这个功能,当url后缀与accept头不一致时, Response的content-type将会和request的accept不一致,导致报406关闭URL后缀检测的方法如下 2. Spring-Test框架无法应用关闭Spring自动URL后缀检测的设置, 且StandaloneMockMvcBuilder将设置favorPathExtendsion属性的方法设置为protected即 ...
阅读全文
字符串解析与集合过滤的抽象
摘要:问题如下假设我们有一个类HotelCenter,它有方法List getHotelList(String city)可以获得一个城市下所有酒店列表Hotel类有如下属性String name, String address, int price, Map properties酒店的非name和address的属性都可以通过properties.get(key)得到我们需要实现以下功能根据页面传入的参数返回对应的酒店列表,参数键值对会以&分割,参数的值如果有多个,会有逗号分隔下述任何参数都可能缺失,对应的值如果为空串,也当做该参数不存在处理参数会分三部分组成,过滤参数、排序参数和翻页参数
阅读全文
Unit Testing of Spring MVC Controllers: “Normal” Controllers
摘要:Original link:http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-mvc-controllers-normal-controllers/Unit Testing of Spring MVC Controllers: “Normal” ControllersbyPETRI KAINULAINENonJULY 7, 2013The first part of this tutorial described how we canconfigure our unit tes
阅读全文
Unit Testing of Spring MVC Controllers: Configuration
摘要:Original Link:http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-mvc-controllers-configuration/Unit Testing of Spring MVC Controllers: ConfigurationbyPETRI KAINULAINENonJUNE 28, 2013Writing unit tests for Spring MVC controllers has traditionally been both simple and
阅读全文
Chapter 7 -- Functional
摘要:Caveats说明As of Java 7, functional programming in Java can only be approximated through awkward and verbose use of anonymous classes. This is expected to change in Java 8, but Guava is currently aimed at users of Java 5 and above.在Java7中, 只能通过笨拙且啰嗦的使用匿名类来模拟函数式编程.在Java 8中这些亟待改变, 但Guava现在的目标是Java5及以上用户
阅读全文
字符串文本替换程序
摘要:今天看到关于移到关于字符串查找和替换的题目, 如下:现有2个文件,地址在:http://***.com/sites/task3.propertieshttp://***.com/sites/task3.txt要求:根据properties中内容替换掉txt里$function(index)形式文字,将其还原成一本完整小说。其中function有4种函数,替换规则如下:1、natureOrder 自然排序,即文本中排列顺序2、indexOrder 索引排序,文本中每行第一个数字为索引3、charOrder 文本排序(Java默认的Unicode排序),java的字符排序4、charOrderDE
阅读全文
Reloading Java Classes 301: Classloaders in Web Development — Tomcat, GlassFish, OSGi, Tapestry 5 and so on Translation
摘要:The Original link :http://zeroturnaround.com/rebellabs/rjc301/Copyright reserved by Rebel IncIn this article we’ll review how dynamic classloaders are used in real servers, containers and frameworks to reload Java classes and applications. We’ll also touch on how to get faster reloads and redeploys
阅读全文
Chapter 6 -- Caches
摘要:CachesExplainedExplanation for how to use Guava caches.explainedUpdatedJun 4, 2013bylowas...@google.comExampleLoadingCache graphs =CacheBuilder.newBuilder() .maximumSize(1000) .expireAfterWrite(10,TimeUnit.MINUTES) .removalListener(MY_LISTENER) .build( newCacheLoader(){ publicGraph ...
阅读全文
SVN OPS发布总结
摘要:提示不需要手动将branch合并到trunk, 我们自己没有这个权限, 合并的操作是在beta版本发布完成以后, 使用这个btag来发布ops问题1. 由于trunk版本长时间没有发不过ops版本, 发布ops版本(基于prod4的branch版本)后造成svn认为trunk版本比branch版本更新, branch版本在发QA的时候bds提示需要将trunk合并到branch, QA发布失败2. 在将trunk合并到branch的过程中, 出现大量树冲突(原因不明: 个人认为既然是用prod4发的OPS, 那么bds就不应该认为trunk比prod4还新. 而且我对出现冲突的文件做过比较,
阅读全文
Chapter 5 -- ImmutableCollections
摘要:Examplepublicstatic final ImmutableSet COLOR_NAMES =ImmutableSet.of( "red", "orange", "yellow", "green", "blue", "purple");classFoo{ Set bars; Foo(Set bars){ this.bars =ImmutableSet.copyOf(bars);// defensive copy! }}Why?Immutable objects ha
阅读全文