Using the new wwPageResponse Class

This topic is an optional one and deals with converting to the new wwPageResponse class as opposed to the Version 4.0 wwResponse class. This class is more lightweight and provides the ability to build up your page content more consistently by allowing header creation at any time, so you can add Cookies and other header items at any time. It basically replaces the wwResponse and wwHTTPHeader class combination of classes.

Tip: Can't use the wwPageResponse class? Try wwPageResponse40
The wwPageResponse class removes many 'utility' methods of the wwResponse class. If you have legacy response method calls that don't work with the wwPageResponse class, there's another subclass of the class called wwPageResponse40 that adds back the various dropped methods like all of the Form???() methods, Send/SendLn and a few other methods that had been dropped.

Web Connection 5.0 works with the old Response classes by default, so you don't have to change anything to get your code to run. However if you want to use the new object you will have to make a few adjustments to your existing code.

Action Item: Enable the wwPageResponse class
In order to use the new wwPageResponse class you have to set a property in your wwProcess subclass definition.

************************************************************* DEFINE CLASS wwStore AS WWC_PROCESS ************************************************************* cResponseClass = [WWC_PAGERESPONSE] *** If you need to use the 4.0 compatibility class * cResponseClass = "wwPageResponse40" ... ENDDEFINE

The wwPageResponse class mixes wwHttpHeader and wwResponse functionality so anything that used to require separate headers can now in most cases use the wwResponse object directly. For example:

Response.AddCookie("TestCookie","MyValue","/wwstore") Response.Headers.Add("Expiration","-1") Response.AddForceReload()

The old way still works as well so you can still construct a wwHttpHeader object and pass it to ContentTypeHeader(), but this is not recommended because that mechanism will output the header immediately.

Action Item: Remove wwHttpHeader code and replace with Response methods
To optimize your code remove any wwHttpHeader related code and use the Response methods directly.

Make sure you test your code. If you should run into problems with headers they will most likely be related to duplicate headers. In those cases make sure that you are not explicitly writing out headers in your application code. Always try to use the wwPageResponse object directly.



  Last Updated: 11/30/2007 | © West Wind Technologies, 2008