Implement wxWebResponse::GetMimeType() and GetSuggestedFileName()
This commit is contained in:
parent
f1d0a00911
commit
871049f1a1
@ -103,12 +103,16 @@ public:
|
||||
|
||||
virtual wxString GetHeader(const wxString& name) const = 0;
|
||||
|
||||
virtual wxString GetMimeType() const;
|
||||
|
||||
virtual int GetStatus() const = 0;
|
||||
|
||||
virtual wxString GetStatusText() const = 0;
|
||||
|
||||
virtual wxInputStream* GetStream() const = 0;
|
||||
|
||||
virtual wxString GetSuggestedFileName() const;
|
||||
|
||||
virtual wxString AsString(wxMBConv* conv = NULL) const = 0;
|
||||
|
||||
protected:
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "wx/webrequest.h"
|
||||
#include "wx/mstream.h"
|
||||
#include "wx/uri.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
@ -113,6 +115,33 @@ void wxWebRequest::ProcessStateEvent(State state, const wxString& failMsg)
|
||||
m_state = state;
|
||||
}
|
||||
|
||||
//
|
||||
// wxWebResponse
|
||||
//
|
||||
wxString wxWebResponse::GetMimeType() const
|
||||
{
|
||||
return GetHeader("Mime-Type");
|
||||
}
|
||||
|
||||
wxString wxWebResponse::GetSuggestedFileName() const
|
||||
{
|
||||
wxString suggestedFilename;
|
||||
|
||||
// TODO: get from Content-Disposition header
|
||||
|
||||
wxURI uri(GetURL());
|
||||
if ( uri.HasPath() )
|
||||
{
|
||||
wxFileName fn(uri.GetPath());
|
||||
suggestedFilename = fn.GetFullName();
|
||||
}
|
||||
else
|
||||
suggestedFilename = uri.GetServer();
|
||||
|
||||
return suggestedFilename;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// wxWebSession
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user