Nebula
Loading...
Searching...
No Matches
nebulahttpclient.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
14#include "core/config.h"
15#include "core/refcounted.h"
16#include "net/tcpclient.h"
17#include "http/httpstatus.h"
18#include "http/httpmethod.h"
19#include "io/uri.h"
20#include "io/stream.h"
21
22//------------------------------------------------------------------------------
23namespace Http
24{
26{
28public:
32 virtual ~NebulaHttpClient();
33
37 const Util::String& GetUserAgent() const;
38
40 bool Connect(const IO::URI& uri);
42 void Disconnect();
44 bool IsConnected() const;
45
47 HttpStatus::Code SendRequest(HttpMethod::Code requestMethod, const IO::URI& uri, const Ptr<IO::Stream>& responseContentStream);
49 HttpStatus::Code SendRequest(HttpMethod::Code requestMethod, const IO::URI& uri, const Util::String & body, const Ptr<IO::Stream>& responseContentStream);
50private:
53};
54
55//------------------------------------------------------------------------------
58inline void
60{
61 this->userAgent = agent;
62}
63
64//------------------------------------------------------------------------------
67inline const Util::String&
69{
70 return this->userAgent;
71}
72
73} // namespace Simple
74//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:38
Code
http methods
Definition httpmethod.h:24
Code
status codes
Definition httpstatus.h:24
Definition nebulahttpclient.h:26
void SetUserAgent(const Util::String &userAgent)
set the user-agent to use for HTTP requests
Definition nebulahttpclient.h:59
NebulaHttpClient()
constructor
Definition nebulahttpclient.cc:22
virtual ~NebulaHttpClient()
destructor
Definition nebulahttpclient.cc:32
bool IsConnected() const
return true if currently connected
Definition nebulahttpclient.cc:78
__DeclareClass(NebulaHttpClient)
void Disconnect()
disconnect from the server
Definition nebulahttpclient.cc:66
HttpStatus::Code SendRequest(HttpMethod::Code requestMethod, const IO::URI &uri, const Ptr< IO::Stream > &responseContentStream)
send request and write result to provided response content stream
Definition nebulahttpclient.cc:87
bool Connect(const IO::URI &uri)
establish a connection to a HTTP server
Definition nebulahttpclient.cc:45
Ptr< Net::TcpClient > tcpClient
Definition nebulahttpclient.h:52
Util::String userAgent
Definition nebulahttpclient.h:51
const Util::String & GetUserAgent() const
get the user-agent
Definition nebulahttpclient.h:68
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition uri.h:67
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula compiler specific defines and configuration.
This file was generated with Nebula Trifid's idlc compiler tool.
Definition defaulthttprequesthandler.cc:15
Nebula's universal string class.
Definition string.h:50