- 浏览: 510312 次
- 性别:
- 来自: 远方
文章分类
最新评论
-
futoviny:
挺有用的 javax.xml.ws.Holder
CXF学习笔记---让通过参数传递数据 -
zqb666kkk:
能提供下示例demo吗
CXF学习笔记---给CXF加一把锁WS_SECURITY应用 -
hello_world_wdq:
真是坑爹,这能用吗,害我半天时间浪费了
Extjs学习总结---RowExpander 的异步调用 -
ubuntu的疯狂:
第一段代码怎么用????求解释!!弄了很久还是不得结果……
Extjs学习总结---RowExpander 的异步调用 -
107x:
不错,谢谢分享!
[log4j]Slf4j的包冲突
AppFuse中经过分析使用了大量的开源框架和组件。个人认为整个后台还不是强大,可能与它的定位有关联。我们在项目中积累了大量的Spring以及Hibernate应用都要比之要强很多。但appFuse的前台整合还是相当不错的。先学一个gzipFilter
gzipFilter其实就位于eHcache里面,他是将response中的东东都压缩一下,这个可大大减少了传输时间。
配置web.xml
效果,你可以用FoxFire的net看各个css,js文件可是压缩50%以上哦。
写了一个jsp文件专门评估
应用服务器应该都支持压缩吧,weblogic和tomcat都可以,在app中实现有什么好处呢?不会增加复杂性和出错的概率吗?
gzipFilter其实就位于eHcache里面,他是将response中的东东都压缩一下,这个可大大减少了传输时间。
配置web.xml
<filter> <filter-name>gzipFilter</filter-name> <filter-class> net.sf.ehcache.constructs.web.filter.GzipFilter </filter-class> </filter> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.png</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.gif</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.json</url-pattern> </filter-mapping>
效果,你可以用FoxFire的net看各个css,js文件可是压缩50%以上哦。
写了一个jsp文件专门评估
<%@ page language="java" import="java.util.*,java.net.*,java.io.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <% String url = request.getParameter("url"); if (url != null) { URL noCompress = new URL(url); HttpURLConnection huc = (HttpURLConnection) noCompress .openConnection(); huc.setRequestProperty("user-agent", "Mozilla(MSIE)"); huc.connect(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = huc.getInputStream(); while (is.read() != -1) { baos.write((byte) is.read()); } byte[] b1 = baos.toByteArray(); URL compress = new URL(url); HttpURLConnection hucCompress = (HttpURLConnection) noCompress .openConnection(); hucCompress.setRequestProperty("accept-encoding", "gzip"); hucCompress.setRequestProperty("user-agent", "Mozilla(MSIE)"); hucCompress.connect(); ByteArrayOutputStream baosCompress = new ByteArrayOutputStream(); InputStream isCompress = hucCompress.getInputStream(); while (isCompress.read() != -1) { baosCompress.write((byte) isCompress.read()); } byte[] b2 = baosCompress.toByteArray(); request.setAttribute("t1", new Integer(b1.length)); request.setAttribute("t2", new Integer(b2.length)); request.setAttribute("t3", (1 - new Double(b2.length) / new Double(b1.length)) * 100); } request.setAttribute("url", url); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'MyJsp.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> This is my JSP page. <br> <h1> Compression Test </h1> Enter a URL to test. <form method="POST"> <input name="url" size="50"> <input type="submit" value="Check URL"> </form> <p> <%=url%> <b>Testing: ${url}</b> </p> Request 1: ${t1} bytes <%=request.getAttribute("t1")%> <br /> Request 2: ${t2} bytes <%=request.getAttribute("t2")%> <br /> Space saved: ${t1-t2} bytes or ${(1-t2/t1)*100}% <%=request.getAttribute("t3")%>% <br /> </body> </html>
评论
3 楼
erichua
2008-10-10
我的理解是tomcat等应用服务器是对所有网站内容都进行压缩。而用应用程序可以选择性的进行,更多一些灵活性吧。其实效果是一样的。在应用程序中更灵活一些。
erichua 写道AppFuse中经过分析使用了大量的开源框架和组件。个人认为整个后台还不是强大,可能与它的定位有关联。我们在项目中积累了大量的Spring以及Hibernate应用都要比之要强很多。但appFuse的前台整合还是相当不错的。先学一个gzipFilter
gzipFilter其实就位于eHcache里面,他是将response中的东东都压缩一下,这个可大大减少了传输时间。
配置web.xml
Java代码 <filter> <filter-name>gzipFilter</filter-name> <filter-class> net.sf.ehcache.constructs.web.filter.GzipFilter </filter-class> </filter> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.png</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.gif</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.json</url-pattern> </filter-mapping> <filter>
<filter-name>gzipFilter</filter-name>
<filter-class>
net.sf.ehcache.constructs.web.filter.GzipFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.png</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.gif</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.json</url-pattern>
</filter-mapping>
效果,你可以用FoxFire的net看各个css,js文件可是压缩50%以上哦。
写了一个jsp文件专门评估
Java代码 <%@ page language="java" import="java.util.*,java.net.*,java.io.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <% String url = request.getParameter("url"); if (url != null) { URL noCompress = new URL(url); HttpURLConnection huc = (HttpURLConnection) noCompress .openConnection(); huc.setRequestProperty("user-agent", "Mozilla(MSIE)"); huc.connect(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = huc.getInputStream(); while (is.read() != -1) { baos.write((byte) is.read()); } byte[] b1 = baos.toByteArray(); URL compress = new URL(url); HttpURLConnection hucCompress = (HttpURLConnection) noCompress .openConnection(); hucCompress.setRequestProperty("accept-encoding", "gzip"); hucCompress.setRequestProperty("user-agent", "Mozilla(MSIE)"); hucCompress.connect(); ByteArrayOutputStream baosCompress = new ByteArrayOutputStream(); InputStream isCompress = hucCompress.getInputStream(); while (isCompress.read() != -1) { baosCompress.write((byte) isCompress.read()); } byte[] b2 = baosCompress.toByteArray(); request.setAttribute("t1", new Integer(b1.length)); request.setAttribute("t2", new Integer(b2.length)); request.setAttribute("t3", (1 - new Double(b2.length) / new Double(b1.length)) * 100); } request.setAttribute("url", url); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'MyJsp.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> This is my JSP page. <br> <h1> Compression Test </h1> Enter a URL to test. <form method="POST"> <input name="url" size="50"> <input type="submit" value="Check URL"> </form> <p> <%=url%> <b>Testing: ${url}</b> </p> Request 1: ${t1} bytes <%=request.getAttribute("t1")%> <br /> Request 2: ${t2} bytes <%=request.getAttribute("t2")%> <br /> Space saved: ${t1-t2} bytes or ${(1-t2/t1)*100}% <%=request.getAttribute("t3")%>% <br /> </body> </html> <%@ page language="java" import="java.util.*,java.net.*,java.io.*"
pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<%
String url = request.getParameter("url");
if (url != null) {
URL noCompress = new URL(url);
HttpURLConnection huc = (HttpURLConnection) noCompress
.openConnection();
huc.setRequestProperty("user-agent", "Mozilla(MSIE)");
huc.connect();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream is = huc.getInputStream();
while (is.read() != -1) {
baos.write((byte) is.read());
}
byte[] b1 = baos.toByteArray();
URL compress = new URL(url);
HttpURLConnection hucCompress = (HttpURLConnection) noCompress
.openConnection();
hucCompress.setRequestProperty("accept-encoding", "gzip");
hucCompress.setRequestProperty("user-agent", "Mozilla(MSIE)");
hucCompress.connect();
ByteArrayOutputStream baosCompress = new ByteArrayOutputStream();
InputStream isCompress = hucCompress.getInputStream();
while (isCompress.read() != -1) {
baosCompress.write((byte) isCompress.read());
}
byte[] b2 = baosCompress.toByteArray();
request.setAttribute("t1", new Integer(b1.length));
request.setAttribute("t2", new Integer(b2.length));
request.setAttribute("t3", (1 - new Double(b2.length)
/ new Double(b1.length)) * 100);
}
request.setAttribute("url", url);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'MyJsp.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
This is my JSP page.
<br>
<h1>
Compression Test
</h1>
Enter a URL to test.
<form method="POST">
<input name="url" size="50">
<input type="submit" value="Check URL">
</form>
<p>
<%=url%>
<b>Testing: ${url}</b>
</p>
Request 1: ${t1} bytes
<%=request.getAttribute("t1")%>
<br />
Request 2: ${t2} bytes
<%=request.getAttribute("t2")%>
<br />
Space saved: ${t1-t2} bytes or ${(1-t2/t1)*100}%
<%=request.getAttribute("t3")%>%
<br />
</body>
</html>
应用服务器应该都支持压缩吧,weblogic和tomcat都可以,在app中实现有什么好处呢?不会增加复杂性和出错的概率吗?
heyosi 写道
erichua 写道AppFuse中经过分析使用了大量的开源框架和组件。个人认为整个后台还不是强大,可能与它的定位有关联。我们在项目中积累了大量的Spring以及Hibernate应用都要比之要强很多。但appFuse的前台整合还是相当不错的。先学一个gzipFilter
gzipFilter其实就位于eHcache里面,他是将response中的东东都压缩一下,这个可大大减少了传输时间。
配置web.xml
Java代码 <filter> <filter-name>gzipFilter</filter-name> <filter-class> net.sf.ehcache.constructs.web.filter.GzipFilter </filter-class> </filter> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.png</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.gif</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.json</url-pattern> </filter-mapping> <filter>
<filter-name>gzipFilter</filter-name>
<filter-class>
net.sf.ehcache.constructs.web.filter.GzipFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.png</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.gif</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipFilter</filter-name>
<url-pattern>*.json</url-pattern>
</filter-mapping>
效果,你可以用FoxFire的net看各个css,js文件可是压缩50%以上哦。
写了一个jsp文件专门评估
Java代码 <%@ page language="java" import="java.util.*,java.net.*,java.io.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <% String url = request.getParameter("url"); if (url != null) { URL noCompress = new URL(url); HttpURLConnection huc = (HttpURLConnection) noCompress .openConnection(); huc.setRequestProperty("user-agent", "Mozilla(MSIE)"); huc.connect(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = huc.getInputStream(); while (is.read() != -1) { baos.write((byte) is.read()); } byte[] b1 = baos.toByteArray(); URL compress = new URL(url); HttpURLConnection hucCompress = (HttpURLConnection) noCompress .openConnection(); hucCompress.setRequestProperty("accept-encoding", "gzip"); hucCompress.setRequestProperty("user-agent", "Mozilla(MSIE)"); hucCompress.connect(); ByteArrayOutputStream baosCompress = new ByteArrayOutputStream(); InputStream isCompress = hucCompress.getInputStream(); while (isCompress.read() != -1) { baosCompress.write((byte) isCompress.read()); } byte[] b2 = baosCompress.toByteArray(); request.setAttribute("t1", new Integer(b1.length)); request.setAttribute("t2", new Integer(b2.length)); request.setAttribute("t3", (1 - new Double(b2.length) / new Double(b1.length)) * 100); } request.setAttribute("url", url); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'MyJsp.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> This is my JSP page. <br> <h1> Compression Test </h1> Enter a URL to test. <form method="POST"> <input name="url" size="50"> <input type="submit" value="Check URL"> </form> <p> <%=url%> <b>Testing: ${url}</b> </p> Request 1: ${t1} bytes <%=request.getAttribute("t1")%> <br /> Request 2: ${t2} bytes <%=request.getAttribute("t2")%> <br /> Space saved: ${t1-t2} bytes or ${(1-t2/t1)*100}% <%=request.getAttribute("t3")%>% <br /> </body> </html> <%@ page language="java" import="java.util.*,java.net.*,java.io.*"
pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<%
String url = request.getParameter("url");
if (url != null) {
URL noCompress = new URL(url);
HttpURLConnection huc = (HttpURLConnection) noCompress
.openConnection();
huc.setRequestProperty("user-agent", "Mozilla(MSIE)");
huc.connect();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream is = huc.getInputStream();
while (is.read() != -1) {
baos.write((byte) is.read());
}
byte[] b1 = baos.toByteArray();
URL compress = new URL(url);
HttpURLConnection hucCompress = (HttpURLConnection) noCompress
.openConnection();
hucCompress.setRequestProperty("accept-encoding", "gzip");
hucCompress.setRequestProperty("user-agent", "Mozilla(MSIE)");
hucCompress.connect();
ByteArrayOutputStream baosCompress = new ByteArrayOutputStream();
InputStream isCompress = hucCompress.getInputStream();
while (isCompress.read() != -1) {
baosCompress.write((byte) isCompress.read());
}
byte[] b2 = baosCompress.toByteArray();
request.setAttribute("t1", new Integer(b1.length));
request.setAttribute("t2", new Integer(b2.length));
request.setAttribute("t3", (1 - new Double(b2.length)
/ new Double(b1.length)) * 100);
}
request.setAttribute("url", url);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'MyJsp.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
This is my JSP page.
<br>
<h1>
Compression Test
</h1>
Enter a URL to test.
<form method="POST">
<input name="url" size="50">
<input type="submit" value="Check URL">
</form>
<p>
<%=url%>
<b>Testing: ${url}</b>
</p>
Request 1: ${t1} bytes
<%=request.getAttribute("t1")%>
<br />
Request 2: ${t2} bytes
<%=request.getAttribute("t2")%>
<br />
Space saved: ${t1-t2} bytes or ${(1-t2/t1)*100}%
<%=request.getAttribute("t3")%>%
<br />
</body>
</html>
应用服务器应该都支持压缩吧,weblogic和tomcat都可以,在app中实现有什么好处呢?不会增加复杂性和出错的概率吗?
2 楼
erichua
2008-10-10
我的理解是tomcat等应用服务器是对所有网站内容都进行压缩。而用应用程序可以选择性的进行,更多一些灵活性吧。其实效果是一样的。在应用程序中更灵活一些。
1 楼
heyosi
2008-10-07
erichua 写道
AppFuse中经过分析使用了大量的开源框架和组件。个人认为整个后台还不是强大,可能与它的定位有关联。我们在项目中积累了大量的Spring以及Hibernate应用都要比之要强很多。但appFuse的前台整合还是相当不错的。先学一个gzipFilter
gzipFilter其实就位于eHcache里面,他是将response中的东东都压缩一下,这个可大大减少了传输时间。
配置web.xml
效果,你可以用FoxFire的net看各个css,js文件可是压缩50%以上哦。
写了一个jsp文件专门评估
gzipFilter其实就位于eHcache里面,他是将response中的东东都压缩一下,这个可大大减少了传输时间。
配置web.xml
<filter> <filter-name>gzipFilter</filter-name> <filter-class> net.sf.ehcache.constructs.web.filter.GzipFilter </filter-class> </filter> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.png</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.gif</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>gzipFilter</filter-name> <url-pattern>*.json</url-pattern> </filter-mapping>
效果,你可以用FoxFire的net看各个css,js文件可是压缩50%以上哦。
写了一个jsp文件专门评估
<%@ page language="java" import="java.util.*,java.net.*,java.io.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <% String url = request.getParameter("url"); if (url != null) { URL noCompress = new URL(url); HttpURLConnection huc = (HttpURLConnection) noCompress .openConnection(); huc.setRequestProperty("user-agent", "Mozilla(MSIE)"); huc.connect(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = huc.getInputStream(); while (is.read() != -1) { baos.write((byte) is.read()); } byte[] b1 = baos.toByteArray(); URL compress = new URL(url); HttpURLConnection hucCompress = (HttpURLConnection) noCompress .openConnection(); hucCompress.setRequestProperty("accept-encoding", "gzip"); hucCompress.setRequestProperty("user-agent", "Mozilla(MSIE)"); hucCompress.connect(); ByteArrayOutputStream baosCompress = new ByteArrayOutputStream(); InputStream isCompress = hucCompress.getInputStream(); while (isCompress.read() != -1) { baosCompress.write((byte) isCompress.read()); } byte[] b2 = baosCompress.toByteArray(); request.setAttribute("t1", new Integer(b1.length)); request.setAttribute("t2", new Integer(b2.length)); request.setAttribute("t3", (1 - new Double(b2.length) / new Double(b1.length)) * 100); } request.setAttribute("url", url); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'MyJsp.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> This is my JSP page. <br> <h1> Compression Test </h1> Enter a URL to test. <form method="POST"> <input name="url" size="50"> <input type="submit" value="Check URL"> </form> <p> <%=url%> <b>Testing: ${url}</b> </p> Request 1: ${t1} bytes <%=request.getAttribute("t1")%> <br /> Request 2: ${t2} bytes <%=request.getAttribute("t2")%> <br /> Space saved: ${t1-t2} bytes or ${(1-t2/t1)*100}% <%=request.getAttribute("t3")%>% <br /> </body> </html>
应用服务器应该都支持压缩吧,weblogic和tomcat都可以,在app中实现有什么好处呢?不会增加复杂性和出错的概率吗?
发表评论
-
[Quartz]Spring3.0不支持Quartz2.0
2011-09-13 08:28 4536将quartz从1.7升级到2.01 发现Caused by ... -
spring读书笔记----Quartz Trigger JobStore出错解决
2010-10-20 06:22 10841将Quartz的JOBDetail,Trigger保持到数据库 ... -
spring读书笔记----<context:component-scan/>和<context:annotation-config/>
2010-10-19 03:05 4196<context:annotation-config/& ... -
Spring读书笔记------RedirectView不传递session
2010-01-19 08:44 2012程序中反复才发现原来spring中RedirectView不传 ... -
Spring读书笔记-------使用activeMq
2010-01-15 07:11 1573在spring中使用activeMq 版本:spring 2 ... -
Spring总结-----properties文件load
2009-10-29 05:59 5397Spring中property用来存放application的 ... -
Spring----Quartz总结
2009-10-23 02:50 3653Quartz的关键元素结构图: ... -
Spring总结-----@Component,@Service,@Controller,@Repository
2009-10-20 05:24 13668在一个稍大的项目中, ... -
Spring JsonView--对输出对象属性的过滤
2008-12-20 08:09 3793由于Spring中的对象可以获取子对象,但json输出的时候会 ... -
Spring Security Acl- MethodSecurityInterceptor冲突解决
2008-12-09 08:01 4193在Spring Security Acl中使用methodSe ... -
Spring Security Acl- Mysql数据脚本带sample
2008-11-26 08:04 2078SET SQL_MODE="NO_AUTO_VALU ... -
getSession与getHibernateTemplate的区别
2008-11-18 03:55 6108一直都很疑惑在spring框架中getSession与getH ... -
Appfuse2学习笔记--full-source时proxy错误处理
2008-11-06 07:03 1456公司有proxy但在mvn和svn都设置好了平时使用一直没有觉 ... -
CXF学习笔记---给CXF加一把锁WS_SECURITY应用
2008-10-02 05:33 17209CXF的webService已经创建好,但没有安全可言,毕竟这 ... -
CXF客户端调用
2008-10-01 07:36 6284上一篇我用acgei绑定的方式创建了一个Web Service ... -
快速使用Spring 2.5 和 Apache CXF 2.0, 以前的Xfire创建webServ
2008-10-01 07:31 3957在这个Demo中我如何使用Spring 2.5 和 Apach ... -
Spring的command属性的绑定
2008-09-27 01:33 2297开发当中发现extjs的checkbox的value是on o ... -
MultiAction的灵活应用
2008-09-04 00:56 1371按照参数设置和按照method混合配置 <?xml ...
相关推荐
建立项目原型骨架的步骤(最新版本appfuse)appfuse2.1.0-M2 spring3.0 hibernte3.3 struts2.1.8
关于企业人员管理的struts应用样例,包含人员添加、信息修改及注销等。
appfuse对java web开发很有帮助,里边用了分层的思想进行开发的
NULL 博文链接:https://savagegarden.iteye.com/blog/427169
AppFuse是目前最火热的开源项目,采用如SSH架构等,是优秀的系统开发框架。
Appfuse 一个开放源码的项目和应用程序,帮助我们快速而高效的地开发。 Appfuse是Matt Raible 开发的一个指导性的入门级J2EE框架,它对如何集成流行的Spring、Hibernate、iBatis、Struts、xDcolet、Junit、Taperstry...
Appfuse是Matt Raible 开发的一个指导性的入门级J2EE框架,它对如何集成流行的Spring、Hibernate、iBatis、Struts、xDcolet、Junit、Taperstry、JSF等基础框架给出...AppFuse2.0重构了AppFuse1.0,转到Maven2和Jdk1.5。
AppFuse是一个集成了众多当前最流行开源框架与工具(包括Hibernate、ibatis、Struts、Spring、DBUnit、Ant、Log4J、Struts Menu、Xdoclet、SiteMesh、OSCache、JUnit、JSTL)于一身的Web开发框架。AppFuse提供了Web...
主要是自己从网络上搜集的一些关于appfuse1.8.2-2.0.2的一些相关资料,间或有点自己试验的记录,还有点maven和quartz的东东,之前我主要是用1.8.2构建项目,感觉还不错,希望对想学习appfuse的人有些帮助.
自己学习appfuse2的相关日志,里面包含了一些在网上已经文档的综合.
06年时的appfuse,学习SSH架构的经典入门框架。相对比较老的资料,可以欣赏一下当时的架构,向牛人致敬
closure-compiler-maven-plugin.zip,google闭包编译器maven pluginmaven plugin用于使用google闭包编译器编译javascript
Struts作为MVC 2的Web框架,自推出以来不断受到开发者的追捧,得到广泛的应用。作为最成功的Web框架,Struts自然拥有众多的优点:MVC 2模型的使用、功能齐全的标志库(Tag Library)、开放源代码。而Spring的出现,...
使用appfuse进行网站开发,appfuse是关于Spring,Struts2,MVC3,Hibernate等技术的案例,可以加快建设网站。 1.文档说明。 2.可以执行的案例,亲测无误。
NULL 博文链接:https://savagegarden.iteye.com/blog/428084
本文以一个 J2EE 开发者的角度,借助一个简单的应用示例,在融合了个人经验的基础上介绍了如何用 AppFuse 一步步地构建 J2EE 项目。通过阅读本文,读者不仅能够学会用 AppFuse 进行开发,而且能够充分体会到 AppFuse...
appfuse-demos-2.0.2代码生成的基本代码框架。