|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // RHTTPMessage.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __RHTTPMESSAGE_H__ |
|
19 #define __RHTTPMESSAGE_H__ |
|
20 |
|
21 // Forward declarations |
|
22 class RHTTPHeaders; |
|
23 class MHTTPDataSupplier; |
|
24 class CMessage; |
|
25 |
|
26 |
|
27 class RUPnPMessage |
|
28 /** |
|
29 An abstract HTTP message. In RFC2616, an HTTP message is defined as having a |
|
30 header and an optional body. This class is specialised for HTTP requests and |
|
31 responses. |
|
32 @publishedAll |
|
33 @released |
|
34 */ |
|
35 { |
|
36 public: |
|
37 // Default (uninitialised) constructor. |
|
38 inline RUPnPMessage(); |
|
39 |
|
40 /** Returns the header collection for the message */ |
|
41 IMPORT_C RHTTPHeaders GetHeaderCollection(); |
|
42 |
|
43 /** Sets the messages body, replacing any existing body. The body |
|
44 is supplied as a MHTTPDataSupplier, which will then return the |
|
45 data in 1 or more chunks on request. |
|
46 @param aBody The data supplier that will supply the body. */ |
|
47 IMPORT_C void SetBody(MHTTPDataSupplier& aBody); |
|
48 |
|
49 /** Removes the body */ |
|
50 IMPORT_C void RemoveBody(); |
|
51 |
|
52 /** Determine whether this message has any associated body data. |
|
53 @return ETrue if there is some body data, EFalse if not. |
|
54 */ |
|
55 IMPORT_C TBool HasBody() const; |
|
56 |
|
57 /** Gets the body. The body is supplied as a MHTTPDataSupplier, |
|
58 which can be used to return the current data chunk, and to |
|
59 acknowledge when that chunk has been consumed by the client. |
|
60 |
|
61 Note that the client can assume the body object will remain |
|
62 unchanged from when it receives the first data until the end |
|
63 of the transaction. |
|
64 |
|
65 @return A data supplier that provides access to a body |
|
66 data chunk. NULL if the body has not been set, or has been removed */ |
|
67 IMPORT_C MHTTPDataSupplier* Body() const; |
|
68 |
|
69 protected: |
|
70 CMessage* iImplementation; |
|
71 }; |
|
72 |
|
73 |
|
74 inline RUPnPMessage::RUPnPMessage() |
|
75 : iImplementation(NULL) |
|
76 { |
|
77 }; |
|
78 |
|
79 |
|
80 #endif // __RUPnPMessage_H__ |