Symbian3/PDK/Source/GUID-20B2C96A-9742-4CB0-A37F-19B65765E826.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-20B2C96A-9742-4CB0-A37F-19B65765E826" xml:lang="en"><title>Implementing
       
    13 the MHTTPDataOptimiser Interface</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>To enable support for Web Acceleration, you must implement your own custom
       
    15 encoding and decoding mechanisms by implementing the functions of the interface <codeph>MHTTPDataOptimiser</codeph>.
       
    16 The following code illustrates the <codeph>MHTTPDataOptimiser</codeph> interface
       
    17 that consists of the <codeph>EncodeL()</codeph> and <codeph>DecodeL()</codeph> methods: </p>
       
    18 <codeblock id="GUID-E9CE6DD9-B772-5A5E-9B07-538F07C3DEC5" xml:space="preserve">class MHTTPDataOptimiser
       
    19 {
       
    20 
       
    21 public:
       
    22 
       
    23 virtual void EncodeL(const TDesC8&amp; aHTTPData, HBufC8*&amp; aEncodedData) = 0;
       
    24     
       
    25 virtual void DecodeL(const TDesC8&amp; aData, HBufC8*&amp; aHTTPData, TBool&amp;     aTransFail) = 0;
       
    26 
       
    27 };</codeblock>
       
    28 <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()
       
    29 method</title><p>This method converts HTTP request data (to your selected
       
    30 network optimisation protocol format) before it is sent across the TCP connection.
       
    31 This method has the following parameters: </p><ul>
       
    32 <li id="GUID-5B67C5B3-3112-5E1E-9BCD-4665BAE0F013"><p> <b>aHTTPData: </b> Contains
       
    33 HTTP request data in standard HTTP format. </p> </li>
       
    34 <li id="GUID-2C903A38-1C76-54E0-84A1-01F35C1C9C09"><p> <b>aEncodedData:</b> On
       
    35 return contains encoded HTTP request data in a network optimisation protocol
       
    36 format. </p> </li>
       
    37 </ul><p> <b> Note:</b> It is assumed that you define a custom optimisation
       
    38 mechanism to encode the HTTP request data by implementing the <codeph>EncodeL()</codeph> method. </p> </section>
       
    39 <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()
       
    40 method</title><p>This method converts the HTTP response data in your selected
       
    41 network optimisation protocol format back to the standard HTTP response data
       
    42 format. This method has the following parameters: </p><ul>
       
    43 <li id="GUID-D07BB5C7-1E33-5DD3-94D3-1FC8C72053DA"><p> <b>aData:</b> Contains
       
    44 the raw data in a network optimisation protocol format received over the TCP
       
    45 connection. </p> </li>
       
    46 <li id="GUID-BFD2C0BC-20E8-5DE7-84F3-D79FADBEAA3B"><p> <b> aHTTPData:</b> On
       
    47 return of this method the <codeph>aHTTPData</codeph> parameter contains the
       
    48 HTTP response data. </p> </li>
       
    49 <li id="GUID-FE67D081-A66E-54A4-BCB3-5EB6E8D5AF57"><p> <b> aTransFail:</b> When
       
    50 you set this parameter value to <codeph>ETrue</codeph> it sends the <codeph>KErrHTTPOptimiserFailsTrans</codeph> event
       
    51 to the mobile browser application. </p> </li>
       
    52 </ul><p> <b>Note:</b> In a scenario where the HTTP response data is split
       
    53 across various packets (for example, when the network bandwidth is low), the <codeph>MHTTPDataOptimiser::DecodeL()</codeph> method
       
    54 is called for every data packet received. In this scenario, to ensure successful
       
    55 parsing of the HTTP response data, the <codeph>aTransFail</codeph> parameter
       
    56 must be set to <codeph>EFalse</codeph> for every call made to <codeph>MHTTPDataOptimiser::DecodeL()</codeph>,
       
    57 until the final transaction is encountered. </p> </section>
       
    58 </conbody></concept>