Version: 3.3.0
wxWebResponse Class Reference

#include <wx/webrequest.h>

Detailed Description

A wxWebResponse allows access to the response sent by the server.

Since
3.1.5

Library:  wxNet
Category:  Networking
See also
wxWebRequest

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...
 
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...
 
wxInputStreamGetStream ()
 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...
 

Constructor & Destructor Documentation

◆ wxWebResponse()

wxWebResponse::wxWebResponse ( )

Default constructor creates an invalid object.

Initialize it by assigning wxWebRequest::GetResponse() to it before using it.

See also
IsOk()

Member Function Documentation

◆ AsString()

wxString wxWebResponse::AsString ( ) const

Returns all response data as a string.

This is mostly useful for debugging or diagnostics.

◆ GetContentLength()

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.

◆ GetContentType()

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").

Since
3.3.0

◆ GetDataFile()

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.

◆ GetHeader()

wxString wxWebResponse::GetHeader ( const wxString name) const

Returns a header from the response or an empty string if the header could not be found.

Parameters
nameName of the header field

◆ GetMimeType()

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().

◆ GetStatus()

int wxWebResponse::GetStatus ( ) const

Returns the status code returned by the server.

◆ GetStatusText()

wxString wxWebResponse::GetStatusText ( ) const

Returns the status text of the response.

◆ GetStream()

wxInputStream* wxWebResponse::GetStream ( )

Returns a stream which represents the response data sent by the server.

◆ GetSuggestedFileName()

wxString wxWebResponse::GetSuggestedFileName ( ) const

Returns a suggested filename for the response data.

◆ GetURL()

wxString wxWebResponse::GetURL ( ) const

Returns the final URL.

This URL might be different than the request URL when a redirection occurred.

◆ IsOk()

bool wxWebResponse::IsOk ( ) const

Check if the object is valid.

No other methods can be used if this function returns false.