Symbian3/PDK/Source/GUID-20B2C96A-9742-4CB0-A37F-19B65765E826.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Fri, 22 Jan 2010 18:26:19 +0000
changeset 1 25a17d01db0c
child 3 46218c8b8afa
permissions -rw-r--r--
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-20B2C96A-9742-4CB0-A37F-19B65765E826" xml:lang="en"><title>Implementing
the MHTTPDataOptimiser Interface</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>To enable support for Web Acceleration, you must implement your own custom
encoding and decoding mechanisms by implementing the functions of the interface <codeph>MHTTPDataOptimiser</codeph>.
The following code illustrates the <codeph>MHTTPDataOptimiser</codeph> interface
that consists of the <codeph>EncodeL()</codeph> and <codeph>DecodeL()</codeph> methods: </p>
<codeblock id="GUID-E9CE6DD9-B772-5A5E-9B07-538F07C3DEC5" xml:space="preserve">class MHTTPDataOptimiser
{

public:

virtual void EncodeL(const TDesC8&amp; aHTTPData, HBufC8*&amp; aEncodedData) = 0;
    
virtual void DecodeL(const TDesC8&amp; aData, HBufC8*&amp; aHTTPData, TBool&amp;     aTransFail) = 0;

};</codeblock>
<section id="GUID-6E64E5BA-0FA7-5B9D-987E-09F2D5F53AE8-GENID-1-7-1-13-1-1-3-1-3-1-13-1-4-1-4-1-2-3"> <title>The EncodeL()
method</title><p>This method converts HTTP request data (to your selected
network optimisation protocol format) before it is sent across the TCP connection.
This method has the following parameters: </p><ul>
<li id="GUID-5B67C5B3-3112-5E1E-9BCD-4665BAE0F013"><p> <b>aHTTPData: </b> Contains
HTTP request data in standard HTTP format. </p> </li>
<li id="GUID-2C903A38-1C76-54E0-84A1-01F35C1C9C09"><p> <b>aEncodedData:</b> On
return contains encoded HTTP request data in a network optimisation protocol
format. </p> </li>
</ul><p> <b> Note:</b> It is assumed that you define a custom optimisation
mechanism to encode the HTTP request data by implementing the <codeph>EncodeL()</codeph> method. </p> </section>
<section id="GUID-6E64E5BA-0FA7-5B9D-987E-09F2D5F53AE8-GENID-1-7-1-13-1-1-3-1-3-1-13-1-4-1-4-1-2-4"> <title>The DecodeL()
method</title><p>This method converts the HTTP response data in your selected
network optimisation protocol format back to the standard HTTP response data
format. This method has the following parameters: </p><ul>
<li id="GUID-D07BB5C7-1E33-5DD3-94D3-1FC8C72053DA"><p> <b>aData:</b> Contains
the raw data in a network optimisation protocol format received over the TCP
connection. </p> </li>
<li id="GUID-BFD2C0BC-20E8-5DE7-84F3-D79FADBEAA3B"><p> <b> aHTTPData:</b> On
return of this method the <codeph>aHTTPData</codeph> parameter contains the
HTTP response data. </p> </li>
<li id="GUID-FE67D081-A66E-54A4-BCB3-5EB6E8D5AF57"><p> <b> aTransFail:</b> When
you set this parameter value to <codeph>ETrue</codeph> it sends the <codeph>KErrHTTPOptimiserFailsTrans</codeph> event
to the mobile browser application. </p> </li>
</ul><p> <b>Note:</b> In a scenario where the HTTP response data is split
across various packets (for example, when the network bandwidth is low), the <codeph>MHTTPDataOptimiser::DecodeL()</codeph> method
is called for every data packet received. In this scenario, to ensure successful
parsing of the HTTP response data, the <codeph>aTransFail</codeph> parameter
must be set to <codeph>EFalse</codeph> for every call made to <codeph>MHTTPDataOptimiser::DecodeL()</codeph>,
until the final transaction is encountered. </p> </section>
</conbody></concept>