Use content-disposition to provide a save-as popup on browser

一月 21, 2008 @ 8:17 下午 | 发表在 J2EE, Java | 留下评论

Often times you need to prompt user a save-as dialog box with a default file name. This can be done through the content-disposition HTTP header. A sample java code snippet follows:

// Set the headers.
res.setHeader(“Content-Disposition”, “attachment; filename=” + filename);

// Send the file.
OutputStream out = res.getOutputStream(  );


Remote Debug a java program

十月 12, 2007 @ 12:16 上午 | 发表在 Java | 留下评论

Add the following options while bringing up the application
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
To debug from a local machine, use
jdb -attach 8000
To debug from a remote machine, use
jdb -connect,port=8000

通过访问 创建免费网站或博客.
Entries评论 feeds.