﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-我不是张嘎－小兵-文章分类-OpenSource</title><link>http://www.blogjava.net/grantbb/category/5754.html</link><description>期待交流</description><language>zh-cn</language><lastBuildDate>Wed, 18 Apr 2007 08:51:09 GMT</lastBuildDate><pubDate>Wed, 18 Apr 2007 08:51:09 GMT</pubDate><ttl>60</ttl><item><title>定制doclipse</title><link>http://www.blogjava.net/grantbb/articles/111621.html</link><dc:creator>我不是张嘎－小兵</dc:creator><author>我不是张嘎－小兵</author><pubDate>Wed, 18 Apr 2007 06:17:00 GMT</pubDate><guid>http://www.blogjava.net/grantbb/articles/111621.html</guid><wfw:comment>http://www.blogjava.net/grantbb/comments/111621.html</wfw:comment><comments>http://www.blogjava.net/grantbb/articles/111621.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/grantbb/comments/commentRss/111621.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/grantbb/services/trackbacks/111621.html</trackback:ping><description><![CDATA[<p>由于doclipse的提示冗余一些，所以，可自己定制提示信息。不需修改源码，即可完成。</p>
<p>1. 解压com.beust.doclipse.jar。</p>
<p>2. 找到/file/目录下，想要修改的xml文件，如果是struts，即为struts.xml。</p>
<p>3. 如果xml中缺项，加上即可，例@struts.action-forward中缺少redirect项，只需添加&lt;attribute name="redirect"/&gt;。其中属性required可以设定是否不需。</p>
<p>4. 然后在用jar打包，替换原先的jar，完成。</p>
<p>Eclipse中变换插件后，从2.1时发现，删除configration/org.eclipse.update目录下的platform.xml文件，然后重新启动Eclipse，插件就会起作用了。</p><img src ="http://www.blogjava.net/grantbb/aggbug/111621.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/grantbb/" target="_blank">我不是张嘎－小兵</a> 2007-04-18 14:17 <a href="http://www.blogjava.net/grantbb/articles/111621.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HttpURLConnection中如何设置网络超时</title><link>http://www.blogjava.net/grantbb/articles/69807.html</link><dc:creator>我不是张嘎－小兵</dc:creator><author>我不是张嘎－小兵</author><pubDate>Fri, 15 Sep 2006 01:56:00 GMT</pubDate><guid>http://www.blogjava.net/grantbb/articles/69807.html</guid><wfw:comment>http://www.blogjava.net/grantbb/comments/69807.html</wfw:comment><comments>http://www.blogjava.net/grantbb/articles/69807.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/grantbb/comments/commentRss/69807.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/grantbb/services/trackbacks/69807.html</trackback:ping><description><![CDATA[ Java中可以使用HttpURLConnection来请求WEB资源。<br />HttpURLConnection对象不能直接构造，需要通过URL.openConnection()来获得HttpURLConnection对象，示例代码如下：<br />String szUrl = "http://www.yesky.com/";<br />URL url = new URL(szUrl);<br />HttpURLConnection urlCon = (HttpURLConnection)url.openConnection(); 
<p></p><p style="LINE-HEIGHT: 150%">HttpURLConnection是基于HTTP协议的，其底层通过socket通信实现。如果不设置超时（timeout），在网络异常的情况下，可能会导致程序僵死而不继续往下执行。可以通过以下两个语句来设置相应的超时：<br />System.setProperty("sun.net.client.defaultConnectTimeout", 超时毫秒数字符串);<br />System.setProperty("sun.net.client.defaultReadTimeout", 超时毫秒数字符串);<br /></p><p style="LINE-HEIGHT: 150%">其中： sun.net.client.defaultConnectTimeout：连接主机的超时时间（单位：毫秒）<br />sun.net.client.defaultReadTimeout：从主机读取数据的超时时间（单位：毫秒） </p><p style="LINE-HEIGHT: 150%">例如：<br />System.setProperty("sun.net.client.defaultConnectTimeout", "30000");<br />System.setProperty("sun.net.client.defaultReadTimeout", "30000"); </p><p style="LINE-HEIGHT: 150%">JDK 1.5以前的版本，只能通过设置这两个系统属性来控制网络超时。在1.5中，还可以使用HttpURLConnection的父类URLConnection的以下两个方法：<br />setConnectTimeout：设置连接主机超时（单位：毫秒）<br />setReadTimeout：设置从主机读取数据超时（单位：毫秒） </p><p style="LINE-HEIGHT: 150%">例如：<br />HttpURLConnection urlCon = (HttpURLConnection)url.openConnection();<br />urlCon.setConnectTimeout(30000);<br />urlCon.setReadTimeout(30000); </p><p style="LINE-HEIGHT: 150%">需要注意的是，笔者在JDK1.4.2环境下，发现在设置了 defaultReadTimeout的情况下，如果发生网络超时，HttpURLConnection会自动重新提交一次请求，出现一次请求调用，请求服务器两次的问题（Trouble）。我认为这是JDK1.4.2的一个bug。在JDK1.5.0中，此问题已得到解决，不存在自动重发现象。</p><img src ="http://www.blogjava.net/grantbb/aggbug/69807.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/grantbb/" target="_blank">我不是张嘎－小兵</a> 2006-09-15 09:56 <a href="http://www.blogjava.net/grantbb/articles/69807.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>