Author: alexsmirnov
Date: 2008-05-07 20:29:45 -0400 (Wed, 07 May 2008)
New Revision: 8488
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
trunk/ui/assembly/pom.xml
Log:
Start progress on
http://jira.jboss.com/jira/browse/RF-3344
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2008-05-07
23:01:54 UTC (rev 8487)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2008-05-08
00:29:45 UTC (rev 8488)
@@ -404,7 +404,7 @@
contentLength);
}
long expired = getExpired(context);
- if (expired == Long.MIN_VALUE ) {
+ if (expired < 0 ) {
expired = DEFAULT_EXPIRE;
}
context.setDateHeader("Expires", System.currentTimeMillis()
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2008-05-07
23:01:54 UTC (rev 8487)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2008-05-08
00:29:45 UTC (rev 8488)
@@ -108,7 +108,18 @@
* @param response
*/
public void sendHeaders(HttpServletResponse response) {
- for (Iterator<Entry<String, Object>> iter = headers.entrySet().iterator();
iter.hasNext();) {
+ // set real content-length.
+ // / if (null != content) {
+ int realContentLength = 0;
+ if (filledOutputStream) {
+ if (null != content && content.length > 0) {
+ realContentLength = content.length;
+ } else if (null != outputStream && outputStream.getLength() > 0) {
+ realContentLength = outputStream.getLength();
+ }
+ } // TODO - calculate content-lenght for writer ?
+ for (Iterator<Entry<String, Object>> iter = headers.entrySet()
+ .iterator(); iter.hasNext();) {
Entry<String, Object> element = iter.next();
String header = (String) element.getKey();
Object headerValue = element.getValue();
@@ -118,25 +129,27 @@
response.setDateHeader(header, time.longValue());
} else if (headerValue instanceof Integer) {
Integer value = (Integer) headerValue;
- response.setIntHeader(header, value.intValue());
+ // Check real content length.
+ if ( !(realContentLength > 0
+ && "Content-Length".equals(header))) {
+ response.setIntHeader(header, value.intValue());
+ }
} else {
- response.setHeader(header, (String) headerValue);
+ // Don't send "chunked" transfer-encoding type with real
content-length
+ if (!(realContentLength > 0
+ && "Transfer-Encoding".equals(header) &&
"chunked"
+ .equals(headerValue))) {
+ response.setHeader(header, (String) headerValue);
+ }
}
} catch (Exception e) {
_log.error("Error set response header " + header + "for value "
+ headerValue, e);
}
- // set real content-length.
- // / if (null != content) {
- if (filledOutputStream) {
- if (null != content && content.length > 0) {
- response.setIntHeader("Content-Length", content.length);
- } else if (null != outputStream && outputStream.getLength() > 0) {
- response.setIntHeader("Content-Length", outputStream
- .getLength());
- }
- } // TODO - calculate content-lenght for writer ?
+ if(realContentLength > 0){
+ response.setIntHeader("Content-Length", realContentLength);
+ }
if (null != contentType) {
response.setContentType(this.contentType);
}
Modified: trunk/ui/assembly/pom.xml
===================================================================
--- trunk/ui/assembly/pom.xml 2008-05-07 23:01:54 UTC (rev 8487)
+++ trunk/ui/assembly/pom.xml 2008-05-08 00:29:45 UTC (rev 8488)
@@ -21,6 +21,7 @@
<description>RichFaces components</description>
<taglibs>
<taglib>
+ <tlibVersion>3.2.1</tlibVersion>
<shortName>richfaces</shortName>
<taglib>richfaces</taglib>
<uri>
@@ -32,6 +33,7 @@
<excludeModules>core</excludeModules>
</taglib>
<taglib>
+ <tlibVersion>3.2.1</tlibVersion>
<shortName>rich</shortName>
<taglib>rich</taglib>
<
uri>http://richfaces.org/rich</uri>
@@ -39,6 +41,7 @@
<excludeModules>core</excludeModules>
</taglib>
<taglib>
+ <tlibVersion>3.2.1</tlibVersion>
<shortName>a4j</shortName>
<taglib>ajax4jsf</taglib>
<
uri>http://richfaces.org/a4j</uri>
@@ -46,6 +49,7 @@
<includeModules>core</includeModules>
</taglib>
<taglib>
+ <tlibVersion>3.2.1</tlibVersion>
<shortName>ajax</shortName>
<taglib>a4j</taglib>
<uri>