websrv_pub/web_service_connection_api/inc/SenHttpTransportProperties.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors: 
       
    13 *
       
    14 * Description: Http transport properties class declaration     
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef SEN_HTTP_TRANSPORT_PROPERTIES_H
       
    19 #define SEN_HTTP_TRANSPORT_PROPERTIES_H
       
    20 
       
    21 // INCLUDE
       
    22 #include <SenTransportProperties.h>
       
    23 
       
    24 // CONSTANTS
       
    25 _LIT8(KSenHttpAcceptHeaderDelimiter, ",");
       
    26 
       
    27 // Supported Http properties:
       
    28 
       
    29 //// -- session properties:
       
    30 _LIT8(KHttpMethodLocalName,     "HttpMethod");
       
    31 _LIT8(KHttpVersionLocalName,    "HttpVersion");
       
    32 
       
    33 //// -- HTTP headers names:
       
    34 _LIT8(KContentTypeLocalName,    "Content-Type");
       
    35 _LIT8(KAcceptLocalName,         "Accept");
       
    36 _LIT8(KSlugLocalName,           "Slug");
       
    37 
       
    38 // Supported Http methods:
       
    39 _LIT8(KHttpGet,                 "Get");
       
    40 _LIT8(KHttpPost,                "Post");
       
    41 _LIT8(KHttpPut,                 "Put");
       
    42 _LIT8(KHttpDelete,              "Delete");
       
    43 
       
    44 // Supported Http versions:
       
    45 _LIT8(KHttp10,                  "Http1.0");
       
    46 _LIT8(KHttp11,                  "Http1.1");
       
    47 
       
    48 //NOTE:
       
    49 /**	In SendL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties)
       
    50  *	or
       
    51  *	SubmitL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties, HBufc8*& aResponseTO)  
       
    52  *	aProperties could be "HTTP GET" or "HTTP DELETE"
       
    53  *  aMessage is a soap message or serialized XML.
       
    54  *	This scenario is not supported. 
       
    55  *
       
    56  *	These are the function calls get called during this scenario
       
    57  *	iHttpProperties->SetHttpHeaderL(const TDesC8& aHeaderName, const TDesC8& aValue);
       
    58  *	iHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpGet);
       
    59  *	SendL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties);
       
    60 **/
       
    61 
       
    62 // CLASS DECLARATION
       
    63 class CSenHttpTransportProperties : public CSenTransportProperties
       
    64     {
       
    65     public:
       
    66 		/**
       
    67 		 * HttpMethod Enumeration
       
    68 		 */    		
       
    69         enum TSenHttpMethod
       
    70         	{
       
    71         	ESenHttpPut,
       
    72         	ESenHttpDelete,
       
    73         	ESenHttpGet,
       
    74             ESenHttpPost        	
       
    75             };
       
    76 		/**
       
    77 		 * HttpVersion Enumeration
       
    78 		 */    		            
       
    79         enum TSenHttpVersion
       
    80         	{
       
    81         	ESenHttp10,
       
    82         	ESenHttp11
       
    83             };            
       
    84         /**
       
    85         * Basic constructor.
       
    86         * @return a pointer to new CSenHttpTransportProperties class instance.
       
    87         */
       
    88         IMPORT_C static CSenHttpTransportProperties* NewL();
       
    89         /**
       
    90         * Basic constructor.
       
    91         * @return a pointer to new CSenHttpTransportProperties class instance.
       
    92         */
       
    93         IMPORT_C static CSenHttpTransportProperties* NewLC();
       
    94 
       
    95         /**
       
    96         * Basic constructor.
       
    97 		* @param aXmlUtf8 
       
    98     	* @param aParser It is a XML reader        
       
    99         * @return a pointer to new CSenHttpTransportProperties class instance.
       
   100         */
       
   101         IMPORT_C static CSenHttpTransportProperties* NewL(const TDesC8& aXmlUtf8,
       
   102                                                           CSenXmlReader& aParser);
       
   103 
       
   104         /**
       
   105         * Basic constructor.
       
   106 		* @param aXmlUtf8 
       
   107     	* @param aParser It is a XML reader        
       
   108         * @return a pointer to new CSenHttpTransportProperties class instance.
       
   109         */
       
   110         IMPORT_C static CSenHttpTransportProperties* NewLC(const TDesC8& aXmlUtf8,
       
   111                                                            CSenXmlReader& aParser);
       
   112 
       
   113         /**
       
   114         * Basic constructor.
       
   115 		* @param aElement
       
   116         * @return a pointer to new CSenHttpTransportProperties class instance.
       
   117         */
       
   118         IMPORT_C static CSenHttpTransportProperties* NewL(const CSenElement& aElement);
       
   119         /**
       
   120         * Basic constructor.
       
   121 		* @param aElement 
       
   122         * @return a pointer to new CSenHttpTransportProperties class instance.
       
   123         */
       
   124         IMPORT_C static CSenHttpTransportProperties* NewLC(const CSenElement& aElement);
       
   125          
       
   126         /**
       
   127         * Gets the IAP ID.
       
   128         * @param aCurrentIapId  A TUint32 reference to be filled in with the
       
   129         *                       value of the IAP ID.
       
   130         * @return               KErrNone if no error, or some of the system
       
   131         *                       wide error codes.
       
   132         */
       
   133         virtual TInt IapIdL(TUint32& aCurrentIapId);
       
   134 
       
   135         /**
       
   136         * Sets the IAP ID.
       
   137         * @param aIapId is the new IAP ID.
       
   138         */
       
   139         virtual void SetIapIdL(TUint32 aIapId);
       
   140 
       
   141         /**
       
   142         * Gets the Proxy Port.
       
   143         * @param aProxyPort  A TInt reference to be filled in with the
       
   144         *                    value of the Proxy Port.
       
   145         * @return            KErrNone if no error, or some of the system
       
   146         *                    wide error codes.
       
   147         */
       
   148         virtual TInt ProxyPortL(TInt& aProxyPort);
       
   149 
       
   150         /**
       
   151         * Sets the Proxy Port.
       
   152         * @param aProxyPort is the new Proxy Port.
       
   153         */
       
   154         virtual void SetProxyPortL(TInt aProxyPort);
       
   155 
       
   156         /**
       
   157         * Gets the Proxy Host.
       
   158         * @param aProxyHost  A TPtrC8 reference to be filled in with the
       
   159         *                    value of the Proxy Host.
       
   160         * @return            KErrNone if no error, or some of the system
       
   161         *                    wide error codes.
       
   162         */
       
   163         virtual TInt ProxyHostL(TPtrC8& aProxyHost);
       
   164 
       
   165         /**
       
   166         * Sets the Proxy Host.
       
   167         * @param aProxyHost is the new Proxy Host.
       
   168         */
       
   169         virtual void SetProxyHostL(const TDesC8& aProxyHost);
       
   170         
       
   171         /**
       
   172         * Gets the Proxy Usage flag.
       
   173         * @param aProxyUsage A TBool reference to be filled in with the
       
   174         *                    value of the Proxy Usage.
       
   175         * @return            KErrNone if no error, or some of the system
       
   176         *                    wide error codes.
       
   177         */
       
   178         virtual TInt ProxyUsageL(TBool& aProxyUsage);
       
   179 
       
   180         /**
       
   181         * Sets the Proxy Usage flag.
       
   182         * @param aProxyUsage is the new value for Proxy Usage.
       
   183         */
       
   184         virtual void SetProxyUsageL(TBool aProxyUsage);
       
   185 
       
   186         /**
       
   187         * Gets the information if SecureDialog is shown or not.
       
   188         * @param aProxyUsage A TBool reference to be filled in with the
       
   189         *                    value of the SecureDialog flag.
       
   190         * @return            KErrNone if no error, or some of the system
       
   191         *                    wide error codes.
       
   192         */
       
   193         virtual TInt SecureDialogL(TBool& aSecureDialog);
       
   194 
       
   195         /**
       
   196         * Sets the flag which controls showing of SecureDialog.
       
   197         * @param aSecureDialog is the new value for SecureDialog flag.
       
   198         */
       
   199         virtual void SetSecureDialogL(TBool aSecureDialog);
       
   200         
       
   201         /**
       
   202         * Gets the information if IAPDialog is shown or not.
       
   203         * @param aIAPDialog A TBool reference to be filled in with the
       
   204         *                   value of the IAPDialog flag.
       
   205         * @return           KErrNone if no error, or some of the system
       
   206         *                   wide error codes.
       
   207         */
       
   208 //        virtual TInt IAPDialogL(TBool& aIAPDialog);
       
   209 
       
   210         /**
       
   211         * Sets the flag which controls showing of IAPDialog.
       
   212         * @param aIAPDialog is the new value for IAPDialog flag.
       
   213         */
       
   214 //        virtual void SetIAPDialogL(TBool aIAPDialog);
       
   215 
       
   216         /**
       
   217         * Gets the Content Type.
       
   218         * @param aContentType A TPtrC8 reference to be filled in with the
       
   219         *                     value of the Content Type.
       
   220         * @return             KErrNone if no error, or some of the system
       
   221         *                     wide error codes.
       
   222         */
       
   223         virtual TInt ContentTypeL(TPtrC8& aContentType);
       
   224         
       
   225         /**
       
   226         * Sets the Content Type.
       
   227         * @param aContentType is the new Content Type.
       
   228         */
       
   229         virtual void SetContentTypeL(const TDesC8& aContentType);
       
   230         
       
   231         /**
       
   232         * Gets the SoapAction.
       
   233         * @param aSoapAction A TPtrC8 reference to be filled in with the
       
   234         *                    value of the SoapAction.
       
   235         * @return            KErrNone if no error, or some of the system
       
   236         *                    wide error codes.
       
   237         */
       
   238         virtual TInt SoapActionL(TPtrC8& aSoapAction);
       
   239         
       
   240         /**
       
   241         * Sets the Soap Action.
       
   242         * @param aSoapAction is the new Soap Action.
       
   243         */
       
   244         virtual void SetSoapActionL(const TDesC8& aSoapAction);
       
   245         
       
   246         /**
       
   247         * Gets the UserAgent.
       
   248         * @param aUserAgent  A TPtrC8 reference to be filled in with the
       
   249         *                    value of the UserAgent.
       
   250         * @return            KErrNone if no error, or some of the system
       
   251         *                    wide error codes.
       
   252         */
       
   253         virtual TInt UserAgentL(TPtrC8& aUserAgent);
       
   254         
       
   255         /**
       
   256         * Sets the UserAgent.
       
   257         * @param aUserAgent is the new User Agent.
       
   258         */
       
   259         virtual void SetUserAgentL(const TDesC8& aUserAgent);
       
   260 
       
   261         /**
       
   262         * Gets the Accept.
       
   263         * @param aAccept     A TPtrC8 reference to be filled in with the
       
   264         *                    value of the Accept.
       
   265         * @return            KErrNone if no error, or some of the system
       
   266         *                    wide error codes.
       
   267         */
       
   268         virtual TInt AcceptL(TPtrC8& aAccept);
       
   269         
       
   270         /**
       
   271         * Sets the Accept.
       
   272         * @param aAccept is the new Accept value.
       
   273         */
       
   274         virtual void SetAcceptL(const TDesC8& aAccept);
       
   275         
       
   276         /**
       
   277         * Gets the Http method.
       
   278         * @param aHttpMethod A TSenHttpMethod reference to be filled in with
       
   279         *                    the value of the Http method.
       
   280         * @return            KErrNone if no error, or some of the system
       
   281         *                    wide error codes.
       
   282         */
       
   283         virtual TInt HttpMethodL(TSenHttpMethod& aHttpMethod);
       
   284         
       
   285         /**
       
   286         * Sets the Http method.
       
   287         * @param aHttpMethod is the new Http method.
       
   288         */
       
   289         virtual void SetHttpMethodL(TSenHttpMethod aHttpMethod);
       
   290 
       
   291         /**
       
   292         * Gets the Http version.
       
   293         * @param aHttpVersion A TSenHttpVersion reference to be filled in with
       
   294         *                     the value of the Http version.
       
   295         * @return             KErrNone if no error, or some of the system
       
   296         *                     wide error codes.
       
   297         */
       
   298         virtual TInt HttpVersionL(TSenHttpVersion& aHttpVersion);
       
   299         
       
   300         /**
       
   301         * Sets the Http version.
       
   302         * @param aHttpVersion is the new Http version.
       
   303         */
       
   304         virtual void SetHttpVersionL(TSenHttpVersion aHttpVersion);        
       
   305 
       
   306         /**
       
   307         * Gets the Http header.
       
   308         * @param aHeaderName  Name of the Http header.
       
   309         * @param aValue       A TPtrC8 reference to be filled in with the
       
   310         *                     value of the Http header.
       
   311         * @return             KErrNone if no error, or some of the system
       
   312         *                     wide error codes.
       
   313         */
       
   314         virtual TInt HttpHeaderL(const TDesC8& aHeaderName, TPtrC8& aValue);
       
   315         
       
   316         /**
       
   317         * Sets the Http header.
       
   318         * @param aHeaderName  Name of the Http header.
       
   319         * @param aValue       Value of the Http header
       
   320         */
       
   321         virtual void SetHttpHeaderL(const TDesC8& aHeaderName,
       
   322                                     const TDesC8& aValue);
       
   323 
       
   324 
       
   325         /**
       
   326         * Gets the device ID
       
   327         * @param aDeviceID  A TPtrC8 reference to be filled in with the
       
   328         *                    value of the Device ID.
       
   329         * @return            KErrNone if no error, or some of the system
       
   330         *                    wide error codes.
       
   331         */
       
   332         virtual TInt DeviceIDL(TPtrC8& aDeviceID);
       
   333 
       
   334         /**
       
   335         * Sets the Device ID.
       
   336         * @param aDeviceID is the new Device ID.
       
   337         */
       
   338         virtual void SetDeviceIDL(const TDesC8& aDeviceID);
       
   339 
       
   340         /**
       
   341         * Gets download folder for incoming BLOB (binary large objects)
       
   342         * @param aDownloadFolder - A TPtrC8 reference to be filled in with the
       
   343         *                    value of the shared, public folder for downloaded 
       
   344         *                    content
       
   345         * @return            KErrNone if no error, or some of the system
       
   346         *                    wide error codes.
       
   347         */
       
   348         virtual TInt DownloadFolderL(TPtrC8& aDownloadFolder);
       
   349         
       
   350         /**
       
   351         * Sets download folder for incoming BLOB (binary large objects)
       
   352         * @param aDownloadFolder - shared, public folder for downloaded content
       
   353         */
       
   354         virtual void SetDownloadFolderL(const TDesC8& aDownloadFolder);
       
   355              
       
   356         /**
       
   357         * Gets filename of file attachment
       
   358         * @param aCid - cid for filename
       
   359         * @param aFileName - filename of file attachment with current cid
       
   360         * @return            KErrNone if no error, or some of the system
       
   361         *                    wide error codes.
       
   362         */
       
   363         virtual TInt FileAttachmentL(const TDesC8& aCid, HBufC8*& aFileName);
       
   364         
       
   365         /**
       
   366         * Sets filename of file attachment
       
   367         * @param aCid - cid for filename
       
   368         * @param aFileName - filename of file attachment with current cid
       
   369         * @return            KErrNone if no error, or some of the system
       
   370         *                    wide error codes.
       
   371         */
       
   372         virtual TInt SetFileAttachmentL(const TDesC8& aCid, const TDesC8& aFileName);
       
   373 
       
   374         /**
       
   375         * Apply binding.
       
   376         * @param aSoapVersion is a soap1.2 or soap1.1.
       
   377         */
       
   378         virtual void ApplyBindingL(TSOAPVersion aSoapVersion);
       
   379 
       
   380         /**
       
   381         * Gets namespace of Microsoft schema
       
   382         * @param aMwsNamespace - namespace 
       
   383         * @return            KErrNone if no error, or some of the system
       
   384         *                    wide error codes.
       
   385         */
       
   386         virtual TInt MwsNamespaceL(TPtrC8& aMwsNamespace);
       
   387         
       
   388         /**
       
   389         * Sets namespace of Microsoft schema
       
   390         * @param aMwsNamespace - namespace
       
   391         * @return            KErrNone if no error, or some of the system
       
   392         *                    wide error codes.
       
   393         */
       
   394         virtual void SetMwsNamespaceL(const TDesC8& aMwsNamespace);
       
   395 
       
   396         // From MSenProperties
       
   397         virtual void SetReader(CSenXmlReader& aReader);
       
   398         virtual TSenPropertiesClassType PropertiesClassType();
       
   399         virtual void WriteToL(RWriteStream& aWriteStream);
       
   400         virtual void ReadFromL(const TDesC8& aBuffer);
       
   401         virtual HBufC8* AsUtf8L();
       
   402         virtual HBufC8* AsUtf8LC();
       
   403         virtual TBool IsSafeToCast(TSenPropertiesClassType aClass);
       
   404         virtual MSenProperties* CloneL() const;
       
   405         
       
   406         virtual TInt SetPropertyL(const TDesC8& aName, const TDesC8& aValue);
       
   407         virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue);        
       
   408         virtual TInt SetPropertyL(const TDesC8& aName, const TDesC8& aValue, const TDesC8& aType);
       
   409         virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue, TPtrC8& aType);
       
   410         virtual TInt SetIntPropertyL(const TDesC8& aName, const TInt aValue);
       
   411         virtual TInt IntPropertyL(const TDesC8& aName, TInt& aValue);
       
   412         virtual TInt SetBoolPropertyL(const TDesC8& aName, const TBool aValue);        
       
   413         virtual TInt BoolPropertyL(const TDesC8& aName, TBool& aValue);
       
   414         virtual TInt SetOmittedL(const TDesC8& aName, TBool aValue);
       
   415         virtual TInt RemovePropertyL(const TDesC8& aName);
       
   416 
       
   417        /**
       
   418         * Destructor.
       
   419         */
       
   420         virtual ~CSenHttpTransportProperties();
       
   421 
       
   422     protected: // base class functions
       
   423 
       
   424         virtual void BaseConstructL(const TDesC8& aLocalname, 
       
   425                                     const TDesC8& aXml,
       
   426                                     CSenXmlReader* aParser = NULL);
       
   427 
       
   428         virtual void BaseConstructL(const TDesC8& aNamespace, 
       
   429                                     const TDesC8& aLocalname, 
       
   430                                     const TDesC8& aXml,
       
   431                                     CSenXmlReader* aParser = NULL);
       
   432 
       
   433         virtual void BaseConstructL(const TDesC8& aNamespace, 
       
   434                                     const TDesC8& aLocalname, 
       
   435                                     const TDesC8& aQualifiedName, 
       
   436                                     const TDesC8& aXml,
       
   437                                     CSenXmlReader* aParser = NULL);
       
   438 
       
   439         virtual void BaseConstructL(const CSenElement& aElement);
       
   440 
       
   441 	public:
       
   442         /**
       
   443         * Sets the SNAP ID.
       
   444         * @param aSnapId is the new SNAP ID.
       
   445         */
       
   446 		virtual void SetSnapIdL(TUint32 aSnapId);
       
   447 
       
   448         /**
       
   449         * Gets the SNAP ID.
       
   450         * @param aCurrentSnapId  A TUint32 reference to be filled in with the
       
   451         *                       value of the SNAP ID.
       
   452         * @return               KErrNone if no error, or some of the system
       
   453         *                       wide error codes.
       
   454         */
       
   455         virtual TInt SnapIdL(TUint32& aCurrentSnapId);
       
   456     protected:
       
   457         /**
       
   458         * Constructor.
       
   459         */
       
   460         CSenHttpTransportProperties();
       
   461     private:
       
   462         HBufC8* AdaptDblQutesLC(const TDesC8& aValue);
       
   463     };
       
   464 
       
   465 #endif // SEN_HTTP_TRANSPORT_PROPERTIES_H