- 浏览: 516417 次
- 性别:
- 来自: 远方
文章分类
最新评论
-
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 4578将quartz从1.7升级到2.01 发现Caused by ... -
spring读书笔记----Quartz Trigger JobStore出错解决
2010-10-20 06:22 10966将Quartz的JOBDetail,Trigger保持到数据库 ... -
spring读书笔记----<context:component-scan/>和<context:annotation-config/>
2010-10-19 03:05 4237<context:annotation-config/& ... -
Spring读书笔记------RedirectView不传递session
2010-01-19 08:44 2043程序中反复才发现原来spring中RedirectView不传 ... -
Spring读书笔记-------使用activeMq
2010-01-15 07:11 1601在spring中使用activeMq 版本:spring 2 ... -
Spring总结-----properties文件load
2009-10-29 05:59 5446Spring中property用来存放application的 ... -
Spring----Quartz总结
2009-10-23 02:50 3692Quartz的关键元素结构图: ... -
Spring总结-----@Component,@Service,@Controller,@Repository
2009-10-20 05:24 13704在一个稍大的项目中, ... -
Spring JsonView--对输出对象属性的过滤
2008-12-20 08:09 3836由于Spring中的对象可以获取子对象,但json输出的时候会 ... -
Spring Security Acl- MethodSecurityInterceptor冲突解决
2008-12-09 08:01 4244在Spring Security Acl中使用methodSe ... -
Spring Security Acl- Mysql数据脚本带sample
2008-11-26 08:04 2110SET SQL_MODE="NO_AUTO_VALU ... -
getSession与getHibernateTemplate的区别
2008-11-18 03:55 6149一直都很疑惑在spring框架中getSession与getH ... -
Appfuse2学习笔记--full-source时proxy错误处理
2008-11-06 07:03 1479公司有proxy但在mvn和svn都设置好了平时使用一直没有觉 ... -
CXF学习笔记---给CXF加一把锁WS_SECURITY应用
2008-10-02 05:33 17254CXF的webService已经创建好,但没有安全可言,毕竟这 ... -
CXF客户端调用
2008-10-01 07:36 6322上一篇我用acgei绑定的方式创建了一个Web Service ... -
快速使用Spring 2.5 和 Apache CXF 2.0, 以前的Xfire创建webServ
2008-10-01 07:31 3996在这个Demo中我如何使用Spring 2.5 和 Apach ... -
Spring的command属性的绑定
2008-09-27 01:33 2332开发当中发现extjs的checkbox的value是on o ... -
MultiAction的灵活应用
2008-09-04 00:56 1411按照参数设置和按照method混合配置 <?xml ...
相关推荐
`mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts-archetype -DarchetypeVersion=2.1.0-M2 -DgroupId=cn.xue.app -DartifactId=xueAppFuse` ...
### Appfuse 学习笔记 #### 一、Appfuse 简介 Appfuse 是一个开源框架,旨在帮助开发者高效地构建企业级应用。通过提供一套完善的架构模板、最佳实践和技术栈组合,使得开发者能够专注于业务逻辑的实现,而不是...
在"appfuse-light-webwork-spring-jdbc-1.8.2.zip"这个压缩包中,我们能看到一个基于Java 8、WebWork、Spring和JDBC的项目实例。 **Java 8** Java 8是Java平台的重大更新,引入了许多新特性,如lambda表达式、函数...
这个"appfuse-tutorial-struts-1.6.zip"文件是一个基于Struts 1.6的AppFuse教程,用于指导开发者如何构建一个企业级的人员管理系统。Struts是Apache软件基金会下的一个开源框架,专门用于构建基于MVC(Model-View-...
替换 `<选择的模板>` 为下载的模板名称,如 `appfuse-basic`,`appfuse-minimal` 等,`<对应版本>` 是你下载的 AppFuse 版本号。 **4. 编译与运行** 进入新创建的项目目录,使用 Maven 编译并运行项目: ``` cd my...
### AppFuse2 学习知识点总结 #### 一、AppFuse 概述 - **定义与价值**:AppFuse 是一款开源项目,旨在利用一系列开源工具帮助开发者高效地搭建 Web 应用程序的基础架构。通过使用 AppFuse,开发人员可以在构建新...
【AppFuse 框架详解】 AppFuse 是一个由 Matt Raible 创建的开源项目,它为初学者提供了... mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=...
综上所述,AppFuse 不仅是一个强大的开发框架,还是一个全面的学习资源库,可以帮助开发者快速掌握现代 Web 开发所需的各种技能。无论你是初学者还是有经验的开发者,都能从这份文档中获益良多。
在本篇“appfuse学习笔记(二)新建模块”中,我们将深入探讨AppFuse框架的模块创建过程。AppFuse是一个开源项目,它提供了一个快速开发Web应用的基础结构,旨在简化开发流程并提高代码质量。通过AppFuse,开发者...
AppFuse Service 3.0.0 是一个开源项目,它提供了一个基础框架,用于快速开发企业级Java应用。这个版本的亮点在于其集成了一系列现代开发工具和最佳实践,旨在提高开发效率和代码质量。AppFuse 的核心理念是简化复杂...
如果网络速度较慢,可以选择手动下载并解压`appfuse-2.0-rc1-dependencies.zip`到该目录。 #### 六、不同配置类型的Maven命令示例 除了Struts 2 Basic之外,Appfuse 2.0还支持其他几种配置类型,每种配置类型的...
在本篇“appfuse学习笔记(三)解决乱码和菜单设置”中,我们将深入探讨在使用AppFuse框架时遇到的编码问题以及如何定制应用程序的菜单。AppFuse是一款开源项目,它提供了一个快速开发Web应用的基础,特别是对于Java...
2. **项目初始化**:运行AppFuse的生成器,选择合适的项目类型(如基本的MVC应用),指定数据库和编程语言(如Java或Groovy)。 3. **代码生成**:AppFuse会自动生成基本的项目结构,包括模型、控制器、视图和...
mvn archetype:generate -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic -DarchetypeVersion=2.x -DgroupId=com.mycompany -DartifactId=myproject -Ddb=oracle ``` 这将根据你的配置生成一个...
- 书中提供了大量的示例代码和实用指南,旨在帮助读者深入了解AppFuse的工作原理并学习如何使用它来构建高质量的Web应用程序。 #### 三、AppFuse Primer的主要内容概述 - **基础知识**: 在开始使用AppFuse之前,...
本教程的所有代码都位于Google Code上的`appfuse-demos`项目中的`tutorial-struts2`模块。你可以使用以下的Subversion命令来检出该项目: ``` svn checkout ...