#include <wx/webrequest.h>
A wxWebResponse allows access to the response sent by the server.
Public Member Functions | |
wxWebResponse () | |
Default constructor creates an invalid object. More... | |
bool | IsOk () const |
Check if the object is valid. More... | |
wxString | GetURL () const |
Returns the final URL. More... | |
wxString | GetHeader (const wxString &name) const |
Returns a header from the response or an empty string if the header could not be found. More... | |
std::vector< wxString > | GetAllHeaderValues (const wxString &name) const |
Returns all values of response headers with the same name or an empty vector if the header could not be found at all. More... | |
wxFileOffset | GetContentLength () const |
Get the length of returned data if available. More... | |
wxString | GetMimeType () const |
Returns the MIME type of the response (if available). More... | |
wxString | GetContentType () const |
Returns the content type of the response (if available). More... | |
int | GetStatus () const |
Returns the status code returned by the server. More... | |
wxString | GetStatusText () const |
Returns the status text of the response. More... | |
wxInputStream * | GetStream () |
Returns a stream which represents the response data sent by the server. More... | |
wxString | GetSuggestedFileName () const |
Returns a suggested filename for the response data. More... | |
wxString | GetDataFile () const |
Returns the full path of the file to which data is being saved. More... | |
wxString | AsString () const |
Returns all response data as a string. More... | |
wxWebResponse::wxWebResponse | ( | ) |
Default constructor creates an invalid object.
Initialize it by assigning wxWebRequest::GetResponse() or wxWebRequestSync::GetResponse() to it before using it.
wxString wxWebResponse::AsString | ( | ) | const |
Returns all response data as a string.
This is mostly useful for debugging or diagnostics.
Returns all values of response headers with the same name or an empty vector if the header could not be found at all.
name | Name of the header fields |
wxFileOffset wxWebResponse::GetContentLength | ( | ) | const |
Get the length of returned data if available.
Returns the value specified in the Content-Length
response header or -1
if not available.
wxString wxWebResponse::GetContentType | ( | ) | const |
Returns the content type of the response (if available).
This is the full value of the Content-Type
header of the response, (e.g., a value such as "text/html; charset=utf-8").
wxString wxWebResponse::GetDataFile | ( | ) | const |
Returns the full path of the file to which data is being saved.
This is only valid when storage mode is Storage_File
.
Returns a header from the response or an empty string if the header could not be found.
name | Name of the header field |
wxString wxWebResponse::GetMimeType | ( | ) | const |
Returns the MIME type of the response (if available).
This is just the MIME type part (e.g., "text/html") of the value returned by GetContentType().
int wxWebResponse::GetStatus | ( | ) | const |
Returns the status code returned by the server.
wxString wxWebResponse::GetStatusText | ( | ) | const |
Returns the status text of the response.
wxInputStream* wxWebResponse::GetStream | ( | ) |
Returns a stream which represents the response data sent by the server.
wxString wxWebResponse::GetSuggestedFileName | ( | ) | const |
Returns a suggested filename for the response data.
wxString wxWebResponse::GetURL | ( | ) | const |
Returns the final URL.
This URL might be different than the request URL when a redirection occurred.
bool wxWebResponse::IsOk | ( | ) | const |
Check if the object is valid.
No other methods can be used if this function returns false.