Go to the documentation of this file.
29 #ifndef __TERRALIB_WS_CORE_CURLWRAPPER_H
30 #define __TERRALIB_WS_CORE_CURLWRAPPER_H
39 #include "../../common/progress/TaskProgress.h"
40 #include "../../core/uri/URI.h"
106 virtual void post(
const te::core::URI& uri,
const std::string &postFields, const::std::string &header);
129 virtual void customRequest(
const te::core::URI& uri,
const std::string& request,
const std::string& body = std::string(
""), const::std::string &header = std::string(
""));
191 virtual void verifyURL(std::string url, uint32_t timeout)
const;
virtual void setAuthenticationMethod(const AuthenticationMethod &method)
Sets the authentication method that will be used on the requests.
virtual void addAuthParameters()
Adds HTTP Authentication parameters according to the current AuthenticationMethod.
virtual void putFile(const te::core::URI &uri, FILE *file, const ::std::string &header, te::common::TaskProgress *taskProgress=0, const long &fileSize=0L)
Method to request a put a file in a determined URI.
virtual void setPassword(const std::string &password)
Sets the password that will be used when an athentication method is set.
virtual std::vector< std::string > listFiles(const te::core::URI &uri)
Method to list files in a URI.
void setOption(int option, char *value)
std::unique_ptr< Impl > m_pimpl
virtual void downloadFile(const std::string &url, const std::string &filePath, te::common::TaskProgress *taskProgress=0)
Method to download a file retrieved from given URL and save into the specified file path.
virtual void downloadFile(const std::string &url, std::FILE *file, te::common::TaskProgress *taskProgress=0)
Method to download a file retrieved from given URL and save into the specified File.
virtual bool handleResponse(int curlStatusCode) const
Handles the response of a request.
CurlWrapper(CurlWrapper &&other)
CurlGlobalScope & operator=(const CurlGlobalScope &other)=delete
virtual std::vector< std::string > listFiles_(const te::core::URI &uri)
Private unsafe method to list files in a URI.
virtual void verifyURL(std::string url, uint32_t timeout) const
Verify if the URI is reacheble.
virtual void clean()
Reset the curl handle and the class members.
virtual const std::string & response() const
Returns the last operation response if the protocol allows it.
virtual void putFile(const te::core::URI &uri, const std::string &filePath, const ::std::string &header, te::common::TaskProgress *taskProgress=0)
Method to request a put with a file in a determined URI.
virtual void setUsername(const std::string &username)
Sets the user name that will be used when an athentication method is set.
A class to store the proxy information that must be used to access data located in URIs.
#define TEWSCOREEXPORT
You can use this macro in order to export/import classes and functions from this module.
virtual void post(const te::core::URI &uri, const std::string &postFields, const ::std::string &header)
Method to request a post in a determined URI.
CurlGlobalScope(const CurlGlobalScope &other)=delete
CurlGlobalScope & operator=(CurlGlobalScope &&other)=delete
virtual std::string getTaskMessage() const
This method gets the message that will be used on Progress Bar when this object is downloading some f...
void setOption(int option, std::string value)
virtual std::string getUsername() const
Gets the user name that will be used when an athentication method is set.
virtual void customRequest(const te::core::URI &uri, const std::string &request, const std::string &body=std::string(""), const ::std::string &header=std::string(""))
Method to make a custom request, useful for performing a HTTP DELETE request.
virtual void setTaskMessage(const std::string &taskMessage)
This method sets the message that will be used on Progress Bar when this object is downloading some f...
This class can be used to inform the progress of a task.
std::unique_lock< std::mutex > getLock()
Proxy configuration file for TerraView (see terraview_config.h).
static CurlGlobalScope curlScope_
void setOption(int option, int value)
An abstraction to Lib Curl functions.
virtual void setupEnvironment() const
Sets up the enviroment before any atempt to make a request.
virtual void downloadFile_(const std::string &url, std::FILE *file, te::common::TaskProgress *taskProgress=0)
Private unsafe method to download a file retrieved from given URL and save into the specified File.
virtual AuthenticationMethod getAuthenticationMethod() const
Gets current AuthenticationMethod.
CurlGlobalScope(CurlGlobalScope &&other)=delete
virtual const long responseCode() const
Returns the last operation response code.
virtual void get(const te::core::URI &uri, std::string &buffer)
Method to make a GET request.