ÓÃJavaдÅÀÍøÒ³µÄС¹¤¾ß
ÆäʵҲ²»ÊÇÅÀÍøÒ³£¬Ö»ÊÇ´ÓÒ»¸öXMLÎļþÈ¡URL£¬È»ºó×¥È¡ÍøÒ³ÄÚÈÝ¡£
Ö÷ÒªÓм¸µã£¬±¸Íü£º
1. È«¾Ö´úÀí£¬ÉèÖÃÖ®ºóËùÓеÄURL¶¼Ê¹Óô˴úÀí£¬ÕâÑù¿ÉÒÔÖ±½Óµ÷ÓÃFileUtils.copyURLToFile£º
private void initProxy(String host, int port,
final String username, final String password) {
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username,
password.toCharArray());
}
});
System.setProperty("http.proxyType", "4");
System.setProperty("http.proxyPort",
Integer.toString(port));
System.setProperty("http.proxyHost", host);
System.setProperty("http.proxySet", "true");
}
2. ÉèÖÃUser-Agent£¬ÓÐЩվµã½ûÖ¹Java×÷Ϊ·ÃÎʿͻ§¶Ë£¬±ØÐëͨ¹ýURLConnectionÉèÖÃUser-AgentÀ´Ä£Äâä¯ÀÀÆ÷£¬ËùÒÔ²»ÄÜÓÃFileUtils.copyURLToFile£¬¸´ÖÆÆäÔ´ÂëСÐÞ¸Äһϼ´¿É£º
URLConnection httpConnection = new URL(url).openConnection();
httpConnection.setRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
File dest = new File(path);
InputStream input = httpConnection.getInputStream();
try {
FileOutputStream output = FileUtils.openOutputStream(dest);
try {
IOUtils.copy(input, output);
} finally {
IOUtils.closeQuietly(output);
}
} finally {
IOUtils.closeQuietly(input);
}
3.dom4j¶ÁÈ¡³¬´óxmlÎļþ£¬Ê¹ÓÃevent basedģʽ·ÀÖ¹¶ÑÒç³ö´íÎó£º
reader.addHandler("/RDF/ExternalPage", new ElementHandler() {
public void onStart(ElementPath path) {
}
public void onEnd(ElementPath path) {
Element node = path.getCurrent();
// ½ÚµãÏà¹Ø²Ù×÷
// ¹Ø¼ü²Ù×÷£¬´ÓÄÚ´æµÄ½ÚµãÊ÷ÖÐÌÞ³ý½Úµã£¬ÊÍ·ÅÄÚ´æ
node.detach();
}
});
4.¶àÏ߳̿ÉÒÔÓÃjdk1.5мÓÈëµÄÏ̳߳Øjava.util.concurrent.ThreadPoolExecutor£¬·½±ãʵÓá£ÉÔ΢ҪעÒâµÄ¾ÍÊÇÔÚÌí¼ÓÍêËùÓÐÈÎÎñºó¼ÇµÃÖ´ÐÐÒ»ÏÂThreadPoolExecutor.shutdown()¡£
Ïà¹ØÎĵµ£º
Java¶Ô¶ÔÏóºÍ»ù±¾µÄÊý¾ÝÀàÐ͵Ĵ¦ÀíÊDz»Ò»ÑùµÄ¡£¶Ô»ù±¾µÄÊý¾ÝÀàÐÍÀàËÆÓÚC/C++Öеķ½·¨£¨Öµ´«µÝ£©¡£ÔÚJavaÖÐÓöÔÏóµÄ×÷ΪÈë¿Ú²ÎÊýµÄ´«µÝÔòȱʡΪ"ÒýÓô«µÝ"£¬Ò²¾ÍÊÇ˵½ö½ö´«µÝÁ˶ÔÏóµÄÒ»¸ö"ÒýÓÃ"£¬Õâ¸ö"ÒýÓÃ"µÄ¸ÅÄîͬCÓïÑÔÖеÄÖ¸ÕëÒýÓÃÊÇÒ»ÑùµÄ¡£µ±º¯ÊýÌåÄÚ²¿¶ÔÊäÈë±äÁ¿¸Ä±äʱ£¬ÊµÖÊÉϾÍÊÇÔÚ¶Ô ......
<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@ËÎÌå" ......
ÔÎÄ£º http://blog.sina.com.cn/s/blog_4e0c121101000awr.html
(ÕâÊÇÎÒÄê³õдµÄһƪÎÄÕ£¬µ«³Ù³ÙûÓй«¿ª¡£ÓÐЩÄÚÈÝ¿ÉÄÜÒѾ¹ýʱ£¬µ«»¹ÊÇÖµµÃÒ»¶Á.)
¾¹ý½«½ü10ÄêµÄ·¢Õ¹ºó£¬Java EEÒѾÑݱäΪµ±Ç°ÆóÒµµÄÖ÷Á÷¼ÆËãÆ½Ì¨¡£¿ª·¢ÕßÔÙÒ²²»Äܹ»¼ò¼òµ¥µ¥µØ½«Java¿´³ÉÒ»ÖÖ±à³ÌÓïÑÔÁË£¬Æä²úÒµºÍ¼¼ÊõÁ´ÒÑ¾É ......
Òì³£ Underlying input stream returned zero bytes ½â¾ö°ì·¨
ϵͳ»·¾³
jdk1.5
hibernate 3.0
sql server 2000
ms jdbc driver
½«Ò»¸övarcharÀàÐ͵Ä×ֶθÄΪtextºó£¬¾Í³öÏÖ
[Microsoft][SQLServer 2000 Driver for JDBC]Underlying input stream returned zero bytes µÄÒì³£ÁË¡£
´ÓÍøÉÏËѼ¯×ÊÁÏÀ´¿´£¬ÓÉÓÚjdbcµÄbug ......