??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲日韩国产一区二区三区,亚洲永久无码3D动漫一区,中文字幕精品无码亚洲字http://www.tkk7.com/usherlight/category/7458.html天^׃白云泉,云自无心水自闌Ӏ何必奔冲山下去Q更LL向人间Q?/description>zh-cnThu, 08 Sep 2016 16:01:43 GMTThu, 08 Sep 2016 16:01:43 GMT60Selenium 下蝲文ghttp://www.tkk7.com/usherlight/archive/2016/01/28/429241.html云自无心水自?/dc:creator>云自无心水自?/author>Thu, 28 Jan 2016 10:06:00 GMThttp://www.tkk7.com/usherlight/archive/2016/01/28/429241.htmlhttp://www.tkk7.com/usherlight/comments/429241.htmlhttp://www.tkk7.com/usherlight/archive/2016/01/28/429241.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/429241.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/429241.html
我在|上搜烦了一下如何用Selenium下蝲文gQ其中确实有几篇文g介绍了实现的Ҏ(gu)?br />但是其主要思想都是使用httpClient或者URL获得InputStream, 然后保存到文件中?br />但是Q其中的问题是用L录的Session不能l持?br />
我发C一个简单的Ҏ(gu)?br />直接使用WebDriver.get, CZ如下Q?br />
webDriver.get("https://website.com/login");
WebElement element = driver.findElement( By.id( "userID" ) );
element.sendKeys( "user01" );

element = driver.findElement( By.id( "passwd" ) );
element.sendKeys( "password" );

element = driver.findElement( By.name( "Login" ) );
element.submit();

webDriver.get("https://website.cm/download.do?start=xx&end=yy");
String source = webDriver.getPageSource();

q个source是我们想保存的要下载的内容?br />只要把这个String写到一个文件中Q就实现了文件下载的目的

]]>
openpgp 验证{֐http://www.tkk7.com/usherlight/archive/2015/12/11/428624.html云自无心水自?/dc:creator>云自无心水自?/author>Fri, 11 Dec 2015 13:40:00 GMThttp://www.tkk7.com/usherlight/archive/2015/12/11/428624.htmlhttp://www.tkk7.com/usherlight/comments/428624.htmlhttp://www.tkk7.com/usherlight/archive/2015/12/11/428624.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/428624.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/428624.html加密解密的基本操作流E是Q用户用公钥对明文q行加密Q解密方使用U钥对密文进行解密?

在实际应用中Q除了加密保证文本内容不泄露外,同时q要考虑能够验证密文发送方的n份,比较普遍使用的方法就是签名?
本文主要对具体的Ҏ(gu)q行介绍q上源代码?nbsp; 阅读全文

]]>
解决apache james 3.0 Beta5不能发送邮件的问题http://www.tkk7.com/usherlight/archive/2015/10/08/427661.html云自无心水自?/dc:creator>云自无心水自?/author>Thu, 08 Oct 2015 00:45:00 GMThttp://www.tkk7.com/usherlight/archive/2015/10/08/427661.htmlhttp://www.tkk7.com/usherlight/comments/427661.htmlhttp://www.tkk7.com/usherlight/archive/2015/10/08/427661.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/427661.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/427661.html解压Q运行run.bat

然后Q注册domain
james-cli --host localhost adddomain example.com
d用户
james-cli.bat --host localhost adduser testQexample.com password

然后试发送邮Ӟ客户端显C发送成功,但是james服务器报错,找不到MimeConfig的无参数构造函数?br />解决Ҏ(gu)Q?br />使用旧的mime4j的jar包替换james 3.0 beta5中自带的最新包?br />beta5中自带的?.8.0版,apache|站中可以下载到0.7.2
下蝲apache-mime4j-0.7.2-bin.zip, 其中的apache-mime4j-core-0.7.2.jar, apache-mime4j-dom-0.7.2.jar复制到james\lib目录Q?br />q将其更名覆盖原有的
apache-mime4j-core-0.8.0-20150617.024907-738.jar
apache-mime4j-dom-0.8.0-20150617.024927-735.jar
重新启动jamesQ?发送邮Ӟ 成功?br />

]]>
单介l如何用PowerMock和Mockito来mock 1. 构造函?2. 静态函?3. 枚D实现的单?4. 选择参数值做为函数的q回?/title><link>http://www.tkk7.com/usherlight/archive/2015/06/16/425740.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Tue, 16 Jun 2015 13:27:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2015/06/16/425740.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/425740.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2015/06/16/425740.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/425740.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/425740.html</trackback:ping><description><![CDATA[本文简单介l如何用PowerMock和Mockito来mock<br /> 1. 构造函?br /> 2. 静态函?br /> 3. 枚D实现的单?br /> 4. 选择参数值做为函数的q回?br /> 5. 在调用mock出来的方法中,改变Ҏ(gu)参数的?br /> <br /> 一点简要说明:Mockito其实已经可以满大部分的需求,但是它的实现机制是用cglib来动态创建接口的cȝ实例。但是这U实现方式不能用于构造函数和静态函敎ͼ因ؓ那需要用类的字节码Q比如用javassist). 所以我们才需要结合用PowerMock.<br /> <br /> 1. mock构造函? 如果有代码没有用DI注入依赖实例Q在单元试中可以用PowerMock来模拟创建对象?br /> 注意的开始两行的2个注?@RunWith ?@PrepareForTest<br /> @RunWith比较单,后面始终是PowerMockRunner.class<br /> @PrepareForText后面需要加的是调用构造函数的cdQ而不是有构造函数的cLw?br /> 在下面的例子中,我们要测试的cLQHelper, 在HelpercM调用了Somthingcȝ构造函数来创徏实例?br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000; ">@RunWith(PowerMockRunner.</span><span style="color: #0000FF; ">class</span><span style="color: #000000; ">)<br /> @PrepareForTest(Helper.</span><span style="color: #0000FF; ">class</span><span style="color: #000000; ">)<br /> </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> HelperTest {<br />   @Mock<br />   </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> Something mockSomething;<br />       <br />   @InjectMocks<br />   </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> Helper helper;<br />       <br />   @Test<br />   </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> doSomething() </span><span style="color: #0000FF; ">throws</span><span style="color: #000000; "> Exception {<br />       String argument </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">"</span><span style="color: #000000; ">arg</span><span style="color: #000000; ">"</span><span style="color: #000000; ">;<br />           <br />       PowerMockito.whenNew(Something.</span><span style="color: #0000FF; ">class</span><span style="color: #000000; ">).withArguments(argument).thenReturn(mockSomething);<br />           <br />       // 调用需要测试方?br />       helper.doSomething(argument);<br />           <br />       // q行验证<br />       verify(mockSomething).doIt();<br />   }<br /> }<br /> <br /> <br /> <div>public class Helper ?br />   public void doSomething(String arg) {<br />       Something something = new Something(arg);<br />       something.doit();<br />   }<br /> }</div> <br /> </span></div> <br /> 2Qmock 静态函敎ͼ 单例模式是一个典型的会调用静态函数的例子?注意要点与mock构造函数相同?br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000FF; ">class</span><span style="color: #000000; "> ClassWithStatics {<br />   </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> String getString() {<br />     </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">"</span><span style="color: #000000; ">String</span><span style="color: #000000; ">"</span><span style="color: #000000; ">;<br />   }<br /> <br />   </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> getInt() {<br />     </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />   }<br /> }<br /> <br /> @RunWith(PowerMockRunner.</span><span style="color: #0000FF; ">class</span><span style="color: #000000; ">)<br /> @PrepareForTest(ClassWithStatics.</span><span style="color: #0000FF; ">class</span><span style="color: #000000; ">)<br /> </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> StubJustOneStatic {<br />   @Test<br />   </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> test() {<br />     PowerMockito.mockStatic(ClassWithStatics.</span><span style="color: #0000FF; ">class</span><span style="color: #000000; ">);<br /> <br />     when(ClassWithStatics.getString()).thenReturn(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">Hello!</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br /> <br />     System.out.println(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">String: </span><span style="color: #000000; ">"</span><span style="color: #000000; "> </span><span style="color: #000000; ">+</span><span style="color: #000000; "> ClassWithStatics.getString());<br />     System.out.println(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">Int: </span><span style="color: #000000; ">"</span><span style="color: #000000; "> </span><span style="color: #000000; ">+</span><span style="color: #000000; "> ClassWithStatics.getInt());<br />   }<br /> }</span></div> <br /> 3。mock枚D实现的单?br /> <div> SingletonObject.java <br /> <pre prettyprint="" prettyprinted"="" style="margin: 0px 0px 1em; padding: 5px; border: 0px; font-size: 13px; overflow: auto; width: auto; max-height: 600px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; display: block; color: #393318; word-wrap: normal; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #eeeeee;"><code style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; background-color: #eeeeee;"><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">public</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">enum</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">SingletonObject</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">{</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> <br />    INSTANCE</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">;</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;"><br />    private</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">int</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> num</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">;</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;"><br />    protected</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">void</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> setNum</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">int</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> num</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">)</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">{</span> <br />        <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">this</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">num </span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">=</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> num</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">;</span> <br />    <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">}</span> <br />    <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">public</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">int</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> getNum</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">()</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">{</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;"><br />        return</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> num</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">;</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"><br />    }</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> <br /></span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">}<br /> <span style="font-family: verdana, 'courier new'; font-size: 14px;">SingletonConsumer.java</span> </span></code></pre> <br /> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">public</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">class</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">SingletonConsumer</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">{</span> <br /> <pre prettyprint="" prettyprinted"="" style="margin: 0px 0px 1em; padding: 5px; border: 0px; font-size: 13px; overflow: auto; width: auto; max-height: 600px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; display: block; color: #393318; word-wrap: normal; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #eeeeee;"><code style="margin: 0px; padding: 0px; border: 0px none; font-size: 13px; font-family: Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif; white-space: inherit; background-color: #eeeeee;">    <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">public</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">String</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> consumeSingletonObject</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">()</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">{</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;"><br />         return</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">String</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">valueOf</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">SingletonObject</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">INSTANCE</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">getNum</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">());</span> <br />     <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">}</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> <br /></span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">}<br /> <div>SingletonConsumerTest.java</div></span></code></pre><pre prettyprint="" prettyprinted"="" style="margin: 0px 0px 1em; padding: 5px; border: 0px none; font-size: 13px; overflow: auto; width: auto; max-height: 600px; font-family: Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif; display: block; color: #393318; word-wrap: normal; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; background-color: #eeeeee;"><code style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; background-color: #eeeeee;"><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #800000;">@RunWith</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">PowerMockRunner</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">class</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">)</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> <br /></span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #800000;">@PrepareForTest</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">({</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">SingletonObject</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">class</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">})</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> <br /></span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">public</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">class</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">SingletonConsumerTest</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">{</span> <br />    <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #800000;">@Test</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">public</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">void</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> testConsumeSingletonObject</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">()</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">throws</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">Exception</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">{</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;"><br />        SingletonObject</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> mockInstance </span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">=</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> mock</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">SingletonObject</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">class</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">);</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;"><br />        Whitebox</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">setInternalState</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">SingletonObject</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">class</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">,</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #800000;">"INSTANCE"</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">,</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> mockInstance</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">);</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> <br />        when</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">mockInstance</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">getNum</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">()).</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">thenReturn</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #800000;">42</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">);</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> <br />        assertEquals</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #800000;">"42"</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">,</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #00008b;">new</span> <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #2b91af;">SingletonConsumer</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">().</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">consumeSingletonObject</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">());</span> <br />    <span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">}</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;"> <br /></span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">}</span></code></pre> </div> 4。返回参数值做为函数返回倹{?br /> mockito 1.9.5之后Q提供一个方便的Ҏ(gu)来实现这个需要,在这之前可以使用一个匿名函数来q回一个answer来实现?br /> <div> <pre prettyprint="" prettyprinted"="" style="margin: 0px 0px 1em; padding: 5px; border: 0px; font-size: 13px; overflow: auto; width: auto; max-height: 600px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; display: block; color: #393318; word-wrap: normal; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #eeeeee;"><code style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; background-color: #eeeeee;"><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">when</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">myMock</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">myFunction</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">anyString</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">())).</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">then</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">returnsFirstArg</span><span style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: #000000;">());</span></code></pre> </div> 其中returnsFirstArg()是org.mockito.AdditionalAnswers中的一个静态方法?br /> 在这个类中还有其他的一些类似方?br /> returnsSecondArg()<br /> <div>returnsLastArg()</div> <div>ReturnsArgumentAt(int position)</div> <br /> <div>5. 在调用mock出来的方法中,改变Ҏ(gu)参数的?br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000; ">when( myMock.someMethod( any( List.</span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> ) ) ).thenAnswer( ( </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> Answer</span><span style="color: #000000; "><</span><span style="color: #000000; ">Void</span><span style="color: #000000; ">></span><span style="color: #000000; ">() {<br />     @Override<br />     </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> Void answer( InvocationOnMock invocation )<br />             </span><span style="color: #0000FF; ">throws</span><span style="color: #000000; "> Throwable {<br />         Object[] args </span><span style="color: #000000; ">=</span><span style="color: #000000; "> invocation.getArguments();<br />         List arg1 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (List)args[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">];<br />         arg1.add(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">12345</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />         </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">null</span><span style="color: #000000; ">;<br />     }<br /> } ) );<br /> <br /> </span></div> </div> <br /> <br /> <div>Verifying with generic parameters<br /> <span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">verify</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">(</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">someService</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">).</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">process</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">(</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; color: #2b91af; background-color: #eeeeee;">Matchers</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">.<</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; color: #2b91af; background-color: #eeeeee;">Collection</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;"><</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; color: #2b91af; background-color: #eeeeee;">Person</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">>></span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">any</span><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; background-color: #eeeeee;">());<br /><div>verify(adunoMasterBaseProcessor).processBinFiles( anyListOf(File.class) );</div></span></div><img src ="http://www.tkk7.com/usherlight/aggbug/425740.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2015-06-16 21:27 <a href="http://www.tkk7.com/usherlight/archive/2015/06/16/425740.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>要说明如何在eclipse中的tomcat中进行配|用springloaded在热加蝲更改的类http://www.tkk7.com/usherlight/archive/2015/06/11/425640.html云自无心水自?/dc:creator>云自无心水自?/author>Thu, 11 Jun 2015 13:59:00 GMThttp://www.tkk7.com/usherlight/archive/2015/06/11/425640.htmlhttp://www.tkk7.com/usherlight/comments/425640.htmlhttp://www.tkk7.com/usherlight/archive/2015/06/11/425640.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/425640.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/425640.htmlTomcat都需要重新启动来使得刚才的更改生效?br />而JRebel和springloaded都能有效地解册个问题。其中springloaded是开源YӞ可以免费使用Q尤光得?br />其主:https://github.com/spring-projects/spring-loaded
在官斚w面的单介l中Q作者只讲述了如何在javaE序中应用springloadedQ而没有说明如何在tomcat中进行配|?br />本文简要进行介l?br />
1Q下载springloaded到本地目录,比如Qc:\temp\springloaded-1.2.3.RELEASE.jar

2. 修改tomcat的应用,止tomcat自己的热加蝲Q方法是在META-INF目录下创建context.xml文gQ里面包含如下语句,关键便是其中讄reloadable为false
<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" useHttpOnly="true" reloadable="false" />

3.在运行环境中dspringloaded的jar文gQ在eclipse中右键点击项目,run as->run configuration
在弹出的H口中,选择Arguments标签Q在vm arguments的末添加:
-javaagent:C:\temp\springloaded-1.2.3.RELEASE.jar -noverify
点击应用按钮?br />
以上便完成了所有的配置Q步骤ƈ不复杂?br />

]]>
使用VisualVM来监控包装ؓwindows服务的javaE序http://www.tkk7.com/usherlight/archive/2015/06/11/425624.html云自无心水自?/dc:creator>云自无心水自?/author>Thu, 11 Jun 2015 06:09:00 GMThttp://www.tkk7.com/usherlight/archive/2015/06/11/425624.htmlhttp://www.tkk7.com/usherlight/comments/425624.htmlhttp://www.tkk7.com/usherlight/archive/2015/06/11/425624.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/425624.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/425624.htmlq且可以通过单的配置来允怋用visualVMq行监控?br />
配置Ҏ(gu)Q?br />在wrapper.conf中添加如??br />
wrapper.java.additional.1=-Dcom.sun.management.jmxremote.port=9898 Q这里的端口号可以自行选择?br />wrapper.java.additional.2=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional.3=-Dcom.sun.management.jmxremote.authenticate=false

修改完毕保存后重新启动服务?br />
打开visualVM, 在菜单中选择 file->Add JMX Connection?br />在弹出窗口中Qconnection一中输入Q?localhost:9898 卛_?br />
此配|对于jconsole也同h效?img src ="http://www.tkk7.com/usherlight/aggbug/425624.html" width = "1" height = "1" />

]]>
java.util.logging的日志统一输出到slf4j的框架中http://www.tkk7.com/usherlight/archive/2015/04/27/424701.html云自无心水自?/dc:creator>云自无心水自?/author>Mon, 27 Apr 2015 07:31:00 GMThttp://www.tkk7.com/usherlight/archive/2015/04/27/424701.htmlhttp://www.tkk7.com/usherlight/comments/424701.htmlhttp://www.tkk7.com/usherlight/archive/2015/04/27/424701.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/424701.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/424701.html可以使用slf4j提供的类来{接这部分的日志输出?br />
Ҏ(gu)Q?br />1、类路径中添?br />    slf4j-api-1.7.10.jar
    jul-to-slf4j.1.7.10.jar ( 用于java.util.logging的日志桥接到slf4j中)
    logback-core.1.1.2.jar
    logback-classic-1.1.2.jar

2、在代码中添加:
         // Optionally remove existing handlers attached to j.u.l root logger
         SLF4JBridgeHandler.removeHandlersForRootLogger();  // (since SLF4J 1.6.5)

         // add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
         // the initialization phase of your application
         SLF4JBridgeHandler.install();

注意事项Q?br />1、这个桥接可以会造成性能问题?br />和其他的桥接实现Q比如:log4j, commons logging)不同Q这个模块ƈ不真正的完全替代java.util.loggingc,因ؓq个java.util.logging是java自带的?br />所以只是把原来的日志对象进行了转换Q简单的_q个转换q程是有开销的?br />关键在于Q不日志语句有没有Ҏ(gu)日志U别被关闭,q个转换无法避免?br />
2、不能在c\径中攑օ
slf4j-jkd14.jar
jul-toslf4j.jar


]]>
OpenPGP加密解密文g http://www.tkk7.com/usherlight/archive/2014/12/10/421238.html云自无心水自?/dc:creator>云自无心水自?/author>Tue, 09 Dec 2014 22:50:00 GMThttp://www.tkk7.com/usherlight/archive/2014/12/10/421238.htmlhttp://www.tkk7.com/usherlight/comments/421238.htmlhttp://www.tkk7.com/usherlight/archive/2014/12/10/421238.html#Feedback5http://www.tkk7.com/usherlight/comments/commentRss/421238.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/421238.htmlOpenPGP L是世界上使用最q泛的邮件加密标?  OpenPGP is the most widely used email encryption standard in the world. ( http://www.openpgp.org/ )
q篇例子介绍如何使用q个标准q行文g的加密解?(https://www.bouncycastle.org/latest_releases.html, 需要下? bcprov-jdk15on-151.jar, bcpg-jdk15on-151.jar).

主要是用bouncycastle提供的OpenPGP的库来完成这个功能,参照了其提供的示例程序,q行了部分改?( Bouncy Castle 是一U用?Java q_的开放源码的轻量U密码术包。它支持大量的密码术法Qƈ提供 JCE 1.2.1 的实现。因?Bouncy Castle 被设计成轻量U的Q所以从 J2SE 1.4 ?J2MEQ包?MIDPQ^収ͼ它都可以q行。它是在 MIDP 上运行的唯一完整的密码术包?
1. d循环遍历来查扄一个可用的message
2. 需要注意的是在main函数中的Q?span>如果不添加这一句的?Security.addProvider(new BouncyCastleProvider()); E序q行中会报错QNo such Provider "BC"
3. 错误Exception in thread "main" java.security.InvalidKeyException: Illegal key size or default parameters , q是因ؓjava~省的库支持的key长度比较短,需要到oracle的网站上M载一个支持更长key的库覆盖原有的库文g
<JAVA_HOME>/lib/securty/ 目录下的两个jar文g
local_policy.jar and US_export_policy.jar
搜烦q个文g: Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files
下蝲面(以JDK6Z)Q?a >http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html

package org.bouncycastle.openpgp.examples;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
import java.security.Security;
import java.util.Iterator;

import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.bcpg.CompressionAlgorithmTags;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openpgp.PGPCompressedData;
import org.bouncycastle.openpgp.PGPEncryptedData;
import org.bouncycastle.openpgp.PGPEncryptedDataGenerator;
import org.bouncycastle.openpgp.PGPEncryptedDataList;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPLiteralData;
import org.bouncycastle.openpgp.PGPOnePassSignatureList;
import org.bouncycastle.openpgp.PGPPrivateKey;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyEncryptedData;
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
import org.bouncycastle.openpgp.PGPSignatureList;
import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory;
import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
import org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder;
import org.bouncycastle.openpgp.operator.jcajce.JcePublicKeyDataDecryptorFactoryBuilder;
import org.bouncycastle.openpgp.operator.jcajce.JcePublicKeyKeyEncryptionMethodGenerator;
import org.bouncycastle.util.io.Streams;

/**
 * A simple utility class that encrypts/decrypts public key based
 * encryption files.
 * <p>
 * To encrypt a file: KeyBasedFileProcessor -e [-a|-ai] fileName publicKeyFile.<br>
 * If -a is specified the output file will be "ascii-armored".
 * If -i is specified the output file will be have integrity checking added.
 * <p>
 * To decrypt: KeyBasedFileProcessor -d fileName secretKeyFile passPhrase.
 * <p>
 * Note 1: this example will silently overwrite files, nor does it pay any attention to
 * the specification of "_CONSOLE" in the filename. It also expects that a single pass phrase
 * will have been used.
 * <p>
 * Note 2: if an empty file name has been specified in the literal data object contained in the
 * encrypted packet a file with the name filename.out will be generated in the current working directory.
 
*/
public class KeyBasedFileProcessor
{
    private static void decryptFile(
        String inputFileName,
        String keyFileName,
        char[] passwd,
        String defaultFileName)
        throws IOException, NoSuchProviderException
    {
        InputStream in = new BufferedInputStream(new FileInputStream(inputFileName));
        InputStream keyIn = new BufferedInputStream(new FileInputStream(keyFileName));
        decryptFile(in, keyIn, passwd, defaultFileName);
        keyIn.close();
        in.close();
    }

    /**
     * decrypt the passed in message stream
     
*/
    private static void decryptFile(
        InputStream in,
        InputStream keyIn,
        char[]      passwd,
        String      defaultFileName)
        throws IOException, NoSuchProviderException
    {
        in = PGPUtil.getDecoderStream(in);
        
        try
        {
            JcaPGPObjectFactory pgpF = new JcaPGPObjectFactory(in);
            PGPEncryptedDataList    enc;

            Object                  o = pgpF.nextObject();
            //
            
// the first object might be a PGP marker packet.
            
//
            if (o instanceof PGPEncryptedDataList)
            {
                enc = (PGPEncryptedDataList)o;
            }
            else
            {
                enc = (PGPEncryptedDataList)pgpF.nextObject();
            }
            
            //
            
// find the secret key
            
//
            Iterator                    it = enc.getEncryptedDataObjects();
            PGPPrivateKey               sKey = null;
            PGPPublicKeyEncryptedData   pbe = null;
            PGPSecretKeyRingCollection  pgpSec = new PGPSecretKeyRingCollection(
                PGPUtil.getDecoderStream(keyIn), new JcaKeyFingerprintCalculator());

            while (sKey == null && it.hasNext())
            {
                pbe = (PGPPublicKeyEncryptedData)it.next();
                
                sKey = PGPExampleUtil.findSecretKey(pgpSec, pbe.getKeyID(), passwd);
            }
            
            if (sKey == null)
            {
                throw new IllegalArgumentException("secret key for message not found.");
            }
    
            InputStream         clear = pbe.getDataStream(new JcePublicKeyDataDecryptorFactoryBuilder().setProvider("BC").build(sKey));
            
            JcaPGPObjectFactory    plainFact = new JcaPGPObjectFactory(clear);
            
            Object              message = plainFact.nextObject();
    
            while ( true ) {
                if (message instanceof PGPCompressedData)
                {
                    PGPCompressedData   cData = (PGPCompressedData)message;
                    JcaPGPObjectFactory    pgpFact = new JcaPGPObjectFactory(cData.getDataStream());
                    
                    message = pgpFact.nextObject();
                }
                
                if (message instanceof PGPLiteralData)
                {
                    PGPLiteralData ld = (PGPLiteralData)message;

                    String outFileName = ld.getFileName();
                    if (outFileName.length() == 0)
                    {
                        outFileName = defaultFileName;
                    }

                    InputStream unc = ld.getInputStream();
                    OutputStream fOut = new BufferedOutputStream(new FileOutputStream(outFileName));

                    Streams.pipeAll(unc, fOut);

                    fOut.close();
                    break;
                }
                else if (message instanceof PGPOnePassSignatureList)
                {
                    System.out.println("encrypted message contains a signed message - not literal data.");
                }
                else if (message instanceof PGPSignatureList)
                {
                    System.out.println("encrypted message contains a signed message - not literal data.");
                }
                else
                {
                    throw new PGPException("message is not a simple encrypted file - type unknown.");
                }
                message = plainFact.nextObject();
            }
            
            if (pbe.isIntegrityProtected())
            {
                if (!pbe.verify())
                {
                    System.err.println("message failed integrity check");
                }
                else
                {
                    System.err.println("message integrity check passed");
                }
            }
            else
            {
                System.err.println("no message integrity check");
            }
        }
        catch (PGPException e)
        {
            System.err.println(e);
            if (e.getUnderlyingException() != null)
            {
                e.getUnderlyingException().printStackTrace();
            }
        }
    }

    private static void encryptFile(
        String          outputFileName,
        String          inputFileName,
        String          encKeyFileName,
        boolean         armor,
        boolean         withIntegrityCheck)
        throws IOException, NoSuchProviderException, PGPException
    {
        OutputStream out = new BufferedOutputStream(new FileOutputStream(outputFileName));
        PGPPublicKey encKey = PGPExampleUtil.readPublicKey(encKeyFileName);
        encryptFile(out, inputFileName, encKey, armor, withIntegrityCheck);
        out.close();
    }

    private static void encryptFile(
        OutputStream    out,
        String          fileName,
        PGPPublicKey    encKey,
        boolean         armor,
        boolean         withIntegrityCheck)
        throws IOException, NoSuchProviderException
    {
        if (armor)
        {
            out = new ArmoredOutputStream(out);
        }

        try
        {
            byte[] bytes = PGPExampleUtil.compressFile(fileName, CompressionAlgorithmTags.ZIP);

            PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(
                new JcePGPDataEncryptorBuilder(PGPEncryptedData.CAST5).setWithIntegrityPacket(withIntegrityCheck).setSecureRandom(new SecureRandom()).setProvider("BC"));

            encGen.addMethod(new JcePublicKeyKeyEncryptionMethodGenerator(encKey).setProvider("BC"));

            OutputStream cOut = encGen.open(out, bytes.length);

            cOut.write(bytes);
            cOut.close();

            if (armor)
            {
                out.close();
            }
        }
        catch (PGPException e)
        {
            System.err.println(e);
            if (e.getUnderlyingException() != null)
            {
                e.getUnderlyingException().printStackTrace();
            }
        }
    }

    public static void main(
        String[] args)
        throws Exception
    {
        Security.addProvider(new BouncyCastleProvider());

        if (args.length == 0)
        {
            System.err.println("usage: KeyBasedFileProcessor -e|-d [-a|ai] file [secretKeyFile passPhrase|pubKeyFile]");
            return;
        }

        if (args[0].equals("-e"))
        {
            if (args[1].equals("-a") || args[1].equals("-ai") || args[1].equals("-ia"))
            {
                encryptFile(args[2] + ".asc", args[2], args[3], true, (args[1].indexOf('i') > 0));
            }
            else if (args[1].equals("-i"))
            {
                encryptFile(args[2] + ".bpg", args[2], args[3], falsetrue);
            }
            else
            {
                encryptFile(args[1] + ".bpg", args[1], args[2], falsefalse);
            }
        }
        else if (args[0].equals("-d"))
        {
            decryptFile(args[1], args[2], args[3].toCharArray(), new File(args[1]).getName() + ".out");
        }
        else
        {
            System.err.println("usage: KeyBasedFileProcessor -d|-e [-a|ai] file [secretKeyFile passPhrase|pubKeyFile]");
        }
    }
}


asdf

]]>
Nettyhttp://www.tkk7.com/usherlight/archive/2014/11/27/420676.html云自无心水自?/dc:creator>云自无心水自?/author>Wed, 26 Nov 2014 23:36:00 GMThttp://www.tkk7.com/usherlight/archive/2014/11/27/420676.htmlhttp://www.tkk7.com/usherlight/comments/420676.htmlhttp://www.tkk7.com/usherlight/archive/2014/11/27/420676.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/420676.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/420676.html
在Netty in Action中是q样描述的:
While the I/O thread must not be blocked at all, thus prohibiting any direct blocking operations within your ChannelHandler, there is a way to implement this requirement. 
You can specify an EventExecutorGroup when adding ChannelHandlers to the ChannelPipeline. 
This EventExecutorGroup will then be used to obtain an EventExecutor, which will execute all the methods of the ChannelHandler. 
This EventExecutor will use a different thread from the I/O thread, thus freeing up the EventLoop.
IQOU程是不允许被阻塞的Q也是不能在ChannelHandler中进行Q何阻塞式的处理,但是Ҏ(gu)我们也有相应的解x?
是在把ChannelHandersd到ChannelPipeline的时候,指定一个EventExecutorGroupQChannelHandler中所有的Ҏ(gu)都将会在q个指定的EventExecutorGroup中运行?/div>
而这个EVentExecutorGroupq行的线E与I/OU程不同Q达CdIQO的目的?nbsp;
E序CZ如下Q?/div>
Channel ch = ...;
ChannelPipeline p = ch.pipeline();
EventExecutor e1 = new DefaultEventExecutorGroup(16);
EventExecutor e2 = new DefaultEventExecutorGroup(8);
 
p.addLast(new MyProtocolCodec());
p.addLast(e1, new MyDatabaseAccessingHandler());
p.addLast(e2, new MyHardDiskAccessingHandler());
需要补充说明一下,上面的示例程序似乎有炚w题。用上q方法添加ChannelHandler到pipeline中以后,channelHandler的所有方法确实什么在一个单独的U程中被处理?br />但是Q每ơDefaultEventExcutorGroupU程池中的线E不能被重用Q每ơ都会生成一个新的线E,然后在新的线E中调用ChannelHandler, 在visualvm可以看到U程数量直线增长?br />
解决的方法是Q不能用局部变量Ş式的DefaultEventExecutorGroup。而用类静态成员变量:
static final EventExecutor e1 = new DefaultEventExecutorGroup(16);

我分析原因可能是Q在新的q接到来Q创建ChannelPipelinel新Channel的时候,如果不用静态的׃n变量Q而用局部变量的话,造成DefaultEventExecutorGroup被多ơ重复创建。因此,虽然一个DefaultEventExecutorGroup中的Thread数量是固定的Q但是却产生了多余的DefaultEventExecutorGroup。从VisualVM中也可以看到QDefaultEventExecutorGroupU程的名字会是:
xxx-2-1
xxx-3-1
xxx-4-1
xxx-n-1
说明是Group的数量(W一个数字)在增多,而不是Group中的U程数量(W二个数字)在增?/div>
Ҏ(gu)静态变量后Q线E名会是Q?/div>
xxx-2-1
xxx-2-2
xxx-2-3
xxx-2-n
最后一个n是在创建DefaultEventExecutorGroup时候,传入的线E个数参数的大小?/div>


]]>Active MQhttp://www.tkk7.com/usherlight/archive/2013/10/14/404983.html云自无心水自?/dc:creator>云自无心水自?/author>Mon, 14 Oct 2013 12:35:00 GMThttp://www.tkk7.com/usherlight/archive/2013/10/14/404983.htmlhttp://www.tkk7.com/usherlight/comments/404983.htmlhttp://www.tkk7.com/usherlight/archive/2013/10/14/404983.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/404983.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/404983.html
P66
1. components:
    a. Message
        a.1 Header
a.1.1 Destination
a.1.2 DeliveryMode: persistent, non-persistent
a.2 Body
    b. Queue
    c. Client
        c.1 Producer
        c.2 Consumer - Message Selector
d. Domain, 2 styles of messaging
d.1 point-to-point
d.1.1 destination known as QUEUE
d.1.2 similar to person to person email sent through a mail server
d.1.3 multiple consumers can be registered on a single queue
but only one consumer will receive a a given messge 
and it's upt to that consumer to acknowledge the message
d.2 publish-subscribe
d.2.1 destination known as TOPICS
d.2.2 publishers send messages to the topic 
and subscribers register to receive messages from the topic
d.2.3 durable subscriptions allow for subscriber disconnection without missing any messages


]]>Spring Security中指定session时后蟩转的面http://www.tkk7.com/usherlight/archive/2011/08/31/357615.html云自无心水自?/dc:creator>云自无心水自?/author>Tue, 30 Aug 2011 23:25:00 GMThttp://www.tkk7.com/usherlight/archive/2011/08/31/357615.htmlhttp://www.tkk7.com/usherlight/comments/357615.htmlhttp://www.tkk7.com/usherlight/archive/2011/08/31/357615.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/357615.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/357615.htmlSpring Security中指定session时后蟩转的面

在xml配置文g中加入:<session-management invalid-session-url="/session-timeout.htm" />


]]>Spring MVC + Spring Security + Spring JDBC中注入dataSourceL为Null的原因和解决http://www.tkk7.com/usherlight/archive/2011/08/26/357316.html云自无心水自?/dc:creator>云自无心水自?/author>Fri, 26 Aug 2011 00:57:00 GMThttp://www.tkk7.com/usherlight/archive/2011/08/26/357316.htmlhttp://www.tkk7.com/usherlight/comments/357316.htmlhttp://www.tkk7.com/usherlight/archive/2011/08/26/357316.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/357316.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/357316.html
在applicationContext.xml中定义了一个DataSourceQ?lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" />
但是在代码中Q用anotationq行注入的时候,却L找不到这个dataSource.

    @Autowired
    public void setDataSource(DataSource dataSource) {
        jdbcTemplate = new JdbcTemplate(dataSource);
        jdbcInsert = new SimpleJdbcInsert(dataSource);
    }

最后终于想明白了,原因大概是这LQ用autowired的时候,默认是根据类型来匚w的,在xml中定义的cd是:BasicDataSourceQ而不是接口DataSourceQ所以默认情况下q样是无法自动装配的。解军_法是指o使用名字来进行bean的匹配,也就是用Qualifier指定bean的id.

    @Autowired
    public void setDataSource(@Qualifier("dataSource") DataSource dataSource) {
        jdbcTemplate = new JdbcTemplate(dataSource);
        jdbcInsert = new SimpleJdbcInsert(dataSource);
    }


另外一点,在网上搜索的q程中发现有不少人都有类似的问题Q但是他们的原因是没有正用spring的注入,而是自己在代码中new了一个Dao的实例,q样的话Qspring是无法将dataSource注入到dao的实例中?/div>


]]>
打开有密码保护(但是没有加密Q的excel文ghttp://www.tkk7.com/usherlight/archive/2011/05/30/351313.html云自无心水自?/dc:creator>云自无心水自?/author>Mon, 30 May 2011 02:42:00 GMThttp://www.tkk7.com/usherlight/archive/2011/05/30/351313.htmlhttp://www.tkk7.com/usherlight/comments/351313.htmlhttp://www.tkk7.com/usherlight/archive/2011/05/30/351313.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/351313.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/351313.html
主要是用:
Biff8EncryptionKey.setCurrentUserPassword(password);
在打开workbook之前
HSSFWorkbook workbook = new HSSFWorkbook(inp);
注意事项Q这个应该是只适用于xls,而不是xlsx


]]>Tapestry5 in actionQmanning)的第一章免贚w?/title><link>http://www.tkk7.com/usherlight/archive/2011/03/29/347159.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Mon, 28 Mar 2011 21:53:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2011/03/29/347159.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/347159.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2011/03/29/347159.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/347159.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/347159.html</trackback:ping><description><![CDATA[<div> <div>Tapestry5 in action现在q只是提供MEAP形式的订购,MEAP-Manning Early Access Program, 也就是提前试阅的意思,如果读者订购了此版本,那么manning会在作者每完成一章后Q将该章节发l订购者,订购者可以提交自q反馈Qmanning会根据情况发布相应的错误修改信息?/div> <div>目前此书的第一章可以免费下载:</div> </div> <div><br /> </div> <div>http://www.tkk7.com/Files/usherlight/Tapestry5%20in%20action%20MEAP%20ch01.zip</div><img src ="http://www.tkk7.com/usherlight/aggbug/347159.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2011-03-29 05:53 <a href="http://www.tkk7.com/usherlight/archive/2011/03/29/347159.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java串口~程需要注意的几个地方http://www.tkk7.com/usherlight/archive/2011/02/07/343929.html云自无心水自?/dc:creator>云自无心水自?/author>Mon, 07 Feb 2011 05:22:00 GMThttp://www.tkk7.com/usherlight/archive/2011/02/07/343929.htmlhttp://www.tkk7.com/usherlight/comments/343929.htmlhttp://www.tkk7.com/usherlight/archive/2011/02/07/343929.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/343929.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/343929.html
我用的是sun提供的javax.comm包,不确定其他的comm支持包(比如Qrxtx)行ؓ与之相同
1、事仉动的数据d
需要注意的是:一个SerialPort只能注册一个事件监听程序,因此Q有时候有会发玎ͼ你的事g监听处理E序会变得非常庞?/div>
另外Q要注意的就是事件处理如果比较耗时的话Q最好是在单独的U程中运行,否则会阻塞数据的接收?/div>
串口接收到数据后Q默认在U程: Win32SerialPort Notification thread中运行。如果不及时释放的话Q会造成数据无法d?/div>
我的做法是,接收到数据后Q先判断数据的合法和完整性,如果没有接收到完整的数据Q则在缓存数据后Q马上返?/div>
如果数据完整而且合法Q则另开一个线E,q行数据处理
2、数据的发?/div>
单独使用一个线E来发送数据,目的q是Z防止dQ有一个技巧就是用OUTPUT_BUFFER_EMPTY事g来发送?/div>

]]>spring mvc的一些优?/title><link>http://www.tkk7.com/usherlight/archive/2010/12/15/340730.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Tue, 14 Dec 2010 23:51:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2010/12/15/340730.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/340730.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2010/12/15/340730.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/340730.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/340730.html</trackback:ping><description><![CDATA[<div><br /> </div> <div>1、用@RequestParam获取HttpServletRequest里的参数值相当方便,spring可以q行自动的类型{?/div> <div>2、对于Restful的支持,l合@RequestMapping的UriTemplate和method以及@PathVariableQ非常方便地实现了restful的url</div> <div>3、对于Ajax的支持,@RespsonseBody提供了方便的机制</div> <div>4、灵zM富的@Controller的函数返回类?/div> <div>5、可以方便地l@Controller函数注入各种资源</div> <div>其他的一些别的框枉有特性,诸如国际化,文g上传什么的׃说了</div><img src ="http://www.tkk7.com/usherlight/aggbug/340730.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2010-12-15 07:51 <a href="http://www.tkk7.com/usherlight/archive/2010/12/15/340730.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tapestry的一些最新动?/title><link>http://www.tkk7.com/usherlight/archive/2010/11/24/338872.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Tue, 23 Nov 2010 22:08:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2010/11/24/338872.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/338872.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2010/11/24/338872.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/338872.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/338872.html</trackback:ping><description><![CDATA[<br /> 1、Tapestry5.2.4的发布,Tapestry5.2.3版本在内部投中被否冻I主要是因Z用maven快速创建的原型有问题)Q所以在被否决的3天后便发布了5.2.4,相对5.2.2来说Q变动ƈ不大Q只?个错误修复和5个功能改q。但是至说明Tapestry的项目还在顺利的q行中?br /> 2、Tapestry主页的全新改版。主要是完善了文档。这一Ҏ(gu)非常重要的,Tapestry目l的成员也承认Tapestry在推销自己或者是在市场推q方面做得非常失?very bad in marketing)Q所以最q也采取了一些措施来q行改变Q比如,预计明年会发行Tapestry5 in action一书等{?br /> 3、还有一件事需要提及的是:appfuse的作者最q对web框架q行了一番对比http://raibledesigns.com/rd/entry/my_comparing_jvm_web_frameworksQTapestry?3个框架中名列W?Q刚好是中间的位|。Tapestry目的成员颇有不满,认ؓ作者Matt Raible对Tapestry不够了解Q有误导观众之嫌。Tapestry目成员I(y)gor E. Poteryaev认ؓMatt?认识度,开发效率,目健康度,试友好性,scalability{方面严重低CTapestry的能力?br /><img src ="http://www.tkk7.com/usherlight/aggbug/338872.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2010-11-24 06:08 <a href="http://www.tkk7.com/usherlight/archive/2010/11/24/338872.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Mybatis的一些新动?/title><link>http://www.tkk7.com/usherlight/archive/2010/11/02/336750.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Tue, 02 Nov 2010 00:10:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2010/11/02/336750.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/336750.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2010/11/02/336750.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/336750.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/336750.html</trackback:ping><description><![CDATA[1、发布了MyBatis3.0.3, 具体内容不详Q没有能够发现release notes.<br /> 2、发布了mybatis-generator 1.3.0, q是一个能够根据数据库的表自动生成mybatis?br />         sqlmap xml文g<br />         与数据表对应的java class<br />         使用上两个文件的javac?br /> 我下载后Q尝试着使用了一下,发现需要有一个配|文Ӟ我觉得应该是用于提供数据库连接的信息。但是配|文件的格式不详?br /> 现在发现mybatis的文档比较成问题Q很多东襉K没有说明Q用v来很困难啊?br /> 3、新增了两个中方译文档<br />         # MyBatis 3 User Guide Simplified Chinese.pdf<br />         # MyBatis-Spring Reference Simplied Chinese.pdf<br /> 4、发布了mybatis-spring-1.0.0-RC2<br /> 5、发布了mybatis-guice-1.0.0-RC3<img src ="http://www.tkk7.com/usherlight/aggbug/336750.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2010-11-02 08:10 <a href="http://www.tkk7.com/usherlight/archive/2010/11/02/336750.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tapestry5.2.2(Beta Release)发布?/title><link>http://www.tkk7.com/usherlight/archive/2010/11/02/336747.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Mon, 01 Nov 2010 23:58:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2010/11/02/336747.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/336747.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2010/11/02/336747.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/336747.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/336747.html</trackback:ping><description><![CDATA[主要是一些bug修复和改q,最重要的一Ҏ(gu)能够从link对象生成l对路径了?br /> q主要是便于ajax的用?br /> <br /> <p>Bug</p> <p>    *  Element.forceAttribute uses the element's namespace to match the attribute.<br />     *  Element.attribute(String name, String value) adds elements that already exist<br />     *  Element#addClassName can create an additional new 'class' attribute<br />     *  Properties defined in an Interface are not exposed by PropertyAccess for abstract classes that do not directly implement the methods<br />     *  Some services require a notification that they have been reloaded, so they can clean up external dependencies<br />     *  Whitespaces in SymbolConstants.SUPPORTED_LOCALES cause that locales are not persised<br />     *  Validation macros do not work when used in @Validate annotation<br />     *  Client-side validation of @Pattern is broken<br />     *  Linking a Form to a Zone will no longer work unless the Form contains validated fields<br />     *  When using PropertyShadowBuilder to build a service, if the property is null, an immediate exception is needed (rather than a NullPointerException)<br />     *  When using a MultiZoneUpdate, Tapestry will clear the referenced zone</p> <p>Improvement</p> <p>    *  Add the facility to optionally disable on-focus-change triggered validation while retaining the on-form-submit validation<br />     *  Form component should be able to render a secure URL even on an insecure page<br />     *  New annotations @Decorate and @Advise to identify methods that decorate or annotate services<br />     *  Extend Link with new methods for producing absolute URLs (that include scheme, hostname, etc.)<br />     *  Simplify connecting a link or form to an (enclosing) Zone<br />     *  BeanBlockContribution should be split into two sub-classes: EditBlockContribution and DisplayBlockContribution<br />     *  Define a special CSS class to prevent a client-side form from submitting normally (for Ajax use cases)<br />     *  Additional method for Link: addParameterValue(String,Object) that uses ContextPathEncoder to encode object value to a string<br />     *  SeleniumTestCase should expose the underlying CommandProcessor, to allow execution of commands not defined by the Selenium interface<br />     *  Allow individual SeleniumTestCases to run w/o configuring SeleniumLauncher<br /> </p><img src ="http://www.tkk7.com/usherlight/aggbug/336747.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2010-11-02 07:58 <a href="http://www.tkk7.com/usherlight/archive/2010/11/02/336747.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tapestry5.2.1 Beta已经发布http://www.tkk7.com/usherlight/archive/2010/10/20/335644.html云自无心水自?/dc:creator>云自无心水自?/author>Tue, 19 Oct 2010 23:38:00 GMThttp://www.tkk7.com/usherlight/archive/2010/10/20/335644.htmlhttp://www.tkk7.com/usherlight/comments/335644.htmlhttp://www.tkk7.com/usherlight/archive/2010/10/20/335644.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/335644.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/335644.html今天在网上{了{Q发现Tapestry又有了新动作?br /> 1、从5.2.0alpha??1日发布到现在Q终于发?.2.1Beta版了。这个版本主要是修改alpha版本中的bug.
5.2相对?.1q行了许多重大的改进Q详l内容可见:Tapestry5.2的新变化
2、据U在5.3版中引入大量的新功能,具体内容不详?br /> 3、以往最令h诟病的文问题,目前开发小l也在努力解冟?br />      首先Q徏立了新的文档|页Qhttp://people.apache.org/~uli/tapestry-site/Q不q目前这个网站还没有完全完成Q只能算是预览版Q但是这毕竟是在正确的道路上前进?br />      其次QTapestry 5 in action一书正在写作中Q已l完?0%Q预计明q一季度能够出版?br /> 我相信,随着功能的不断完善和补充Q再加上文的逐渐充实QTapestry完全有理p吸引更多的开发者来x和用?/p>

]]>
mybatis3.0.2已经发布http://www.tkk7.com/usherlight/archive/2010/09/13/331886.html云自无心水自?/dc:creator>云自无心水自?/author>Mon, 13 Sep 2010 04:42:00 GMThttp://www.tkk7.com/usherlight/archive/2010/09/13/331886.htmlhttp://www.tkk7.com/usherlight/comments/331886.htmlhttp://www.tkk7.com/usherlight/archive/2010/09/13/331886.html#Feedback1http://www.tkk7.com/usherlight/comments/commentRss/331886.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/331886.htmlq是mybatis从ibatis更名q来后,发布的第2个版本(W?个版本是3.0.1)?br /> 在这个版本中只修复了4个bug(感觉数目有点,N是因Z一个版本的bug真的如此之少?)Q增加了一个小功能.
作者的话:管只有5个修改,但我q是觉得值得为此发布一个新版本?br /> q?个修Ҏ(gu)Q?br /> 1、在org.apache.ibatis.Session中增加了一个新Ҏ(gu)Qvoid select(String statement, ResultHandler handler);
原来只有Q?br />  void select(String statement, Object parameter, ResultHandler handler);
 void select(String statement, Object parameter, RowBounds rowBounds, ResultHandler handler);

2、修复了ManagedConnection中关闭连接的问题
3、修复了schema migration中,语句提交(statement commit)不正的问题
4、修复了延迟加蝲已经预读取属性时的问?br /> 5、修复了schema migration中,FileInputStream没有正确关闭的问?br />



]]>
Tapestry5.2的新变化http://www.tkk7.com/usherlight/archive/2010/08/18/329170.html云自无心水自?/dc:creator>云自无心水自?/author>Tue, 17 Aug 2010 23:13:00 GMThttp://www.tkk7.com/usherlight/archive/2010/08/18/329170.htmlhttp://www.tkk7.com/usherlight/comments/329170.htmlhttp://www.tkk7.com/usherlight/archive/2010/08/18/329170.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/329170.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/329170.html 1、增Zclass reload的功能(我个Z认ؓq一Ҏ(gu)5.2版本最令hȀ动的改进Q,以前Tapestry和其他的web框架cMQ修攚w面不需要重新启动application server, 但是修改了类之后Q必重新启动应用服务器才行。但是在Tapestry5.2中,对这一点进行了修改Q如果只改变了接口的实现c,而不改变接口的方法签名,׃需要重新启动应用服务器
2、新增了若干个组Ӟ比如QError和Trigger?br /> Error和原有的ErrorscMQ但是Error用于l指定的lg昄验证错误信息?br /> Trigger提供了在L面q程中触发Q务事件的功能Q常常用于通过RenderSupport来给面dJavaScript代码
3、新的插?Mixin),包括RenderClientId, RenderNotification
4、集成了JSR-303 Bean的验证,现在可以在页面中使用JSR-303标准的注解来l字D|定需要的验证
5、新的注解,包括@Contribute,@RequestParameter, @ActivationRequestParameter, 使用后两个注解能很容易地获取request中的参数
6、新的页面生命周期事ӞpageReset
7、链接修饰过E中的新事g: decoratePageRenderLink, decoreateComponentEventLink
8、页面解析器的更换,原来使用StAXQ造成了对Google App Engine和对OSGI的不兼容Q?.2版本中用了标准的SAX解析?br /> 9、页面缓冲池的废除(我认?.2版本的一个相当大而且也是非常重要的一个变化,我认为页面缓冲池技术是tapestry学习曲线陡峭的一个重要原因)Q?.2版本中所有页面将只有一个实例(也就是lewis howard说的单例化)Q页面属性的值将会在每个U程中用一个Map来保存。这样一个页面实例可以在多个U程中用,而不会有同步问题?br /> 但是Q由于这是一个新的尝试,所以lewis也不定q样做的效果是否很好Q详见:http://tapestryjava.blogspot.com/2010/07/everyone-out-of-pool-tapestry-goes.htmlQ所以,?.2中可以通过配置恢复面~冲池的使用?img src ="http://www.tkk7.com/usherlight/aggbug/329170.html" width = "1" height = "1" />

]]>
Tapestry5.2的alpha版本已经发布http://www.tkk7.com/usherlight/archive/2010/07/15/326156.html云自无心水自?/dc:creator>云自无心水自?/author>Thu, 15 Jul 2010 00:20:00 GMThttp://www.tkk7.com/usherlight/archive/2010/07/15/326156.htmlhttp://www.tkk7.com/usherlight/comments/326156.htmlhttp://www.tkk7.com/usherlight/archive/2010/07/15/326156.html#Feedback2http://www.tkk7.com/usherlight/comments/commentRss/326156.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/326156.html ?.2中还是新增了不少令hȀ动的功能
1、QueryParameterMapped注解Q用这个注解可以很方便地把request中的参数映射到bean里的属?br /> 2、(q是最让我期待的功能)服务l于能够动态加载了Q?br /> 3、在事g处理Ҏ(gu)中可以用QueryParameter来注解参?br /> 4、submitlg现在可以cancel表单里的数据?br /> 5、不再用StAX作ؓtml的解析器了,而是采用标准的SAX解析器,q样减少外界引用Q而且兼容性更?br /> 6、组件中也可以用SessionAttribute来获得session中的数据了,以前好像只有在page中才能用
7、引入了JSR-303 Bean Validation Integration Library.

]]>
Java Swing 布局理?/title><link>http://www.tkk7.com/usherlight/archive/2010/07/05/325258.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Mon, 05 Jul 2010 01:38:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2010/07/05/325258.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/325258.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2010/07/05/325258.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/325258.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/325258.html</trackback:ping><description><![CDATA[<p>CardLayout布局理器能够帮助用户处理两个以x多的成员׃n同一昄I间,它把容器分成许多?每层的显C空间占据整个容器的大小,但是每层只允许放|一个组?当然每层都可以利用Panel来实现复杂的用户界面.布局理器(CardLayoutQ就象一副叠得整整齐齐的扑克牌一??4 张牌,但是你只能看见最上面的一张牌,每一张牌q当于布局理器中的每一?</p> <p>式布局理器把容器看成一个行集,好象qx在一张纸上写字一P一行写满就换下一行。行高是用一行中的控仉度决定的。FlowLayout是所?JApplet/JApplet的默认布局。在生成式布局时能够指定显C的寚w方式Q默认情况下是居中(FlowLayout.CENTERQ?/p> <p>GridLayout 成员按|格型排列,每个成员可能地占据|格的空_每个|格也同样尽可能地占据空_从而各个成员按一定的大小比例攄。如果你改变大小Q?GridLayout相应地改变每个|格的大,以各个|格可能地大,占据Container容器全部的空间?br /> 基本布局{略是把容器的空间划分成若干行乘若干列的|格区域Q组件就位于q些划分出来的小区域中,所有的区域大小一栗组件按从左到右Q从上到下的Ҏ(gu)加入?/p> <p>BoxLayout布局能够允许控件按照X_从左到右Q或者Y_从上CQ方向来摆放Q而且沿着主u能够讄不同寸?/p><img src ="http://www.tkk7.com/usherlight/aggbug/325258.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2010-07-05 09:38 <a href="http://www.tkk7.com/usherlight/archive/2010/07/05/325258.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HTTP协议q回代码的含?/title><link>http://www.tkk7.com/usherlight/archive/2010/06/23/324225.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Tue, 22 Jun 2010 23:16:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2010/06/23/324225.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/324225.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2010/06/23/324225.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/324225.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/324225.html</trackback:ping><description><![CDATA[<h1 class="articletitle">HTTP Status Codes Explained</h1> <div id="6qyy8e8" class="pageintro">All valid HTTP 1.1 Status Codes simply explained. </div> <div class="gegwsuu" id="article"><!-- google_ad_section_start --> <p>HTTP, Hypertext Transfer Protocol, is the method by which clients (i.e. you) and servers communicate. When someone clicks a link, types in a URL or submits out a form, their browser sends a request to a server for information. It might be asking for a page, or sending data, but either way, that is called an HTTP Request. When a server receives that request, it sends back an HTTP Response, with information for the client. Usually, this is invisible, though I'm sure you've seen one of the very common Response codes - 404, indicating a page was not found. There are a fair few more status codes sent by servers, and the following is a list of the current ones in HTTP 1.1, along with an explanation of their meanings.</p> <p>A more technical breakdown of HTTP 1.1 status codes and their meanings is available at <a >http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html</a>. There are several versions of HTTP, but currently HTTP 1.1 is the most widely used.</p> <h3>Informational</h3> <ul> <li id="s4g4ikc" class="reference"><strong>100 - Continue</strong><br /> A status code of 100 indicates that (usually the first) part of a request has been received without any problems, and that the rest of the request should now be sent.</li> <li id="8y4gc8s" class="reference"><strong>101 - Switching Protocols</strong><br /> HTTP 1.1 is just one type of protocol for transferring data on the web, and a status code of 101 indicates that the server is changing to the protocol it defines in the "Upgrade" header it returns to the client. For example, when requesting a page, a browser might receive a statis code of 101, followed by an "Upgrade" header showing that the server is changing to a different version of HTTP.</li> </ul> <h3>Successful</h3> <ul> <li id="kek44wo" class="reference"><strong>200 - OK</strong><br /> The 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is being processed.</li> <li id="se4ys4a" class="reference"><strong>201 - Created</strong><br /> A 201 status code indicates that a request was successful and as a result, a resource has been created (for example a new page).</li> <li id="844ug4u" class="reference"><strong>202 - Accepted</strong><br /> The status code 202 indicates that server has received and understood the request, and that it has been accepted for processing, although it may not be processed immediately.</li> <li id="m4mu4ck" class="reference"><strong>203 - Non-Authoritative Information</strong><br /> A 203 status code means that the request was received and understood, and that information sent back about the response is from a third party, rather than the original server. This is virtually identical in meaning to a 200 status code.</li> <li id="a4448sq" class="reference"><strong>204 - No Content</strong><br /> The 204 status code means that the request was received and understood, but that there is no need to send any data back.</li> <li id="8w84c44" class="reference"><strong>205 - Reset Content</strong><br /> The 205 status code is a request from the server to the client to reset the document from which the original request was sent. For example, if a user fills out a form, and submits it, a status code of 205 means the server is asking the browser to clear the form.</li> <li id="i4iguww" class="reference"><strong>206 - Partial Content</strong><br /> A status code of 206 is a response to a request for part of a document. This is used by advanced caching tools, when a user agent requests only a small part of a page, and just that section is returned.</li> </ul> <h3>Redirection</h3> <ul> <li id="k8e8ko4" class="reference"><strong>300 - Multiple Choices</strong><br /> The 300 status code indicates that a resource has moved. The response will also include a list of locations from which the user agent can select the most appropriate.</li> <li id="gs484q4" class="reference"><strong>301 - Moved Permanently</strong><br /> A status code of 301 tells a client that the resource they asked for has permanently moved to a new location. The response should also include this location. It tells the client to use the new URL the next time it wants to fetch the same resource.</li> <li id="i8u4e46" class="reference"><strong>302 - Found</strong><br /> A status code of 302 tells a client that the resource they asked for has temporarily moved to a new location. The response should also include this location. It tells the client that it should carry on using the same URL to access this resource.</li> <li id="i4si4su" class="reference"><strong>303 - See Other</strong><br /> A 303 status code indicates that the response to the request can be found at the specified URL, and should be retrieved from there. It does not mean that something has moved - it is simply specifying the address at which the response to the request can be found.</li> <li id="cguc6sy" class="reference"><strong>304 - Not Modified</strong><br /> The 304 status code is sent in response to a request (for a document) that asked for the document only if it was newer than the one the client already had. Normally, when a document is cached, the date it was cached is stored. The next time the document is viewed, the client asks the server if the document has changed. If not, the client just reloads the document from the cache.</li> <li id="myq44yy" class="reference"><strong>305 - Use Proxy</strong><br /> A 305 status code tells the client that the requested resource has to be reached through a proxy, which will be specified in the response.</li> <li id="yuomsc4" class="reference"><strong>307 - Temporary Redirect</strong><br /> 307 is the status code that is sent when a document is temporarily available at a different URL, which is also returned. There is very little difference between a 302 status code and a 307 status code. 307 was created as another, less ambiguous, version of the 302 status code.</li> </ul> <h3>Client Error</h3> <ul> <li id="8u88u64" class="reference"><strong>400 - Bad Request</strong><br /> A status code of 400 indicates that the server did not understand the request due to bad syntax.</li> <li id="augsmyq" class="reference"><strong>401 - Unauthorized</strong><br /> A 401 status code indicates that before a resource can be accessed, the client must be authorised by the server.</li> <li id="c8is4qy" class="reference"><strong>402 - Payment Required</strong><br /> The 402 status code is not currently in use, being listed as "reserved for future use".</li> <li id="iuwauce" class="reference"><strong>403 - Forbidden</strong><br /> A 403 status code indicates that the client cannot access the requested resource. That might mean that the wrong username and password were sent in the request, or that the permissions on the server do not allow what was being asked.</li> <li id="4o4i4i4" class="reference"><strong>404 - Not Found</strong><br /> The best known of them all, the 404 status code indicates that the requested resource was not found at the URL given, and the server has no idea how long for.</li> <li id="gkwq8q4" class="reference"><strong>405 - Method Not Allowed</strong><br /> A 405 status code is returned when the client has tried to use a request method that the server does not allow. Request methods that are allowed should be sent with the response (common request methods are POST and GET).</li> <li id="4soammu" class="reference"><strong>406 - Not Acceptable</strong><br /> The 406 status code means that, although the server understood and processed the request, the response is of a form the client cannot understand. A client sends, as part of a request, headers indicating what types of data it can use, and a 406 error is returned when the response is of a type not i that list.</li> <li id="8e84ikq" class="reference"><strong>407 - Proxy Authentication Required</strong><br /> The 407 status code is very similar to the 401 status code, and means that the client must be authorised by the proxy before the request can proceed.</li> <li id="kg8u4go" class="reference"><strong>408 - Request Timeout</strong><br /> A 408 status code means that the client did not produce a request quickly enough. A server is set to only wait a certain amount of time for responses from clients, and a 408 status code indicates that time has passed.</li> <li id="6usu4a4" class="reference"><strong>409 - Conflict</strong><br /> A 409 status code indicates that the server was unable to complete the request, often because a file would need to be editted, created or deleted, and that file cannot be editted, created or deleted.</li> <li id="w8co44u" class="reference"><strong>410 - Gone</strong><br /> A 410 status code is the 404's lesser known cousin. It indicates that a resource has permanently gone (a 404 status code gives no indication if a resource has gine permanently or temporarily), and no new address is known for it.</li> <li id="4a444gy" class="reference"><strong>411 - Length Required</strong><br /> The 411 status code occurs when a server refuses to process a request because a content length was not specified.</li> <li id="e4ga4wu" class="reference"><strong>412 - Precondition Failed</strong><br /> A 412 status code indicates that one of the conditions the request was made under has failed.</li> <li id="cque4aq" class="reference"><strong>413 - Request Entity Too Large</strong><br /> The 413 status code indicates that the request was larger than the server is able to handle, either due to physical constraints or to settings. Usually, this occurs when a file is sent using the POST method from a form, and the file is larger than the maximum size allowed in the server settings.</li> <li id="ykwi44s" class="reference"><strong>414 - Request-URI Too Long</strong><br /> The 414 status code indicates the the URL requested by the client was longer than it can process.</li> <li id="aa8wcks" class="reference"><strong>415 - Unsupported Media Type</strong><br /> A 415 status code is returned by a server to indicate that part of the request was in an unsupported format.</li> <li id="84gayyo" class="reference"><strong>416 - Requested Range Not Satisfiable</strong><br /> A 416 status code indicates that the server was unable to fulfill the request. This may be, for example, because the client asked for the 800th-900th bytes of a document, but the document was only 200 bytes long.</li> <li id="aimgm88" class="reference"><strong>417 - Expectation Failed</strong><br /> The 417 status code means that the server was unable to properly complete the request. One of the headers sent to the server, the "Expect" header, indicated an expectation the server could not meet.</li> </ul> <h3>Server Error</h3> <ul> <li id="8gu8qk8" class="reference"><strong>500 - Internal Server Error</strong><br /> A 500 status code (all too often seen by Perl programmers) indicates that the server encountered something it didn't expect and was unable to complete the request.</li> <li id="siyeqmy" class="reference"><strong>501 - Not Implemented</strong><br /> The 501 status code indicates that the server does not support all that is needed for the request to be completed.</li> <li id="q4som48" class="reference"><strong>502 - Bad Gateway</strong><br /> A 502 status code indicates that a server, while acting as a proxy, received a response from a server further upstream that it judged invalid.</li> <li id="goawq84" class="reference"><strong>503 - Service Unavailable</strong><br /> A 503 status code is most often seen on extremely busy servers, and it indicates that the server was unable to complete the request due to a server overload.</li> <li id="8aqcg48" class="reference"><strong>504 - Gateway Timeout</strong><br /> A 504 status code is returned when a server acting as a proxy has waited too long for a response from a server further upstream.</li> <li id="qs8gwwe" class="reference"><strong>505 - HTTP Version Not Supported</strong><br /> A 505 status code is returned when the HTTP version indicated in the request is no supported. The response should indicate which HTTP versions are supported.</li> </ul> </div><img src ="http://www.tkk7.com/usherlight/aggbug/324225.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2010-06-23 07:16 <a href="http://www.tkk7.com/usherlight/archive/2010/06/23/324225.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java comm操作串口http://www.tkk7.com/usherlight/archive/2010/06/18/323829.html云自无心水自?/dc:creator>云自无心水自?/author>Fri, 18 Jun 2010 09:06:00 GMThttp://www.tkk7.com/usherlight/archive/2010/06/18/323829.htmlhttp://www.tkk7.com/usherlight/comments/323829.htmlhttp://www.tkk7.com/usherlight/archive/2010/06/18/323829.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/323829.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/323829.html阅读全文

]]>
在myeclipse8.5中安装反~译插g(java decompiler)http://www.tkk7.com/usherlight/archive/2010/06/17/323676.html云自无心水自?/dc:creator>云自无心水自?/author>Wed, 16 Jun 2010 22:18:00 GMThttp://www.tkk7.com/usherlight/archive/2010/06/17/323676.htmlhttp://www.tkk7.com/usherlight/comments/323676.htmlhttp://www.tkk7.com/usherlight/archive/2010/06/17/323676.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/323676.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/323676.html"java decompiler"是一个非常出色的java反编译工P详见主页Qhttp://java.decompiler.free.fr/

在myeclipse8.5中的安装也比较简单,下蝲Qhttp://java.decompiler.free.fr/jd-eclipse/update/jdeclipse_update_site.zip
然后把这个压~包解开攑֜myeclipse8.5的dropins目录下,比如QC:\Programs\Genuitec\MyEclipse-8.5\dropins\jdeclipse_update_site
重vmyeclipsep了,W一ơ打开class文gQ可能会E微有一Ҏ(gu)Q要{待一会才会反编译出来?br />

好像q有炚w?



]]>
Spring Security - Using custom Authentication Processing Filterhttp://www.tkk7.com/usherlight/archive/2010/06/11/323293.html云自无心水自?/dc:creator>云自无心水自?/author>Fri, 11 Jun 2010 00:12:00 GMThttp://www.tkk7.com/usherlight/archive/2010/06/11/323293.htmlhttp://www.tkk7.com/usherlight/comments/323293.htmlhttp://www.tkk7.com/usherlight/archive/2010/06/11/323293.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/323293.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/323293.html springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* REQUEST INCLUDE FORWARD If you want to externalize all of your security related configuration into a separate file, you can do so and add that to your context location param. contextConfigLocation /WEB-INF/beans.xml , /WEB-INF/springSecurity.xml Now comes the part of security configuration for your application, Adding the URL security patterns is pretty simple and straight forward. Add all the URL patterns which you want to secure and add the wild card pattern at the end. You need to have some default principal and role even for non logged in users as you need to give access to pages like log in, register and forgot password kind of functionality even to non logged in users. I tried to add comments to pretty much every element which I am using here. As an example I added just a wild card intercept url which make every page of my application secure. You need to exclude different urls based on the roles. Following is my custom implementation of AuthenticationEntryPoint, which currently is not doing any thing except leveraging the commence to its super class which is the spring implementation of AuthenticationProcessingFilterEntryPoint. I hooked it to add any custom logic. public class CustomAuthenticationEntryPoint extends AuthenticationProcessingFilterEntryPoint { private static final Log logger = LogFactory.getLog(CustomAuthenticationEntryPoint.class); @Override public void commence(ServletRequest request, ServletResponse response, AuthenticationException authException) throws IOException, ServletException { super.commence(request, response, authException); } } This is my custom authentication manager which actually does the custom login of the user. It will throw an BadCredentialsException in case of invalid credentials or thorws a AuthenticationServiceException in case of a service error (Database error, SQL error or any other error). public class CustomAuthunticationManager implements AuthenticationManager { @Autowired UserManagerService userManagerService; public Authentication authenticate(Authentication authentication) throws AuthenticationException { if(StringUtils.isBlank((String) authentication.getPrincipal()) || StringUtils.isBlank((String) authentication.getCredentials())){ throw new BadCredentialsException("Invalid username/password"); } User user = null; GrantedAuthority[] grantedAuthorities = null; try{ user = userManagerService.getUser((String) authentication.getPrincipal(), (String) authentication.getCredentials()); } catch(InvalidCredentialsException ex){ throw new BadCredentialsException(ex.getMessage()); } catch(Exception e){ throw new AuthenticationServiceException("Currently we are unable to process your request. Kindly try again later."); } if (user != null) { List roles = user.getAssociatedRoles(); grantedAuthorities = new GrantedAuthority[roles.size()]; for (int i = 0; i < roles.size(); i++) { Role role = roles.get(i); GrantedAuthority authority = new GrantedAuthorityImpl(role.getRoleCode()); grantedAuthorities[i] = authority; } } else{ throw new BadCredentialsException("Invalid username/password"); } return new UsernamePasswordAuthenticationToken(user, authentication.getCredentials(), grantedAuthorities); } } At the client side (jsp), the simple configuration you need to do is post the request to"/j_spring_security_check" with parameters "j_username" and "j_password". That's pretty much all you need to do for enabling spring security to your existing web application. I will try to explain about doing the method security using ACL's and configuring the view using spring security tags in another post.

]]>
tapestry5.2 beta版已l完?/title><link>http://www.tkk7.com/usherlight/archive/2010/06/03/322593.html</link><dc:creator>云自无心水自?/dc:creator><author>云自无心水自?/author><pubDate>Thu, 03 Jun 2010 02:31:00 GMT</pubDate><guid>http://www.tkk7.com/usherlight/archive/2010/06/03/322593.html</guid><wfw:comment>http://www.tkk7.com/usherlight/comments/322593.html</wfw:comment><comments>http://www.tkk7.com/usherlight/archive/2010/06/03/322593.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/usherlight/comments/commentRss/322593.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/usherlight/services/trackbacks/322593.html</trackback:ping><description><![CDATA[<br /> 作者相信ga版本会在不久的未来发布?br /> 所作者透露Q在新版本中会增加一个新的组Ӟdynamic.<br /> <br /> q个lg的用途是更换皮肤。在旧版本的tapestry中,׃tapestry的模板是一致的Q所以要实现换肤相当困难?br /> 但在新版本中的这个组件比较完地解决了这个问题?br /> 作者自我评仯个组件是令hȀ动的一个新事物?br /> <br /> <br /><img src ="http://www.tkk7.com/usherlight/aggbug/322593.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/usherlight/" target="_blank">云自无心水自?/a> 2010-06-03 10:31 <a href="http://www.tkk7.com/usherlight/archive/2010/06/03/322593.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iBatis已经更名为MyBatisQƈ搬迁到Google Codehttp://www.tkk7.com/usherlight/archive/2010/05/24/321759.html云自无心水自?/dc:creator>云自无心水自?/author>Mon, 24 May 2010 11:58:00 GMThttp://www.tkk7.com/usherlight/archive/2010/05/24/321759.htmlhttp://www.tkk7.com/usherlight/comments/321759.htmlhttp://www.tkk7.com/usherlight/archive/2010/05/24/321759.html#Feedback2http://www.tkk7.com/usherlight/comments/commentRss/321759.htmlhttp://www.tkk7.com/usherlight/services/trackbacks/321759.html现在打开iBatis的主:ibatis.apache.org会发C者发布了一个新L者说是声明?br />
大意是因为各U原因,已经把iBatis更名为MyBatis, q且搬迁到Google Code中了?br />
新的主页地址是: http://www.mybatis.org

另外QMyBatis3.0.1的正式版已经?a >http://code.google.com/p/mybatis/可以下蝲了?br />



]]>
վ֩ģ壺 þþþ޾Ʒϵ| 鶹AV뾫Ʒþ| ˸ŮѲžþþ| ޾Ʒ˳| 99ƷƵƵѹۿ | Ƶ97| һؼŮ18ëƬƵ| Ʒһ| ɫͷվ| avպۺһ| ɫþþۺ| þó˹Ʒ| v߹ۿ| һ| ҹƵ| 57paoһƵ| Ůһ18| ձ߹ۿ| ѹۿƷ| ѹվ߹ۿ15| þ޾Ʒ| avһ | ޹ۺϾþ| 99reƵ| Ƭѹۿþ| һ߲| avһ߹ۿ | Ʒר벻| ޵һƵ| Ů˱˾޴| ѲƵһ| ĻѹۿƵ| ޷ŮһŶ| ޸߹ۿ| պĻһҳ| ƬaëƬ| þùɫAVѿ| ëƬ100ѹۿ| ߹ۿ| AVһ| һëƬ߹|