Flex HTTPService, Browser Cache and IE

This morning I spoke at a Flex event in Hyderabad (India). Our (Saven Technologies) team members at Hyderabad planned and organized this fantastic event. It was a public event. Over 200 enthusiatic people attended the event.

I sincerely appreciate the effort of the organizers and thank the attendees for making it a successful event.

One of the attendees asked me a question about problems with Flex HTTPService and the IE browser cache. I promised to provide a detailed solution to the problem, so here it is:

Problem: Repeated HTTPService calls when made from Flex (running within an instance of the IE browser) many a times ends up with no external HTTP call. It appears the data is served from cache.

Reason:  The Flash Player piggybacks on the browser to make the HTTP call. IE caches the response from the HTTP GET calls and on occurrence of the same URL returns the response from the cache.

Solution: The problem can be solved either at the server side or at the client side.

Server side solution:  Set the HTTP headers of the response to avoid returning response from cache.

In HTML: (in the header)

<META HTTP-EQUIV=”Cache-Control” CONTENT=”no-cache”>
<META HTTP-EQUIV=”expires” CONTENT=”0″>

In PHP: (in the script)

header(”Cache-Control: no-cache, must-revalidate”);
header(”Expires: Mon, 26 Jul 1997 05:00:00 GMT”);

In JSP: (before writing to the output stream)

response.setHeader(”Cache-Control”,”no-cache”);
response.setDateHeader (”Expires”, 0);

Client side solution: (1) Make HTTP POST call — only HTTP GET calls are served from cache or (2) Make sure the HTTP GET URL is different every time.

(1) Make HTTP POST call –
set method=”POST” and handle the call appropriately

(2) Append a unique parameter to the HTTP GET call so that the URL is different every time. A unique time stamp is a good choice.
The following sample code, may do the job:

var timeStampForNocache:Date = new Date() ;
params.noCacheControlVar = timeStampForNocache.getTime().toString() ;
I have named the parameter “noCacheControlVar”. You can name it anything else you please. The name does not matter. What matters is that the timestamp makes the HTTP GET URL unique.

That’s it! Hope it helps and IE does not trouble you when using HTTPService anymore.

Flex Camp Wall Street: 1 day and 1 seat to go!

Flex Camp Wall Street is just 1 day away and we are also 1 seat away from being sold out! I must thank every attendee, organizer and speaker for generating the excitement about the event. We increased seats to include 150 instead of our initial number of 125 and yet it took no time for the seats to fill up. I hope everybody enjoys the event tomorrow and promise to organize more events of the type in future.

Thanks!

Adobe Developer Week 2008 : Flex and Java — Tying the knot!

Thanks to all those who attended my session earlier this afternoon. I will post answers to many of the questions that were asked and could not be addressed (due to shortage of time). Please navigate to the page titled — “Flex and Java” — and you will see these spread across multiple posts on that page.

360|Flex Europe- 7-9 April, 2008

If you are interested in Flex and are close enough to Milan Italy then you must not miss 360 Flex Europe. This 3-day conference is the place to learn about Flex and AIR from Adobe and community speakers. 360 Flex was the first Flex conference in the US, and now this one in Milan is the first European Flex conference! Don’t miss out, only €360. The conference includes over 35+ speakers/sessions and free hands-on “Getting started with Flex” training. More details can be found at http://360flex.com/360flex_europe

I am presenting on day 2 of the conference. The topic of my presentation is — “Flex integration with a few Java EE Scenarios”. I ran the same session at 360 Flex Atalanta on 26 February 2008. The feedback from that session confirmed that many people enjoyed the session and are interested in Flex and Java integration. If you are interested, come to the show and join me on day 2.

Adobe Developer Week 2008

I presented this afternoon at the Adobe Developer Week 2008 — an online seminar that runs each day from March 24th through March 28th. The topic of my presentation was “Flex and Java — Tying the Knot!”. If you have come to any of my recent presentations at Flex Camp Chicago, 360 Flex Atlanta or AjaxWorld East 2008 you probably know that this is one topic that I have been speaking on frequently. In the next few months you will get to see more on this from me. My next stop is 360 Flex Milan and then Flex Camp Wall Street and The Server Side Java Symposium Europe follow.

Speaking at 360 Flex at Atlanta on February 26, 2008

Come to 360 | Flex at Atlanta and enjoy learning the exciting things you can do with Adobe Flex and AIR. Register now!

Presenting at the Adobe AIR e-seminar on February 13, 2008

Register for the Adobe AIR e-seminar, scheduled to start at 10.00 am PST on February 13, 2008. I would show how a modern day web developer could easily use his/her tools to carve fully functional desktop applications with the help of AIR.

Speaking at Flex Camp Chicago

Presenting on Flex and Java integration at Flex Camp Chicago on 18 January, 2008. Details can be accessed at http://www.flexcampchicago.com

Speaking at AJAXWorld

Presenting on RCA (Rich Client Applications) and SJA (Server-side Java platform Applications) integration issues and resolution strategies at AJAXWorld on 26 September, 2007. Details can be accessed at http://www.ajaxworld.com/general/sessiondetail0907.htm?id=148

Presentation on Seam at Wisconsin

I am presenting on JBoss Seam at the Wisconsin Java Users Group on September 19, 2007 in Brookfield, WI — west of Milwuakee. The details of the presentation can be accessed at http://www.wjug.org/wjug/. The same presentation would be repeated at Madison on Septermber 20, 2007.

Next Page →