Never mind. I guess what you would need in some intelligent script that would guess the content type and try to set the appropriate headers for you, which can be overriden.
Sami On Thu, Nov 11, 2010 at 11:32 AM, Sami Hoda <[email protected]> wrote: > Hmmm, Ok will try that. But couldn't you loop through the headers and make > that part of the cache that is re-created? > > Sami > > > > On Thu, Nov 11, 2010 at 11:28 AM, Peter J. Farrell <[email protected]>wrote: > >> It's not a bug. Mach-II cannot obverse headers send by cfcontent or >> cfheader because CFML engines don't provide us a way to observe and insert a >> callback. >> >> http://trac.mach-ii.com/machii/wiki/IntroToCaching#GeneralUsageNotes >> >> >> - Cache will not replay text inserted in the head via <cfhtmlhead>. >> Use addHTMLHeadElement("textToInsert") in views or >> arguments.eventContext.addHTMLHeadElement("textToInsert") in places >> where there is access to the EventContext to have the cache replay. >> - Cache will not replay headers set via <cfheader>. Use >> addHTTPHeader(name="some", >> value="thing", charset="utf-8"), addHTTPHeader(statuscode="500", >> statustext="Some Text"), addHTTPHeaderByName(name, value) or >> addHTTPHeaderByStatus(statuscode, >> statustext) in views or same method names in the EventContext to have >> the cache replay. >> >> If you switch to use addHTTPHeader for the "text/plain" you, then the >> cache can replay that header for you. >> >> .pjf >> >> Sami Hoda said the following on 11/11/2010 01:24 PM: >> >> Here is the scenario. We have an event that responds to a jQuery ajax >> call. >> >> We do caching inside that event of the json data returned. >> >> It looks something like this: >> >> <cache alias="SLActivityCodes"> >> <event-arg name="disableLayoutManager" >> value="true"/> >> <event-arg name="variableToConvert" >> value="ARRA2009SLActivityCodes"/> >> <notify listener="specialLegislationListener" >> method="getARRA2009SLActivityCodes"/> >> <notify listener="AbstractGatewayListener" >> method="getJSONStr" /> >> <view-page name="gn_jsonContent" /> >> </cache> >> >> As you can see, we have a generic listener which can convert any query >> to json. Then finally, we have a view, the contents of which are: >> >> <cfcontent type="text/plain" reset="true"><cfsetting >> showDebugOutput="No"><cfoutput>#Trim(event.getArg('jsonStr'))#</ >> cfoutput> >> >> Its a pretty straightforward setup. >> >> When I do a framework reinit and make sure there is no cache, the data >> is returned back to jquery just fine. One thing to note in Firebug, >> the Content-Type is text/plain, as expected from the view. >> >> However, if something else in that page calls the same ajax call, I >> get a jQuery error. I scratched my head about this. Note, that in >> jQuery 1.4.3+, json validation has gotten extremely strict. But when I >> looked at the response, it was the same as the first call. >> >> Joseph Lamoree, correctly pointed out to check out to check the >> content-type for the second call. It was html. This is why jQuery >> would freak out. >> >> I looked at the notes for Mach II Caching, and it does point out that >> cfhtmlhead and cfheader do not get cached. But what I have here is >> cfcontent, which I would expect to be cached. This use case is also >> such that I would expect that it should retain the content-type, >> otherwise its useless to use Mach II caching for ajax calls when >> dealing with json. >> >> Any thoughts? >> >> >> >> -- >> You received this message because you are subscribed to Mach-II for CFML >> list. >> To post to this group, send email to >> [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en >> >> SVN: http://svn.mach-ii.com/machii/ >> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/ >> > > -- You received this message because you are subscribed to Mach-II for CFML list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en SVN: http://svn.mach-ii.com/machii/ Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
