1 /* |
|
2 * Copyright (c) 2003 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 the License "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: Handling of general url loading |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MURLSCHEMEHANDLER_H |
|
20 #define MURLSCHEMEHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include "urlloader_loaderutils.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // MACROS |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 // FUNCTION PROTOTYPES |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Base class for all loaders. |
|
41 * |
|
42 * @lib urlloader.lib |
|
43 * @since 2.0 |
|
44 */ |
|
45 class MUrlSchemeHandler : public CBase |
|
46 { |
|
47 |
|
48 public: // New functions |
|
49 |
|
50 /** |
|
51 * Make a generic load request |
|
52 * @since 2.0 |
|
53 * @param aUrl The request URL. |
|
54 * @param aHeader The request headers or NULL if no request specific headers. |
|
55 * @param aData The body and body length of the request. |
|
56 * @param aMethod The method to use for the request could be |
|
57 * NW_URL_METHOD_GET or NW_URL_METHOD_POST. |
|
58 * @param aTransId The request's transaction id. |
|
59 * @param aLoadContext The load context that should be returned with the response. |
|
60 * @param aLoadCallback The callback to call when the response is ready. |
|
61 * @param aPartialLoadCallback The callback to call when a chunk is ready. |
|
62 * @param aCacheMode The cache mode. It is relevant only in case of http or https. |
|
63 * @param aDefaultHeadersMask A flag indicating what default headers should be used. |
|
64 * @param aLoadType The load type |
|
65 * @param aIsTopLevel A boolean denoting if this url is top level (page, not images) |
|
66 * @param aIsScript Is it a WmlScript load event? |
|
67 * @return ETrue if processed the load request, EFalse otherwise |
|
68 */ |
|
69 virtual TBool HandleLoadRequestL(const TUint16* aUrl, void* aHeader, TPtr8& aData, |
|
70 TUint8 aMethod, TUint16 aTransId, void* aLoadContext, |
|
71 NW_Url_RespCallback_t* aPartialLoadCallback, |
|
72 NW_Cache_Mode_t aCacheMode, TUint aDefaultHeadersMask, |
|
73 TUint8 aLoadType, TBool aIsTopLevel, TBool aIsScript, |
|
74 NW_Uint8 aReason, void* aLoadData) = 0; |
|
75 |
|
76 /** |
|
77 * Call the partial response callback with a chunk. |
|
78 * @since 2.0 |
|
79 * @param aUri The response URL. |
|
80 * @param aBody The response body |
|
81 * @param aHeaders The response headers. Currently this is always NULL. |
|
82 * @param aContentType The content type. |
|
83 * @param aContentLocationString The content location string. |
|
84 * @param aNoStore "no-store" indicator prevents saving images. |
|
85 * @param aBoundaryString The boundary. |
|
86 * @param aCharset The character set. |
|
87 * @param aCharsetString The character set. |
|
88 * @param aHttpStatus The Http status code. |
|
89 * @param aMethod The method NW_URL_METHOD_GET or NW_URL_METHOD_POST . |
|
90 * @param aTransId The transaction id. |
|
91 * @param aContentLength The content length of the response. Used only for HEAD requests. |
|
92 * @param aErr The status of the response |
|
93 * @param aLoadContext The context that was passed with the request. |
|
94 * @param aPartialCallback The callback to call when a chunk is ready. |
|
95 * @return TBrowserStatusCode status of the partial buffer processing |
|
96 */ |
|
97 inline TBrowserStatusCode PartialResponse(const TUint16* aUri, TPtr8& aBody, |
|
98 void* aHeaders, TUint8* aContentTypeString, |
|
99 TUint8* aContentLocationString, NW_Bool aNoStore, TUint8* aBoundaryString, TUint16* aLastModified, |
|
100 TUint16 aCharset, TUint8* aCharsetString, TUint aHttpStatus, TUint8 aMethod, |
|
101 TUint16 aTransId, TInt aChunkIndex, void* aCertInfo, |
|
102 TUint aContentLength, TInt aErr, |
|
103 void* aLoadContext, NW_Url_RespCallback_t* aPartialCallback ); |
|
104 |
|
105 /** |
|
106 * Call the partial response callback with an error code. |
|
107 * @since 2.0 |
|
108 * @param aTransId The transaction id. |
|
109 * @param aErr The status of the response |
|
110 * @param aLoadContext The context that was passed with the request. |
|
111 * @param aCallback The callback to call when the response is ready. |
|
112 * @return TBrowserStatusCode status of the partial buffer processing |
|
113 */ |
|
114 inline TBrowserStatusCode PartialResponse(TUint16 aTransId, TInt aErr, void* aLoadContext, |
|
115 NW_Url_RespCallback_t* aPartialCallback); |
|
116 |
|
117 private: |
|
118 |
|
119 // Boolean to determine if 300 or 500 errors have associated content |
|
120 TBool iIsBodyPresent; |
|
121 |
|
122 }; |
|
123 |
|
124 #include "urlloader_murlschemehandler.inl" |
|
125 |
|
126 #endif // MURLSCHEMEHANDLER_H |
|
127 |
|
128 // End of File |
|