java FTP²Ù×÷
¼òµ¥µÄдÁ˸öjava¶ÔftpµÄ²Ù×÷
ÓõÄÊÇcommons-net.jar°ü
FTPProxy.java
public class FTPProxy{
public FTPProxy()
{
super();
ftpClient = new FTPClient();
}
public FTPProxy(FTPBean entity)
{
this();
this.entity = entity;
}
private FTPBean entity;
private FTPClient ftpClient;
public void connection()
{
try
{
ftpClient.connect(entity.getServerIP());
ftpClient.login(entity.getUser(), entity.getPassword());
} catch (SocketException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
}
public void download()
{
FileOutputStream fos = null;
try
{
String remoteFile = entity.getSrcFile();
String remoteFileName = "";
if (0 == remoteFile.lastIndexOf("/"))
{
remoteFileName = remoteFile.substring(remoteFile
.lastIndexOf("/") + 1);
} else if (0 < remoteFile.lastIndexOf("/"))
{
remoteFileName = remoteFile.substring(remoteFile
.lastIndexOf("/") + 1);
String path = remoteFile.substring(0, remoteFile
.lastIndexOf("/"));
ftpClient.changeWorkingDirectory(path);
} else
{
remoteFileName = remoteFile;
}
fos = new FileOutputStream(entity.getTargetFile());
ftpClient.setBufferSize(1024 * 8);
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
ftpClient.retrieveFile(remoteFileName, fos);
} catch (IOException e)
{
e.printStackTrace();
} finally
{
try
{
fos.close();
ftpClient.disconnect();
} catch (IOException e)
{
e.printStackTrace();
}
}
}
public void upload()
{
FileInputStream fis = null;
try
{
File srcFile = new File(entity.getSrcFile());
fis = new FileInputStream(srcFile);
ftpClient.setBufferSize(1024 * 8);
ftpClient.setControlEncoding("GBK");
String ftpPath = entity.getFtpPath();
if(null!=ftpPath&&!"".equals(ftpPath))
{
ftpClient.makeDirectory(ftpPath);
ftpClient.changeWo
Ïà¹ØÎĵµ£º
´«ÖDz¥¿ÍJAVAÅàѵ2010-4-29Lucene×ܽá
½ñÌìÐÄÇé²»´í£¬±±¾©µÄÌìÖÕÓÚ¶³öÁËÌ«ÑôÄÇ»¨¶ùÒ»°ãµÄÁ³µ°¶ù£¬ÐÄÇéÒ²²»ÓÉÒò´Ë¶øÉú³öϲÔã¬ÈË×ÜÊÇ»áÊÜ»·¾³µÄÓ°Ï죬ÏÂÎç»ØÀ´ÐÂÎÅÖÐÎÒ¿´µ½¹ã¶«ÄDZ߷¢ÉúµÄÊ£¬ÎÒÐÄÇé˵²»³öÀ´µÄ³ÁÖØ£¬ÎªÊ²Ã´ÕâЩÈ˲»ºÃºÃÕäϧÉú»îÄØ£¿ÎªÊ²Ã´ÒªÄÃÄÇЩÎÞ¹¼µÄСº¢×Ó³öÆø£¬°¦£¡
Éú»îÒÀȻҪ¼ÌÐø£¬Ñ§Ï°ÒÀ¾ÉÒª¼ÌÐ ......
Ò»£ºµ½http://tuckey.org/urlrewrite/ ÏÂÔØurlrewrite¼Ü°ü£¨ÍƼö2.6.0£©
¡¡¡¡¶þ£º½âѹËùÏÂÔØµÄÎļþ,°Ñurlrewrite-2.6.0.jar¸´ÖƵ½ÏîÄ¿µÄWebRoot/WEB-INF/lib/Ŀ¼ÏÂ
¡¡¡¡Èý£º°Ñurlrewrite.xml¸´ÖƵ½ÏîÄ¿µÄWebRoot/WEB-INF/Ŀ¼ÏÂ
¡¡¡¡ËÄ£ºÔÚweb.xmlÎļþÖмÓÈëÒÔÏÂ
¡¡¡¡<filter>
¡¡¡¡<filter-name>Ur ......
JavaÖеĻص÷£¨callback£©ÊǺÜÖØÒªµÄÒ»¸ö¸ÅÄspringÕûºÏhibernate´óÁ¿Ê¹ÓÃÁËÕâÖÖ¼¼Êõ¡£
¾¿¾¹ÔõÑù²ÅÊǻص÷ÄØ£¿
ÕâÊÇÍøÉÏ×î¶à¼ûµ½µÄ˵Ã÷£º
1.class A,class B
2.class AʵÏÖ½Ó¿Úcallback
3.class BÓµÓÐÒ»¸ ......
1.JavaÀïÃæÊ¹ÓÃ
static
·½·¨ÓÐʲôºÃ´¦£¿
´ð£ºÔÚÏîÄ¿ÖУ¬¶ÔÓÚÆµ·±Ê¹Óõķ½·¨£¬Ê¹ÓÃstatic
ÐÞÊλáÌá¸ßЧÂÊÂð£¿
¾²Ì¬·½·¨µÄºÃ´¦¾ÍÊDz»ÓÃÉú³ÉÀàµÄʵÀý¾ÍÄÜÖ±½Óµ÷ÓúͶÔÏóÎÞ¹Ø
Äã²»ÓÃÉú³É¶ÔÏó¾ÍÄÜÓÃÕâ¸ö·½·¨ÁË£¬²»ÊÇÌá¸ßЧÂÊ£¿ÄãÉú³É¶ÔÏóµÃÕ¼ÓÃÄÚ´æ¿Õ¼ä°¡
ÖÁÓÚ¾²Ì¬ÊôÐÔÒ²ÄÜÌá¸ßЧÂÊ£¬ÄãÆÕͨµÄÊôÐÔÿ¸öÀà¶Ô ......