Andrew,

 

I think you will find that the browser is trying to decrypt the whole document not just your bit.

 

Why are you bothering? This is free in IIS6.

Regards
Dale Fraser

http://dale.fraser.id.au


 


From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Andrew Scott
Sent: Tuesday, 12 September 2006 14:01 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Compressing the output to the browser via CF

 

Ok I thought I was onto a beginning here by getting coldfusion to compress the content, and then redisplay it. In its basic form this will only do text at this stage, but it is a start.

 

Anyway I hit a snag, I can not for the life of me get the browser to deflate the string. Anyone see the problem at all, I have tried many combinations of the cfcontent and cfheader but not the right one by the looks of it.

            <cffunction name="onRequestEnd" returntype="boolean" output="true">

                        <cfargument name="thePage" type="string" required="true">

                        <cfset var myString ="Andrew was here in 2006" />

                        <cfset var fileOut = '' />

                        <cfset var out = '' /> 

                        <cfscript>

                          pageOut = getPageContext().getCFOutput().getString();

                        </cfscript>

                        <cfscript>

                                    fileOut = createobject("java", "java.io.ByteArrayOutputStream").init();

                                    out = createobject("java","java.util.zip.GZIPOutputStream").init(fileOut);

                out.write(variables.pageOut.getBytes(), 0, len(variables.pageOut.getBytes()));

                                    // Complete the GZIP file

                                    out.finish();

                                    out.close();

              </cfscript>

                  <cfheader name="Content-Length" value="#fileOut.toString().length()#">

                        <cfcontent type="text/html; charset=UTF-8" reset="yes">

                  <cfheader name="Content-Encoding" value="gzip">

                        <cfoutput>#fileOut.toString()#</cfoutput>

                        <cfreturn true />

            </cffunction>

 

 

 

 

Senior Coldfusion Developer

Aegeon Pty. Ltd.

www.aegeon.com.au

Phone: +613  8676 4223

Mobile: 0404 998 273

 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---


Reply via email to