package download;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DownLoadFile extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 3089316329737765177L;
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException{
doPost(request,response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException{
try {
downLoad(response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void downLoad(HttpServletResponse response) throws Exception {
BufferedOutputStream bos = null;
BufferedInputStream bis = null;
try {
bis = new BufferedInputStream(new FileInputStream("c:/head.PNG"));
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buff = new byte[2048];
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff,0,bytesRead);
}
} catch(final IOException e) {
e.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}finally {
if (bis != null)
bis.close();
if (bos != null)
{
bos.flush();
bos.close();
bos=null;
}
}
response.flushBuffer();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Flex 使用URLStream读取服务器端图片文件流并显示
共43个文件
jar:12个
xml:6个
html:4个
5星 · 超过95%的资源 需积分: 33 543 下载量 109 浏览量
2009-11-13
23:27:01
上传
评论 2
收藏 4.7MB ZIP 举报
温馨提示
在flex中显示服务器端的图片可以使用Image控件的source属性,但是这个条件必须是客户端可以访问到的有效的URL地址。如果图片存储在数据库中,直接使用source属性是无法显示图片的。这种情况下可以使用flex中的URLStream类来读取文件流,然后把文件显示到画面上。 使用本例子,必须在C:/放置一个名字为“head.PNG”的图片
资源推荐
资源详情
资源评论
收起资源包目录
LoadPicture.zip (43个子文件)
LoadPicture
.project 1KB
flex_libs
.settings
org.eclipse.core.resources.prefs 88B
org.eclipse.wst.common.component 592B
org.eclipse.jdt.core.prefs 330B
org.eclipse.wst.common.project.facet.core.xml 269B
org.eclipse.jst.common.project.facet.core.prefs 364B
.actionScriptProperties 1KB
html-template
AC_OETags.js 8KB
index.template.html 4KB
history
history.js 24KB
historyFrame.html 827B
history.css 371B
playerProductInstall.swf 657B
src
download
DownLoadFile.java 2KB
WebContent
WEB-INF
flex
messaging-config.xml 513B
remoting-config.xml 383B
services-config.xml 4KB
proxy-config.xml 826B
web.xml 2KB
src
lib
commons-logging.jar 37KB
backport-util-concurrent.jar 319KB
cfgatewayadapter.jar 15KB
flex-messaging-proxy.jar 65KB
commons-httpclient-3.0.1.jar 273KB
flex-messaging-remoting.jar 18KB
commons-codec-1.3.jar 46KB
concurrent.jar 168KB
flex-messaging-common.jar 88KB
flex-messaging-core.jar 629KB
flex-messaging-opt.jar 20KB
xalan.jar 3MB
classes
download
DownLoadFile.class 2KB
META-INF
MANIFEST.MF 253B
bin-debug
AC_OETags.js 8KB
LoadPicture.swf 407KB
history
history.js 24KB
historyFrame.html 827B
history.css 371B
playerProductInstall.swf 657B
LoadPicture.html 4KB
.classpath 546B
flex_src
LoadPicture.mxml 1KB
.flexProperties 324B
共 43 条
- 1
To9m
- 粉丝: 91
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页